BuildSystem: Clean up use of BuildSystem::(kit|target|project)

Change-Id: I4852689cb54d02bb278f9cd596f1de506a43fc04
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2020-03-19 18:24:23 +01:00
parent 9e0a1b3621
commit a596421ffc
4 changed files with 71 additions and 71 deletions

View File

@@ -107,11 +107,11 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
// BuildDirManager: // BuildDirManager:
connect(&m_buildDirManager, &BuildDirManager::requestReparse, this, [this] { connect(&m_buildDirManager, &BuildDirManager::requestReparse, this, [this] {
if (m_buildConfiguration->isActive()) if (cmakeBuildConfiguration()->isActive())
requestParse(); requestParse();
}); });
connect(&m_buildDirManager, &BuildDirManager::requestDelayedReparse, this, [this] { connect(&m_buildDirManager, &BuildDirManager::requestDelayedReparse, this, [this] {
if (m_buildConfiguration->isActive()) if (cmakeBuildConfiguration()->isActive())
requestDelayedParse(); requestDelayedParse();
}); });
@@ -122,17 +122,17 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
this, &CMakeBuildSystem::handleParsingFailed); this, &CMakeBuildSystem::handleParsingFailed);
connect(&m_buildDirManager, &BuildDirManager::parsingStarted, this, [this]() { connect(&m_buildDirManager, &BuildDirManager::parsingStarted, this, [this]() {
m_buildConfiguration->clearError(CMakeBuildConfiguration::ForceEnabledChanged::True); cmakeBuildConfiguration()->clearError(CMakeBuildConfiguration::ForceEnabledChanged::True);
}); });
// Kit changed: // Kit changed:
connect(KitManager::instance(), &KitManager::kitUpdated, this, [this](Kit *k) { connect(KitManager::instance(), &KitManager::kitUpdated, this, [this](Kit *k) {
if (k != target()->kit()) if (k != kit())
return; // not for us... return; // not for us...
// Build configuration has not changed, but Kit settings might have: // Build configuration has not changed, but Kit settings might have:
// reparse and check the configuration, independent of whether the reader has changed // reparse and check the configuration, independent of whether the reader has changed
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to kit being updated"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to kit being updated";
m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration), m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
BuildDirManager::REPARSE_CHECK_CONFIGURATION); BuildDirManager::REPARSE_CHECK_CONFIGURATION);
}); });
@@ -144,22 +144,22 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
// * run cmake without configuration arguments if the reader stays // * run cmake without configuration arguments if the reader stays
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active target changed"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active target changed";
m_buildDirManager m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration), .setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
BuildDirManager::REPARSE_CHECK_CONFIGURATION); BuildDirManager::REPARSE_CHECK_CONFIGURATION);
} else { } else {
m_buildDirManager.stopParsingAndClearState(); m_buildDirManager.stopParsingAndClearState();
} }
}); });
connect(target(), &Target::activeBuildConfigurationChanged, this, [this](BuildConfiguration *bc) { connect(target(), &Target::activeBuildConfigurationChanged, this, [this](BuildConfiguration *bc) {
if (m_buildConfiguration->isActive()) { if (cmakeBuildConfiguration()->isActive()) {
if (m_buildConfiguration == bc) { if (cmakeBuildConfiguration() == bc) {
// Build configuration has switched: // Build configuration has switched:
// * Check configuration if reader changes due to it not existing yet:-) // * Check configuration if reader changes due to it not existing yet:-)
// * run cmake without configuration arguments if the reader stays // * run cmake without configuration arguments if the reader stays
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active BC changed"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active BC changed";
m_buildDirManager m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration), .setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
BuildDirManager::REPARSE_CHECK_CONFIGURATION); BuildDirManager::REPARSE_CHECK_CONFIGURATION);
} else { } else {
m_buildDirManager.stopParsingAndClearState(); m_buildDirManager.stopParsingAndClearState();
} }
@@ -167,19 +167,19 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
}); });
// BuildConfiguration changed: // BuildConfiguration changed:
connect(m_buildConfiguration, &CMakeBuildConfiguration::environmentChanged, this, [this]() { connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::environmentChanged, this, [this]() {
if (m_buildConfiguration->isActive()) { if (cmakeBuildConfiguration()->isActive()) {
// The environment on our BC has changed: // The environment on our BC has changed:
// * Error out if the reader updates, cannot happen since all BCs share a target/kit. // * Error out if the reader updates, cannot happen since all BCs share a target/kit.
// * run cmake without configuration arguments if the reader stays // * run cmake without configuration arguments if the reader stays
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to environment change"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to environment change";
m_buildDirManager m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration), .setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
BuildDirManager::REPARSE_CHECK_CONFIGURATION); BuildDirManager::REPARSE_CHECK_CONFIGURATION);
} }
}); });
connect(m_buildConfiguration, &CMakeBuildConfiguration::buildDirectoryChanged, this, [this]() { connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::buildDirectoryChanged, this, [this]() {
if (m_buildConfiguration->isActive()) { if (cmakeBuildConfiguration()->isActive()) {
// The build directory of our BC has changed: // The build directory of our BC has changed:
// * Error out if the reader updates, cannot happen since all BCs share a target/kit. // * Error out if the reader updates, cannot happen since all BCs share a target/kit.
// * run cmake without configuration arguments if the reader stays // * run cmake without configuration arguments if the reader stays
@@ -187,36 +187,36 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
// the reader. // the reader.
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to build directory change"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to build directory change";
m_buildDirManager m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration), .setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
BuildDirManager::REPARSE_CHECK_CONFIGURATION); BuildDirManager::REPARSE_CHECK_CONFIGURATION);
} }
}); });
connect(m_buildConfiguration, &CMakeBuildConfiguration::configurationForCMakeChanged, this, [this]() { connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::configurationForCMakeChanged, this, [this]() {
if (m_buildConfiguration->isActive()) { if (cmakeBuildConfiguration()->isActive()) {
// The CMake configuration has changed on our BC: // The CMake configuration has changed on our BC:
// * Error out if the reader updates, cannot happen since all BCs share a target/kit. // * Error out if the reader updates, cannot happen since all BCs share a target/kit.
// * run cmake with configuration arguments if the reader stays // * run cmake with configuration arguments if the reader stays
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to cmake configuration change"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to cmake configuration change";
m_buildDirManager m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration), .setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
BuildDirManager::REPARSE_FORCE_CONFIGURATION); BuildDirManager::REPARSE_FORCE_CONFIGURATION);
} }
}); });
connect(project(), &Project::projectFileIsDirty, this, [this]() { connect(project(), &Project::projectFileIsDirty, this, [this]() {
if (m_buildConfiguration->isActive() && !isParsing()) { if (cmakeBuildConfiguration()->isActive() && !isParsing()) {
const auto cmake = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit()); const auto cmake = CMakeKitAspect::cmakeTool(cmakeBuildConfiguration()->target()->kit());
if (cmake && cmake->isAutoRun()) { if (cmake && cmake->isAutoRun()) {
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
m_buildDirManager.setParametersAndRequestParse(BuildDirParameters( m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(
m_buildConfiguration), cmakeBuildConfiguration()),
BuildDirManager::REPARSE_DEFAULT); BuildDirManager::REPARSE_DEFAULT);
} }
} }
}); });
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to initial CMake BuildSystem setup"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to initial CMake BuildSystem setup";
m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration), m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
BuildDirManager::REPARSE_CHECK_CONFIGURATION); BuildDirManager::REPARSE_CHECK_CONFIGURATION);
} }
@@ -284,7 +284,7 @@ QStringList CMakeBuildSystem::filesGeneratedFrom(const QString &sourceFile) cons
QDir srcDirRoot = QDir(project.toString()); QDir srcDirRoot = QDir(project.toString());
QString relativePath = srcDirRoot.relativeFilePath(baseDirectory.toString()); QString relativePath = srcDirRoot.relativeFilePath(baseDirectory.toString());
QDir buildDir = QDir(buildConfiguration()->buildDirectory().toString()); QDir buildDir = QDir(cmakeBuildConfiguration()->buildDirectory().toString());
QString generatedFilePath = buildDir.absoluteFilePath(relativePath); QString generatedFilePath = buildDir.absoluteFilePath(relativePath);
if (fi.suffix() == "ui") { if (fi.suffix() == "ui") {
@@ -305,7 +305,7 @@ QStringList CMakeBuildSystem::filesGeneratedFrom(const QString &sourceFile) cons
void CMakeBuildSystem::runCMake() void CMakeBuildSystem::runCMake()
{ {
BuildDirParameters parameters(m_buildConfiguration); BuildDirParameters parameters(cmakeBuildConfiguration());
qCDebug(cmakeBuildSystemLog) << "Requesting parse due \"Run CMake\" command"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due \"Run CMake\" command";
m_buildDirManager.setParametersAndRequestParse(parameters, m_buildDirManager.setParametersAndRequestParse(parameters,
BuildDirManager::REPARSE_CHECK_CONFIGURATION BuildDirManager::REPARSE_CHECK_CONFIGURATION
@@ -315,7 +315,7 @@ void CMakeBuildSystem::runCMake()
void CMakeBuildSystem::runCMakeAndScanProjectTree() void CMakeBuildSystem::runCMakeAndScanProjectTree()
{ {
BuildDirParameters parameters(m_buildConfiguration); BuildDirParameters parameters(cmakeBuildConfiguration());
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to \"Rescan Project\" command"; qCDebug(cmakeBuildSystemLog) << "Requesting parse due to \"Rescan Project\" command";
m_buildDirManager.setParametersAndRequestParse(parameters, m_buildDirManager.setParametersAndRequestParse(parameters,
BuildDirManager::REPARSE_CHECK_CONFIGURATION BuildDirManager::REPARSE_CHECK_CONFIGURATION
@@ -325,7 +325,7 @@ void CMakeBuildSystem::runCMakeAndScanProjectTree()
void CMakeBuildSystem::buildCMakeTarget(const QString &buildTarget) void CMakeBuildSystem::buildCMakeTarget(const QString &buildTarget)
{ {
QTC_ASSERT(!buildTarget.isEmpty(), return); QTC_ASSERT(!buildTarget.isEmpty(), return);
m_buildConfiguration->buildTarget(buildTarget); cmakeBuildConfiguration()->buildTarget(buildTarget);
} }
void CMakeBuildSystem::handleTreeScanningFinished() void CMakeBuildSystem::handleTreeScanningFinished()
@@ -380,7 +380,7 @@ std::unique_ptr<CMakeProjectNode>
void CMakeBuildSystem::combineScanAndParse() void CMakeBuildSystem::combineScanAndParse()
{ {
if (m_buildConfiguration->isActive()) { if (cmakeBuildConfiguration()->isActive()) {
if (m_waitingForParse || m_waitingForScan) if (m_waitingForParse || m_waitingForScan)
return; return;
@@ -398,7 +398,7 @@ void CMakeBuildSystem::combineScanAndParse()
void CMakeBuildSystem::checkAndReportError(QString &errorMessage) void CMakeBuildSystem::checkAndReportError(QString &errorMessage)
{ {
if (!errorMessage.isEmpty()) { if (!errorMessage.isEmpty()) {
m_buildConfiguration->setError(errorMessage); cmakeBuildConfiguration()->setError(errorMessage);
errorMessage.clear(); errorMessage.clear();
} }
} }
@@ -409,13 +409,15 @@ void CMakeBuildSystem::updateProjectData()
QTC_ASSERT(m_treeScanner.isFinished() && !m_buildDirManager.isParsing(), return); QTC_ASSERT(m_treeScanner.isFinished() && !m_buildDirManager.isParsing(), return);
m_buildConfiguration->project()->setExtraProjectFiles(m_buildDirManager.projectFilesToWatch()); cmakeBuildConfiguration()->project()->setExtraProjectFiles(
m_buildDirManager.projectFilesToWatch());
CMakeConfig patchedConfig = m_buildConfiguration->configurationFromCMake(); CMakeConfig patchedConfig = cmakeBuildConfiguration()->configurationFromCMake();
{ {
CMakeConfigItem settingFileItem; CMakeConfigItem settingFileItem;
settingFileItem.key = "ANDROID_DEPLOYMENT_SETTINGS_FILE"; settingFileItem.key = "ANDROID_DEPLOYMENT_SETTINGS_FILE";
settingFileItem.value = m_buildConfiguration->buildDirectory() settingFileItem.value = cmakeBuildConfiguration()
->buildDirectory()
.pathAppended("android_deployment_settings.json") .pathAppended("android_deployment_settings.json")
.toString() .toString()
.toUtf8(); .toUtf8();
@@ -479,7 +481,7 @@ void CMakeBuildSystem::updateProjectData()
QString errorMessage; QString errorMessage;
RawProjectParts rpps = m_buildDirManager.createRawProjectParts(errorMessage); RawProjectParts rpps = m_buildDirManager.createRawProjectParts(errorMessage);
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
m_buildConfiguration->setError(errorMessage); cmakeBuildConfiguration()->setError(errorMessage);
qCDebug(cmakeBuildSystemLog) << "Raw project parts created." << errorMessage; qCDebug(cmakeBuildSystemLog) << "Raw project parts created." << errorMessage;
for (RawProjectPart &rpp : rpps) { for (RawProjectPart &rpp : rpps) {
@@ -491,13 +493,13 @@ void CMakeBuildSystem::updateProjectData()
rpp.setFlagsForC({kitInfo.cToolChain, rpp.flagsForC.commandLineFlags}); rpp.setFlagsForC({kitInfo.cToolChain, rpp.flagsForC.commandLineFlags});
} }
m_cppCodeModelUpdater->update({p, kitInfo, m_buildConfiguration->environment(), rpps}); m_cppCodeModelUpdater->update({p, kitInfo, cmakeBuildConfiguration()->environment(), rpps});
} }
{ {
updateQmlJSCodeModel(); updateQmlJSCodeModel();
} }
emit m_buildConfiguration->buildTypeChanged(); emit cmakeBuildConfiguration()->buildTypeChanged();
m_buildDirManager.resetData(); m_buildDirManager.resetData();
@@ -506,12 +508,12 @@ void CMakeBuildSystem::updateProjectData()
void CMakeBuildSystem::handleParsingSucceeded() void CMakeBuildSystem::handleParsingSucceeded()
{ {
if (!m_buildConfiguration->isActive()) { if (!cmakeBuildConfiguration()->isActive()) {
m_buildDirManager.stopParsingAndClearState(); m_buildDirManager.stopParsingAndClearState();
return; return;
} }
m_buildConfiguration->clearError(); cmakeBuildConfiguration()->clearError();
QString errorMessage; QString errorMessage;
{ {
@@ -522,7 +524,7 @@ void CMakeBuildSystem::handleParsingSucceeded()
{ {
const CMakeConfig cmakeConfig = m_buildDirManager.takeCMakeConfiguration(errorMessage); const CMakeConfig cmakeConfig = m_buildDirManager.takeCMakeConfiguration(errorMessage);
checkAndReportError(errorMessage); checkAndReportError(errorMessage);
m_buildConfiguration->setConfigurationFromCMake(cmakeConfig); cmakeBuildConfiguration()->setConfigurationFromCMake(cmakeConfig);
} }
setApplicationTargets(appTargets()); setApplicationTargets(appTargets());
@@ -533,10 +535,11 @@ void CMakeBuildSystem::handleParsingSucceeded()
void CMakeBuildSystem::handleParsingFailed(const QString &msg) void CMakeBuildSystem::handleParsingFailed(const QString &msg)
{ {
m_buildConfiguration->setError(msg); cmakeBuildConfiguration()->setError(msg);
QString errorMessage; QString errorMessage;
m_buildConfiguration->setConfigurationFromCMake(m_buildDirManager.takeCMakeConfiguration(errorMessage)); cmakeBuildConfiguration()->setConfigurationFromCMake(
m_buildDirManager.takeCMakeConfiguration(errorMessage));
// ignore errorMessage here, we already got one. // ignore errorMessage here, we already got one.
handleParsingError(); handleParsingError();
@@ -563,8 +566,8 @@ static Utils::FilePaths librarySearchPaths(const CMakeBuildSystem *bs, const QSt
const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
{ {
QList<BuildTargetInfo> appTargetList; QList<BuildTargetInfo> appTargetList;
const bool forAndroid = DeviceTypeKitAspect::deviceTypeId(target()->kit()) const bool forAndroid = DeviceTypeKitAspect::deviceTypeId(kit())
== Android::Constants::ANDROID_DEVICE_TYPE; == Android::Constants::ANDROID_DEVICE_TYPE;
for (const CMakeBuildTarget &ct : m_buildTargets) { for (const CMakeBuildTarget &ct : m_buildTargets) {
if (ct.targetType == UtilityType) if (ct.targetType == UtilityType)
continue; continue;
@@ -609,8 +612,8 @@ DeploymentData CMakeBuildSystem::deploymentData() const
{ {
DeploymentData result; DeploymentData result;
QDir sourceDir = target()->project()->projectDirectory().toString(); QDir sourceDir = project()->projectDirectory().toString();
QDir buildDir = buildConfiguration()->buildDirectory().toString(); QDir buildDir = cmakeBuildConfiguration()->buildDirectory().toString();
QString deploymentPrefix; QString deploymentPrefix;
QString deploymentFilePath = sourceDir.filePath("QtCreatorDeployment.txt"); QString deploymentFilePath = sourceDir.filePath("QtCreatorDeployment.txt");
@@ -709,7 +712,7 @@ void CMakeBuildSystem::updateQmlJSCodeModel()
projectInfo.importPaths.clear(); projectInfo.importPaths.clear();
const CMakeConfig &cm = m_buildConfiguration->configurationFromCMake(); const CMakeConfig &cm = cmakeBuildConfiguration()->configurationFromCMake();
const QString cmakeImports = QString::fromUtf8(CMakeConfigItem::valueOf("QML_IMPORT_PATH", cm)); const QString cmakeImports = QString::fromUtf8(CMakeConfigItem::valueOf("QML_IMPORT_PATH", cm));
foreach (const QString &cmakeImport, CMakeConfigItem::cmakeSplitValue(cmakeImports)) foreach (const QString &cmakeImport, CMakeConfigItem::cmakeSplitValue(cmakeImports))

View File

@@ -369,8 +369,8 @@ void CompilationDatabaseBuildSystem::triggerParsing()
void CompilationDatabaseBuildSystem::buildTreeAndProjectParts() void CompilationDatabaseBuildSystem::buildTreeAndProjectParts()
{ {
Kit *kit = target()->kit(); Kit *k = kit();
ProjectExplorer::KitInfo kitInfo(kit); ProjectExplorer::KitInfo kitInfo(k);
QTC_ASSERT(kitInfo.isValid(), return); QTC_ASSERT(kitInfo.isValid(), return);
// Reset toolchains to pick them based on the database entries. // Reset toolchains to pick them based on the database entries.
kitInfo.cToolChain = nullptr; kitInfo.cToolChain = nullptr;
@@ -389,7 +389,7 @@ void CompilationDatabaseBuildSystem::buildTreeAndProjectParts()
prevEntry = &entry; prevEntry = &entry;
RawProjectPart rpp = makeRawProjectPart(projectFilePath(), RawProjectPart rpp = makeRawProjectPart(projectFilePath(),
kit, k,
kitInfo, kitInfo,
entry.workingDir, entry.workingDir,
entry.fileName, entry.fileName,

View File

@@ -239,8 +239,7 @@ static void createTree(QmakeBuildSystem *buildSystem,
std::unique_ptr<QmakeProFileNode> QmakeNodeTreeBuilder::buildTree(QmakeBuildSystem *buildSystem) std::unique_ptr<QmakeProFileNode> QmakeNodeTreeBuilder::buildTree(QmakeBuildSystem *buildSystem)
{ {
// Remove qmake implementation details that litter up the project data: // Remove qmake implementation details that litter up the project data:
Target *t = buildSystem->target(); BaseQtVersion *qt = QtKitAspect::qtVersion(buildSystem->kit());
BaseQtVersion *qt = QtKitAspect::qtVersion(t->kit());
const FilePaths toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FilePaths(); const FilePaths toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FilePaths();

View File

@@ -577,12 +577,13 @@ void QmakeBuildSystem::asyncUpdate()
m_asyncUpdateFutureInterface.reportStarted(); m_asyncUpdateFutureInterface.reportStarted();
const Kit * const kit = target()->kit(); const Kit *const k = kit();
QtSupport::BaseQtVersion * const qtVersion = QtSupport::QtKitAspect::qtVersion(kit); QtSupport::BaseQtVersion *const qtVersion = QtSupport::QtKitAspect::qtVersion(k);
if (!qtVersion || !qtVersion->isValid()) { if (!qtVersion || !qtVersion->isValid()) {
const QString errorMessage = kit const QString errorMessage
? tr("Cannot parse project \"%1\": The currently selected kit \"%2\" does not " = k ? tr("Cannot parse project \"%1\": The currently selected kit \"%2\" does not "
"have a valid Qt.").arg(project()->displayName(), kit->displayName()) "have a valid Qt.")
.arg(project()->displayName(), k->displayName())
: tr("Cannot parse project \"%1\": No kit selected.").arg(project()->displayName()); : tr("Cannot parse project \"%1\": No kit selected.").arg(project()->displayName());
proFileParseError(errorMessage); proFileParseError(errorMessage);
m_asyncUpdateFutureInterface.reportCanceled(); m_asyncUpdateFutureInterface.reportCanceled();
@@ -668,13 +669,14 @@ QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFi
QStringList qmakeArgs; QStringList qmakeArgs;
Target *t = target(); Kit *k = kit();
Kit *k = t->kit(); QmakeBuildConfiguration *bc = m_buildConfiguration;
Environment env = m_buildConfiguration->environment();
if (QMakeStep *qs = m_buildConfiguration->qmakeStep()) Environment env = bc->environment();
if (QMakeStep *qs = bc->qmakeStep())
qmakeArgs = qs->parserArguments(); qmakeArgs = qs->parserArguments();
else else
qmakeArgs = m_buildConfiguration->configCommandLineArguments(); qmakeArgs = bc->configCommandLineArguments();
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(k); QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(k);
m_qmakeSysroot = SysRootKitAspect::sysRoot(k).toString(); m_qmakeSysroot = SysRootKitAspect::sysRoot(k).toString();
@@ -757,7 +759,7 @@ void QmakeBuildSystem::deregisterFromCacheManager()
void QmakeBuildSystem::activeTargetWasChanged(Target *t) void QmakeBuildSystem::activeTargetWasChanged(Target *t)
{ {
// We are only interested in our own target. // We are only interested in our own target.
if (t != m_buildConfiguration->target()) if (t != target())
return; return;
m_invalidateQmakeVfsContents = true; m_invalidateQmakeVfsContents = true;
@@ -1052,7 +1054,7 @@ void QmakeBuildSystem::updateBuildSystemData()
libraryPaths.append(dir); libraryPaths.append(dir);
} }
} }
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(target()->kit()); QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(kit());
if (qtVersion) if (qtVersion)
libraryPaths.append(qtVersion->librarySearchPath().toString()); libraryPaths.append(qtVersion->librarySearchPath().toString());
@@ -1126,8 +1128,7 @@ void QmakeBuildSystem::collectLibraryData(const QmakeProFile *file, DeploymentDa
const QString targetPath = file->installsList().targetPath; const QString targetPath = file->installsList().targetPath;
if (targetPath.isEmpty()) if (targetPath.isEmpty())
return; return;
const Kit * const kit = target()->kit(); const ToolChain *const toolchain = ToolChainKitAspect::cxxToolChain(kit());
const ToolChain * const toolchain = ToolChainKitAspect::cxxToolChain(kit);
if (!toolchain) if (!toolchain)
return; return;
@@ -1270,21 +1271,18 @@ void QmakeBuildSystem::testToolChain(ToolChain *tc, const FilePath &path) const
void QmakeBuildSystem::warnOnToolChainMismatch(const QmakeProFile *pro) const void QmakeBuildSystem::warnOnToolChainMismatch(const QmakeProFile *pro) const
{ {
const Target *t = target(); const BuildConfiguration *bc = m_buildConfiguration;
const BuildConfiguration *bc = t ? t->activeBuildConfiguration() : nullptr;
if (!bc) if (!bc)
return; return;
testToolChain(ToolChainKitAspect::cToolChain(t->kit()), testToolChain(ToolChainKitAspect::cToolChain(kit()), getFullPathOf(pro, Variable::QmakeCc, bc));
getFullPathOf(pro, Variable::QmakeCc, bc)); testToolChain(ToolChainKitAspect::cxxToolChain(kit()),
testToolChain(ToolChainKitAspect::cxxToolChain(t->kit()),
getFullPathOf(pro, Variable::QmakeCxx, bc)); getFullPathOf(pro, Variable::QmakeCxx, bc));
} }
QString QmakeBuildSystem::executableFor(const QmakeProFile *file) QString QmakeBuildSystem::executableFor(const QmakeProFile *file)
{ {
const Kit *const kit = target()->kit(); const ToolChain *const tc = ToolChainKitAspect::cxxToolChain(kit());
const ToolChain *const tc = ToolChainKitAspect::cxxToolChain(kit);
if (!tc) if (!tc)
return QString(); return QString();