blob: d918e24dc202c89d5b670b0d359de3999c2d3a75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "appmanagercreatepackagestep.h"
#include "appmanagerconstants.h"
#include "appmanagerstringaspect.h"
#include "appmanagertargetinformation.h"
#include "appmanagertr.h"
#include "appmanagerutilities.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/environmentkitaspect.h>
#include <projectexplorer/processparameters.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace AppManager::Internal {
#define SETTINGSPREFIX "ApplicationManagerPlugin.Deploy.CreatePackageStep."
const char ArgumentsDefault[] = "create-package --verbose --json";
class AppManagerCreatePackageStep final : public AbstractProcessStep
{
public:
AppManagerCreatePackageStep(BuildStepList *bsl, Id id)
: AbstractProcessStep(bsl, id)
{
setDisplayName(Tr::tr("Create Application Manager package"));
packager.setSettingsKey(SETTINGSPREFIX "Executable");
packager.setDefaultPathValue(getToolFilePath(Constants::APPMAN_PACKAGER, kit()));
arguments.setSettingsKey(SETTINGSPREFIX "Arguments");
arguments.setResetter([] { return QLatin1String(ArgumentsDefault); });
arguments.resetArguments();
sourceDirectory.setSettingsKey(SETTINGSPREFIX "SourceDirectory");
sourceDirectory.setLabelText(Tr::tr("Source directory:"));
sourceDirectory.setExpectedKind(Utils::PathChooser::ExistingDirectory);
packageFile.setSettingsKey(SETTINGSPREFIX "FileName");
packageFile.setLabelText(Tr::tr("Package file:"));
packageFile.setExpectedKind(Utils::PathChooser::SaveFile);
}
bool init() final
{
if (!AbstractProcessStep::init())
return false;
const FilePath packagerPath = packager().isEmpty() ?
FilePath::fromString(packager.defaultValue()) :
packager();
const QString packagerArguments = arguments();
const FilePath sourceDirectoryPath = sourceDirectory().isEmpty() ?
FilePath::fromString(sourceDirectory.defaultValue()) :
sourceDirectory();
const FilePath packageFilePath = packageFile().isEmpty() ?
FilePath::fromString(packageFile.defaultValue()) :
packageFile();
CommandLine cmd(packagerPath);
cmd.addArgs(packagerArguments, CommandLine::Raw);
cmd.addArgs({packageFilePath.nativePath(), sourceDirectoryPath.nativePath()});
processParameters()->setCommandLine(cmd);
return true;
}
private:
AppManagerPackagerAspect packager{this};
ProjectExplorer::ArgumentsAspect arguments{this};
FilePathAspect sourceDirectory{this};
FilePathAspect packageFile{this};
};
// Factory
class AppManagerCreatePackageStepFactory final : public BuildStepFactory
{
public:
AppManagerCreatePackageStepFactory()
{
registerStep<AppManagerCreatePackageStep>(Constants::CREATE_PACKAGE_STEP_ID);
setDisplayName(Tr::tr("Create Application Manager package"));
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
}
};
void setupAppManagerCreatePackageStep()
{
static AppManagerCreatePackageStepFactory theAppManagerCreatePackageStepFactory;
}
} // AppManager::Internal
|