forked from qt-creator/qt-creator
ProjectExplorer: Introduce a ProjectConfiguration::kit() function
For convenience, and use it in some places. Change-Id: I8f7cb502b37b2fbf4cf2d17cac9c6299558332dc Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -138,7 +138,7 @@ bool AndroidBuildApkStep::init()
|
||||
OutputFormat::ErrorMessage);
|
||||
}
|
||||
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (!version)
|
||||
return false;
|
||||
|
||||
@@ -159,7 +159,7 @@ bool AndroidBuildApkStep::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
int minSDKForKit = AndroidManager::minimumSDK(target()->kit());
|
||||
const int minSDKForKit = AndroidManager::minimumSDK(kit());
|
||||
if (AndroidManager::minimumSDK(target()) < minSDKForKit) {
|
||||
emit addOutput(tr("The API level set for the APK is less than the minimum required by the kit."
|
||||
"\nThe minimum API level required by the kit is %1.").arg(minSDKForKit), OutputFormat::Stderr);
|
||||
@@ -384,7 +384,7 @@ void AndroidBuildApkStep::doRun()
|
||||
return inputExists; // qmake does this job for us
|
||||
|
||||
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (!version)
|
||||
return false;
|
||||
|
||||
@@ -505,13 +505,13 @@ void AndroidBuildApkStep::setBuildTargetSdk(const QString &sdk)
|
||||
QVariant AndroidBuildApkStep::data(Utils::Id id) const
|
||||
{
|
||||
if (id == Constants::AndroidNdkPlatform) {
|
||||
if (auto qtVersion = QtKitAspect::qtVersion(target()->kit()))
|
||||
if (auto qtVersion = QtKitAspect::qtVersion(kit()))
|
||||
return AndroidConfigurations::currentConfig()
|
||||
.bestNdkPlatformMatch(AndroidManager::minimumSDK(target()), qtVersion).mid(8);
|
||||
return {};
|
||||
}
|
||||
if (id == Constants::NdkLocation) {
|
||||
if (auto qtVersion = QtKitAspect::qtVersion(target()->kit()))
|
||||
if (auto qtVersion = QtKitAspect::qtVersion(kit()))
|
||||
return QVariant::fromValue(AndroidConfigurations::currentConfig().ndkLocation(qtVersion));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ QWidget *AndroidBuildApkWidget::createAdvancedGroup()
|
||||
verboseOutputCheckBox->setChecked(m_step->verboseOutput());
|
||||
|
||||
auto vbox = new QVBoxLayout(group);
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(step()->target()->kit());
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(step()->kit());
|
||||
if (version && version->supportsMultipleQtAbis()) {
|
||||
auto buildAAB = new QCheckBox(tr("Build .aab (Android App Bundle)"), group);
|
||||
buildAAB->setChecked(m_step->buildAAB());
|
||||
|
||||
@@ -86,7 +86,7 @@ AndroidDeployQtStep::AndroidDeployQtStep(BuildStepList *parent, Utils::Id id)
|
||||
: BuildStep(parent, id)
|
||||
{
|
||||
setImmutable(true);
|
||||
const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
m_uninstallPreviousPackage = qt && qt->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0);
|
||||
|
||||
//: AndroidDeployQtStep default display name
|
||||
@@ -99,11 +99,11 @@ AndroidDeployQtStep::AndroidDeployQtStep(BuildStepList *parent, Utils::Id id)
|
||||
|
||||
bool AndroidDeployQtStep::init()
|
||||
{
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (!version) {
|
||||
qCDebug(deployStepLog,
|
||||
"The Qt version for kit %s is not valid.",
|
||||
qPrintable(target()->kit()->displayName()));
|
||||
qPrintable(kit()->displayName()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ void AndroidDeployQtStep::setUninstallPreviousPackage(bool uninstall)
|
||||
|
||||
AndroidDeployQtStep::UninstallType AndroidDeployQtStep::uninstallPreviousPackage()
|
||||
{
|
||||
const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (qt && qt->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0))
|
||||
return ForceUninstall;
|
||||
return m_uninstallPreviousPackage ? Uninstall : Keep;
|
||||
|
||||
@@ -90,7 +90,7 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(BuildStepList *bs
|
||||
|
||||
bool AndroidPackageInstallationStep::init()
|
||||
{
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(target()->kit());
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit());
|
||||
QTC_ASSERT(tc, return false);
|
||||
|
||||
QString dirPath = nativeAndroidBuildPath();
|
||||
@@ -125,7 +125,7 @@ QString AndroidPackageInstallationStep::nativeAndroidBuildPath() const
|
||||
void AndroidPackageInstallationStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new GnuMakeParser);
|
||||
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->addLineParsers(kit()->createOutputParsers());
|
||||
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void AndroidPackageInstallationStep::doRun()
|
||||
// NOTE: This is a workaround for QTCREATORBUG-24155
|
||||
// Needed for Qt 5.15.0 and Qt 5.14.x versions
|
||||
if (buildType() == BuildConfiguration::BuildType::Debug) {
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (version && version->qtVersion() >= QtSupport::QtVersionNumber{5, 14}
|
||||
&& version->qtVersion() <= QtSupport::QtVersionNumber{5, 15, 0}) {
|
||||
const QString assetsDebugDir = nativeAndroidBuildPath().append(
|
||||
|
||||
@@ -228,8 +228,7 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
}
|
||||
}();
|
||||
if (initialCMakeArguments().isEmpty()) {
|
||||
QStringList initialArgs = defaultInitialCMakeArguments(target()->kit(),
|
||||
buildTypeName)
|
||||
QStringList initialArgs = defaultInitialCMakeArguments(kit(), buildTypeName)
|
||||
+ Utils::transform(conf, [this](const CMakeConfigItem &i) {
|
||||
return i.toArgument(macroExpander());
|
||||
});
|
||||
|
||||
@@ -414,7 +414,7 @@ void CMakeBuildSettingsWidget::updateAdvancedCheckBox()
|
||||
|
||||
void CMakeBuildSettingsWidget::updateFromKit()
|
||||
{
|
||||
const ProjectExplorer::Kit *k = m_buildConfiguration->target()->kit();
|
||||
const ProjectExplorer::Kit *k = m_buildConfiguration->kit();
|
||||
const CMakeConfig config = CMakeConfigurationKitAspect::configuration(k);
|
||||
|
||||
QHash<QString, QString> configHash;
|
||||
|
||||
@@ -209,7 +209,7 @@ bool CMakeBuildStep::init()
|
||||
canInit = false;
|
||||
}
|
||||
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(target()->kit());
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(kit());
|
||||
if (!tool || !tool->isValid()) {
|
||||
emit addTask(BuildSystemTask(Task::Error,
|
||||
tr("A CMake tool must be set up for building. "
|
||||
@@ -264,8 +264,7 @@ void CMakeBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
|
||||
formatter->addLineParser(progressParser);
|
||||
cmakeParser->setSourceDirectory(project()->projectDirectory().toString());
|
||||
formatter->addLineParsers({cmakeParser, new GnuMakeParser});
|
||||
const QList<Utils::OutputLineParser *> additionalParsers
|
||||
= target()->kit()->createOutputParsers();
|
||||
const QList<Utils::OutputLineParser *> additionalParsers = kit()->createOutputParsers();
|
||||
for (Utils::OutputLineParser * const p : additionalParsers)
|
||||
p->setRedirectionDetector(progressParser);
|
||||
formatter->addLineParsers(additionalParsers);
|
||||
@@ -371,7 +370,7 @@ void CMakeBuildStep::setToolArguments(const QString &list)
|
||||
|
||||
Utils::CommandLine CMakeBuildStep::cmakeCommand(RunConfiguration *rc) const
|
||||
{
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(target()->kit());
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(kit());
|
||||
|
||||
Utils::CommandLine cmd(tool ? tool->cmakeExecutable() : Utils::FilePath(), {});
|
||||
cmd.addArgs({"--build", "."});
|
||||
|
||||
@@ -757,7 +757,7 @@ void CMakeBuildSystem::wireUpConnections()
|
||||
|
||||
connect(project(), &Project::projectFileIsDirty, this, [this]() {
|
||||
if (cmakeBuildConfiguration()->isActive() && !isParsing()) {
|
||||
const auto cmake = CMakeKitAspect::cmakeTool(cmakeBuildConfiguration()->target()->kit());
|
||||
const auto cmake = CMakeKitAspect::cmakeTool(cmakeBuildConfiguration()->kit());
|
||||
if (cmake && cmake->isAutoRun()) {
|
||||
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
|
||||
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
|
||||
|
||||
@@ -91,8 +91,8 @@ GenericBuildConfigurationFactory::GenericBuildConfigurationFactory()
|
||||
|
||||
void GenericBuildConfiguration::addToEnvironment(Utils::Environment &env) const
|
||||
{
|
||||
prependCompilerPathToEnvironment(target()->kit(), env);
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
prependCompilerPathToEnvironment(kit(), env);
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (qt)
|
||||
env.prependOrSetPath(qt->hostBinPath().toString());
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ bool BuildConsoleBuildStep::init()
|
||||
void BuildConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new GnuMakeParser());
|
||||
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->addLineParsers(kit()->createOutputParsers());
|
||||
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ IBConsoleBuildStep::IBConsoleBuildStep(BuildStepList *buildStepList, Id id)
|
||||
void IBConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new GnuMakeParser());
|
||||
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->addLineParsers(kit()->createOutputParsers());
|
||||
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
IosBuildSettingsWidget::IosBuildSettingsWidget(IosBuildConfiguration *bc)
|
||||
: NamedWidget(IosBuildConfiguration::tr("iOS Settings")),
|
||||
m_bc(bc),
|
||||
m_isDevice(DeviceTypeKitAspect::deviceTypeId(bc->target()->kit())
|
||||
m_isDevice(DeviceTypeKitAspect::deviceTypeId(bc->kit())
|
||||
== Constants::IOS_DEVICE_TYPE)
|
||||
{
|
||||
auto detailsWidget = new Utils::DetailsWidget(this);
|
||||
@@ -423,7 +423,7 @@ void IosBuildConfiguration::updateQmakeCommand()
|
||||
if (signingIdentifier.isEmpty() )
|
||||
extraArgs << forceOverrideArg;
|
||||
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit());
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||
if (devType == Constants::IOS_DEVICE_TYPE && !signingIdentifier.isEmpty()) {
|
||||
if (m_autoManagedSigning->value()) {
|
||||
extraArgs << qmakeIosTeamSettings + signingIdentifier;
|
||||
|
||||
@@ -171,7 +171,7 @@ bool IosBuildStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(target()->kit());
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit());
|
||||
if (!tc)
|
||||
emit addTask(Task::compilerMissingTask());
|
||||
|
||||
@@ -190,7 +190,7 @@ bool IosBuildStep::init()
|
||||
void IosBuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new GnuMakeParser);
|
||||
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->addLineParsers(kit()->createOutputParsers());
|
||||
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ IosDeployStep::IosDeployStep(BuildStepList *parent, Utils::Id id)
|
||||
|
||||
void IosDeployStep::updateDisplayNames()
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(target()->kit());
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(kit());
|
||||
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
|
||||
setDefaultDisplayName(tr("Deploy to %1").arg(devName));
|
||||
setDisplayName(tr("Deploy to %1").arg(devName));
|
||||
@@ -121,7 +121,7 @@ void IosDeployStep::updateDisplayNames()
|
||||
bool IosDeployStep::init()
|
||||
{
|
||||
QTC_ASSERT(m_transferStatus == NoTransfer, return false);
|
||||
m_device = DeviceKitAspect::device(target()->kit());
|
||||
m_device = DeviceKitAspect::device(kit());
|
||||
auto runConfig = qobject_cast<const IosRunConfiguration *>(
|
||||
this->target()->activeRunConfiguration());
|
||||
QTC_ASSERT(runConfig, return false);
|
||||
|
||||
@@ -185,7 +185,7 @@ bool IosDsymBuildStep::isDefault() const
|
||||
|
||||
void IosDsymBuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->setLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->setLineParsers(kit()->createOutputParsers());
|
||||
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void IosDeviceTypeAspect::deviceChanges()
|
||||
|
||||
void IosDeviceTypeAspect::updateDeviceType()
|
||||
{
|
||||
if (DeviceTypeKitAspect::deviceTypeId(m_runConfiguration->target()->kit())
|
||||
if (DeviceTypeKitAspect::deviceTypeId(m_runConfiguration->kit())
|
||||
== Constants::IOS_DEVICE_TYPE)
|
||||
m_deviceType = IosDeviceType(IosDeviceType::IosDevice);
|
||||
else if (m_deviceType.type == IosDeviceType::IosDevice)
|
||||
@@ -140,11 +140,11 @@ void IosDeviceTypeAspect::updateDeviceType()
|
||||
|
||||
bool IosRunConfiguration::isEnabled() const
|
||||
{
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit());
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
||||
return false;
|
||||
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(target()->kit());
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(kit());
|
||||
if (dev.isNull() || dev->deviceState() != IDevice::DeviceReadyToUse)
|
||||
return false;
|
||||
|
||||
@@ -153,8 +153,7 @@ bool IosRunConfiguration::isEnabled() const
|
||||
|
||||
QString IosRunConfiguration::applicationName() const
|
||||
{
|
||||
Project *project = target()->project();
|
||||
if (ProjectNode *node = project->findNodeForBuildKey(buildKey()))
|
||||
if (ProjectNode *node = project()->findNodeForBuildKey(buildKey()))
|
||||
return node->data(Constants::IosTarget).toString();
|
||||
|
||||
return QString();
|
||||
@@ -162,7 +161,7 @@ QString IosRunConfiguration::applicationName() const
|
||||
|
||||
FilePath IosRunConfiguration::bundleDirectory() const
|
||||
{
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit());
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||
bool isDevice = (devType == Constants::IOS_DEVICE_TYPE);
|
||||
if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) {
|
||||
qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString();
|
||||
@@ -220,10 +219,10 @@ void IosDeviceTypeAspect::toMap(QVariantMap &map) const
|
||||
|
||||
QString IosRunConfiguration::disabledReason() const
|
||||
{
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit());
|
||||
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
|
||||
return tr("Kit has incorrect device type for running on iOS devices.");
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(target()->kit());
|
||||
IDevice::ConstPtr dev = DeviceKitAspect::device(kit());
|
||||
QString validDevName;
|
||||
bool hasConncetedDev = false;
|
||||
if (devType == Constants::IOS_DEVICE_TYPE) {
|
||||
|
||||
@@ -98,7 +98,7 @@ IosRunner::IosRunner(RunControl *runControl)
|
||||
stopRunningRunControl(runControl);
|
||||
auto runConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration());
|
||||
m_bundleDir = runConfig->bundleDirectory().toString();
|
||||
m_device = DeviceKitAspect::device(runControl->target()->kit());
|
||||
m_device = DeviceKitAspect::device(runControl->kit());
|
||||
m_deviceType = runConfig->deviceType();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ static Q_LOGGING_CATEGORY(mesonBuildSystemLog, "qtc.meson.buildsystem", QtDebugM
|
||||
|
||||
MesonBuildSystem::MesonBuildSystem(MesonBuildConfiguration *bc)
|
||||
: ProjectExplorer::BuildSystem{bc}
|
||||
, m_parser{MesonToolKitAspect::mesonToolId(bc->target()->kit()), bc->environment(), project()}
|
||||
, m_parser{MesonToolKitAspect::mesonToolId(bc->kit()), bc->environment(), project()}
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -105,7 +105,7 @@ void MesonBuildSystem::parsingCompleted(bool success)
|
||||
|
||||
ProjectExplorer::Kit *MesonBuildSystem::MesonBuildSystem::kit()
|
||||
{
|
||||
return buildConfiguration()->target()->kit();
|
||||
return buildConfiguration()->kit();
|
||||
}
|
||||
|
||||
QStringList MesonBuildSystem::configArgs(bool isSetup)
|
||||
|
||||
@@ -145,7 +145,7 @@ BuildStepConfigWidget *NinjaBuildStep::createConfigWidget()
|
||||
Utils::CommandLine NinjaBuildStep::command()
|
||||
{
|
||||
Utils::CommandLine cmd = [this] {
|
||||
auto tool = NinjaToolKitAspect::ninjaTool(target()->kit());
|
||||
auto tool = NinjaToolKitAspect::ninjaTool(kit());
|
||||
if (tool)
|
||||
return Utils::CommandLine{tool->exe()};
|
||||
return Utils::CommandLine{};
|
||||
@@ -207,7 +207,7 @@ void NinjaBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
|
||||
m_ninjaParser = new NinjaParser;
|
||||
m_ninjaParser->setSourceDirectory(project()->projectDirectory());
|
||||
formatter->addLineParser(m_ninjaParser);
|
||||
auto additionalParsers = target()->kit()->createOutputParsers();
|
||||
auto additionalParsers = kit()->createOutputParsers();
|
||||
std::for_each(std::cbegin(additionalParsers),
|
||||
std::cend(additionalParsers),
|
||||
[this](const auto parser) { parser->setRedirectionDetector(m_ninjaParser); });
|
||||
|
||||
@@ -109,12 +109,12 @@ NimbleBuildStep::NimbleBuildStep(BuildStepList *parentList, Id id)
|
||||
m_arguments->setArguments(defaultArguments());
|
||||
|
||||
setCommandLineProvider([this] {
|
||||
return CommandLine(Nim::nimblePathFromKit(target()->kit()),
|
||||
return CommandLine(Nim::nimblePathFromKit(kit()),
|
||||
{"build", m_arguments->arguments(macroExpander())});
|
||||
});
|
||||
setWorkingDirectoryProvider([this] { return project()->projectDirectory(); });
|
||||
setEnvironmentModifier([this](Environment &env) {
|
||||
env.appendOrSetPath(Nim::nimPathFromKit(target()->kit()).toUserOutput());
|
||||
env.appendOrSetPath(Nim::nimPathFromKit(kit()).toUserOutput());
|
||||
});
|
||||
|
||||
QTC_ASSERT(buildConfiguration(), return);
|
||||
|
||||
@@ -104,7 +104,7 @@ NimCompilerBuildStep::NimCompilerBuildStep(BuildStepList *parentList, Utils::Id
|
||||
void NimCompilerBuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new NimParser);
|
||||
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->addLineParsers(kit()->createOutputParsers());
|
||||
formatter->addSearchDir(buildDirectory());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
@@ -234,8 +234,7 @@ CommandLine NimCompilerBuildStep::commandLine()
|
||||
auto bc = qobject_cast<NimBuildConfiguration *>(buildConfiguration());
|
||||
QTC_ASSERT(bc, return {});
|
||||
|
||||
Kit *kit = target()->kit();
|
||||
auto tc = ToolChainKitAspect::toolChain(kit, Constants::C_NIMLANGUAGE_ID);
|
||||
auto tc = ToolChainKitAspect::toolChain(kit(), Constants::C_NIMLANGUAGE_ID);
|
||||
QTC_ASSERT(tc, return {});
|
||||
|
||||
CommandLine cmd{tc->compilerCommand()};
|
||||
|
||||
@@ -447,7 +447,7 @@ Environment BuildConfiguration::baseEnvironment() const
|
||||
if (useSystemEnvironment())
|
||||
result = Environment::systemEnvironment();
|
||||
addToEnvironment(result);
|
||||
target()->kit()->addToEnvironment(result);
|
||||
kit()->addToEnvironment(result);
|
||||
result.modify(project()->additionalEnvironment());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, Utils::Id id)
|
||||
|
||||
bool DeviceCheckBuildStep::init()
|
||||
{
|
||||
IDevice::ConstPtr device = DeviceKitAspect::device(target()->kit());
|
||||
IDevice::ConstPtr device = DeviceKitAspect::device(kit());
|
||||
if (!device) {
|
||||
Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(target()->kit());
|
||||
Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(kit());
|
||||
IDeviceFactory *factory = IDeviceFactory::find(deviceTypeId);
|
||||
if (!factory || !factory->canCreate()) {
|
||||
emit addOutput(tr("No device configured."), BuildStep::OutputFormat::ErrorMessage);
|
||||
@@ -71,7 +71,7 @@ bool DeviceCheckBuildStep::init()
|
||||
DeviceManager *dm = DeviceManager::instance();
|
||||
dm->addDevice(newDevice);
|
||||
|
||||
DeviceKitAspect::setDevice(target()->kit(), newDevice);
|
||||
DeviceKitAspect::setDevice(kit(), newDevice);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -210,7 +210,7 @@ bool MakeStep::init()
|
||||
void MakeStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new GnuMakeParser());
|
||||
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->addLineParsers(kit()->createOutputParsers());
|
||||
formatter->addSearchDir(processParameters()->effectiveWorkingDirectory());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ FilePath MakeStep::defaultMakeCommand() const
|
||||
if (!bc)
|
||||
return {};
|
||||
const Utils::Environment env = makeEnvironment();
|
||||
for (const ToolChain *tc : preferredToolChains(target()->kit())) {
|
||||
for (const ToolChain *tc : preferredToolChains(kit())) {
|
||||
FilePath make = tc->makeCommand(env);
|
||||
if (!make.isEmpty())
|
||||
return make;
|
||||
@@ -264,7 +264,7 @@ Task MakeStep::makeCommandMissingTask()
|
||||
|
||||
bool MakeStep::isJobCountSupported() const
|
||||
{
|
||||
const QList<ToolChain *> tcs = preferredToolChains(target()->kit());
|
||||
const QList<ToolChain *> tcs = preferredToolChains(kit());
|
||||
const ToolChain *tc = tcs.isEmpty() ? nullptr : tcs.constFirst();
|
||||
return tc && tc->isJobCountSupported();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ bool ProcessStep::init()
|
||||
|
||||
void ProcessStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParsers(target()->kit()->createOutputParsers());
|
||||
formatter->addLineParsers(kit()->createOutputParsers());
|
||||
AbstractProcessStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +206,11 @@ Project *ProjectConfiguration::project() const
|
||||
return m_target->project();
|
||||
}
|
||||
|
||||
Kit *ProjectConfiguration::kit() const
|
||||
{
|
||||
return m_target->kit();
|
||||
}
|
||||
|
||||
Utils::Id ProjectConfiguration::id() const
|
||||
{
|
||||
return m_id;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Kit;
|
||||
class Project;
|
||||
class ProjectConfigurationAspect;
|
||||
class ProjectConfigurationAspects;
|
||||
@@ -193,6 +194,7 @@ public:
|
||||
|
||||
Target *target() const;
|
||||
Project *project() const;
|
||||
Kit *kit() const;
|
||||
|
||||
static QString settingsIdKey();
|
||||
|
||||
|
||||
@@ -219,13 +219,13 @@ bool QmakeBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
|
||||
m_qmakeBuildConfiguration = BaseQtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt());
|
||||
|
||||
m_lastKitState = LastKitState(target()->kit());
|
||||
m_lastKitState = LastKitState(kit());
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmakeBuildConfiguration::kitChanged()
|
||||
{
|
||||
LastKitState newState = LastKitState(target()->kit());
|
||||
LastKitState newState = LastKitState(kit());
|
||||
if (newState != m_lastKitState) {
|
||||
// This only checks if the ids have changed!
|
||||
// For that reason the QmakeBuildConfiguration is also connected
|
||||
@@ -237,8 +237,8 @@ void QmakeBuildConfiguration::kitChanged()
|
||||
|
||||
void QmakeBuildConfiguration::updateProblemLabel()
|
||||
{
|
||||
ProjectExplorer::Kit * const k = target()->kit();
|
||||
const QString proFileName = target()->project()->projectFilePath().toString();
|
||||
ProjectExplorer::Kit * const k = kit();
|
||||
const QString proFileName = project()->projectFilePath().toString();
|
||||
|
||||
// Check for Qt version:
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
|
||||
@@ -442,7 +442,7 @@ void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable)
|
||||
QStringList QmakeBuildConfiguration::configCommandLineArguments() const
|
||||
{
|
||||
QStringList result;
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(target()->kit());
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(kit());
|
||||
BaseQtVersion::QmakeBuildConfigs defaultBuildConfiguration =
|
||||
version ? version->defaultBuildConfig() : BaseQtVersion::QmakeBuildConfigs(BaseQtVersion::DebugBuild | BaseQtVersion::BuildAll);
|
||||
BaseQtVersion::QmakeBuildConfigs userBuildConfiguration = m_qmakeBuildConfiguration;
|
||||
@@ -508,7 +508,7 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF
|
||||
return MakefileMissing;
|
||||
}
|
||||
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(target()->kit());
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(kit());
|
||||
if (!version) {
|
||||
qCDebug(logs) << "**No qt version in kit";
|
||||
return MakefileForWrongProject;
|
||||
@@ -806,7 +806,7 @@ BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
|
||||
|
||||
void QmakeBuildConfiguration::addToEnvironment(Environment &env) const
|
||||
{
|
||||
setupBuildEnvironment(target()->kit(), env);
|
||||
setupBuildEnvironment(kit(), env);
|
||||
}
|
||||
|
||||
void QmakeBuildConfiguration::setupBuildEnvironment(Kit *k, Environment &env)
|
||||
@@ -853,7 +853,7 @@ bool QmakeBuildConfiguration::regenerateBuildFiles(Node *node)
|
||||
BuildManager::appendStep(qs, BuildManager::displayNameForStepId(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
|
||||
|
||||
QmakeProFileNode *proFile = nullptr;
|
||||
if (node && node != target()->project()->rootProjectNode())
|
||||
if (node && node != project()->rootProjectNode())
|
||||
proFile = dynamic_cast<QmakeProFileNode *>(node);
|
||||
|
||||
setSubNodeBuild(proFile);
|
||||
|
||||
@@ -178,13 +178,13 @@ bool QmakeMakeStep::init()
|
||||
void QmakeMakeStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
|
||||
{
|
||||
formatter->addLineParser(new ProjectExplorer::GnuMakeParser());
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(target()->kit());
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit());
|
||||
OutputTaskParser *xcodeBuildParser = nullptr;
|
||||
if (tc && tc->targetAbi().os() == Abi::DarwinOS) {
|
||||
xcodeBuildParser = new XcodebuildParser;
|
||||
formatter->addLineParser(xcodeBuildParser);
|
||||
}
|
||||
QList<Utils::OutputLineParser *> additionalParsers = target()->kit()->createOutputParsers();
|
||||
QList<Utils::OutputLineParser *> additionalParsers = kit()->createOutputParsers();
|
||||
|
||||
// make may cause qmake to be run, add last to make sure it has a low priority.
|
||||
additionalParsers << new QMakeParser;
|
||||
|
||||
@@ -155,7 +155,7 @@ QMakeStepConfig QMakeStep::deducedArguments() const
|
||||
}
|
||||
}
|
||||
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(target()->kit());
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(kit);
|
||||
|
||||
config.archConfig = QMakeStepConfig::targetArchFor(targetAbi, version);
|
||||
config.osType = QMakeStepConfig::osTypeFor(targetAbi, version);
|
||||
@@ -170,7 +170,7 @@ bool QMakeStep::init()
|
||||
{
|
||||
m_wasSuccess = true;
|
||||
QmakeBuildConfiguration *qmakeBc = qmakeBuildConfiguration();
|
||||
const BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit());
|
||||
const BaseQtVersion *qtVersion = QtKitAspect::qtVersion(kit());
|
||||
|
||||
if (!qtVersion) {
|
||||
emit addOutput(tr("No Qt version configured."), BuildStep::OutputFormat::ErrorMessage);
|
||||
@@ -409,7 +409,7 @@ QString QMakeStep::makeArguments(const QString &makefile) const
|
||||
|
||||
QString QMakeStep::effectiveQMakeCall() const
|
||||
{
|
||||
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit());
|
||||
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(kit());
|
||||
QString qmake = qtVersion ? qtVersion->qmakeCommand().toUserOutput() : QString();
|
||||
if (qmake.isEmpty())
|
||||
qmake = tr("<no Qt version>");
|
||||
@@ -432,7 +432,7 @@ QStringList QMakeStep::parserArguments()
|
||||
{
|
||||
// NOTE: extra parser args placed before the other args intentionally
|
||||
QStringList result = m_extraParserArgs;
|
||||
BaseQtVersion *qt = QtKitAspect::qtVersion(target()->kit());
|
||||
BaseQtVersion *qt = QtKitAspect::qtVersion(kit());
|
||||
QTC_ASSERT(qt, return QStringList());
|
||||
for (QtcProcess::ConstArgIterator ait(allArguments(qt, ArgumentFlag::Expand)); ait.next(); ) {
|
||||
if (ait.isSimple())
|
||||
|
||||
@@ -226,7 +226,7 @@ void QmlBuildSystem::setMainFile(const QString &mainFilePath)
|
||||
|
||||
Utils::FilePath QmlBuildSystem::targetDirectory() const
|
||||
{
|
||||
if (DeviceTypeKitAspect::deviceTypeId(target()->kit())
|
||||
if (DeviceTypeKitAspect::deviceTypeId(kit())
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return canonicalProjectDir();
|
||||
|
||||
@@ -389,7 +389,7 @@ void QmlBuildSystem::updateDeploymentData()
|
||||
if (!m_projectItem)
|
||||
return;
|
||||
|
||||
if (DeviceTypeKitAspect::deviceTypeId(target()->kit())
|
||||
if (DeviceTypeKitAspect::deviceTypeId(kit())
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ QString QmlProjectRunConfiguration::disabledReason() const
|
||||
return tr("No script file to execute.");
|
||||
|
||||
const FilePath viewer = qmlScenePath();
|
||||
if (DeviceTypeKitAspect::deviceTypeId(target()->kit())
|
||||
if (DeviceTypeKitAspect::deviceTypeId(kit())
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|
||||
&& !viewer.exists()) {
|
||||
return tr("No qmlscene found.");
|
||||
@@ -198,7 +198,7 @@ QString QmlProjectRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
// arguments in .user file
|
||||
QString args = aspect<ArgumentsAspect>()->arguments(macroExpander());
|
||||
const IDevice::ConstPtr device = DeviceKitAspect::device(target()->kit());
|
||||
const IDevice::ConstPtr device = DeviceKitAspect::device(kit());
|
||||
const OsType osType = device ? device->osType() : HostOsInfo::hostOs();
|
||||
|
||||
// arguments from .qmlproject file
|
||||
|
||||
@@ -346,7 +346,7 @@ bool TarPackageCreationStep::runImpl()
|
||||
if (m_incrementalDeploymentAspect->value()) {
|
||||
m_files.clear();
|
||||
for (const DeployableFile &file : files)
|
||||
addNeededDeploymentFiles(file, target()->kit());
|
||||
addNeededDeploymentFiles(file, kit());
|
||||
} else {
|
||||
m_files = files;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ bool WinRtPackageDeploymentStep::init()
|
||||
if (!m_targetDirPath.endsWith(QLatin1Char('/')))
|
||||
m_targetDirPath += QLatin1Char('/');
|
||||
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (!qt)
|
||||
return false;
|
||||
|
||||
@@ -234,7 +234,7 @@ bool WinRtPackageDeploymentStep::init()
|
||||
|
||||
void WinRtPackageDeploymentStep::doRun()
|
||||
{
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target()->kit());
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(kit());
|
||||
if (!qt)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user