GenericProjectManager: Fix wrong uses of ProjectExplorer::Target

Change-Id: I82295664e040dd3116e4cfaca58e14b24c50f4c4
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2025-03-11 14:39:28 +01:00
parent 1d0d1451e7
commit e6c9d3d1f4

View File

@@ -266,11 +266,7 @@ GenericBuildSystem::GenericBuildSystem(BuildConfiguration *bc)
connect(&m_deployFileWatcher, &FileSystemWatcher::fileChanged, connect(&m_deployFileWatcher, &FileSystemWatcher::fileChanged,
this, &GenericBuildSystem::updateDeploymentData); this, &GenericBuildSystem::updateDeploymentData);
connect(project(), &Project::activeBuildConfigurationChanged, this, [this] {
connect(bc->target(), &Target::activeBuildConfigurationChanged, this, [this] {
refresh(Everything);
});
connect(project(), &Project::activeTargetChanged, this, [this] {
refresh(Everything); refresh(Everything);
}); });
} }
@@ -564,13 +560,8 @@ void GenericBuildSystem::refresh(RefreshOptions options)
GenericBuildSystem::SourceFiles GenericBuildSystem::processEntries( GenericBuildSystem::SourceFiles GenericBuildSystem::processEntries(
const QStringList &paths, QHash<QString, QString> *map) const const QStringList &paths, QHash<QString, QString> *map) const
{ {
const BuildConfiguration *const buildConfig = target()->activeBuildConfiguration(); const Environment buildEnv = buildConfiguration()->environment();
const MacroExpander *expander = buildConfiguration()->macroExpander();
const Environment buildEnv = buildConfig ? buildConfig->environment()
: Environment::systemEnvironment();
const MacroExpander *expander = buildConfig ? buildConfig->macroExpander()
: target()->macroExpander();
const QDir projectDir(projectDirectory().toUrlishString()); const QDir projectDir(projectDirectory().toUrlishString());
@@ -613,8 +604,6 @@ void GenericBuildSystem::refreshCppCodeModel()
{ {
if (!m_cppCodeModelUpdater) if (!m_cppCodeModelUpdater)
return; return;
if (target() != project()->activeTarget())
return;
QtSupport::CppKitInfo kitInfo(kit()); QtSupport::CppKitInfo kitInfo(kit());
QTC_ASSERT(kitInfo.isValid(), return); QTC_ASSERT(kitInfo.isValid(), return);
@@ -643,9 +632,7 @@ void GenericBuildSystem::updateDeploymentData()
{ {
static const QString fileName("QtCreatorDeployment.txt"); static const QString fileName("QtCreatorDeployment.txt");
FilePath deploymentFilePath; FilePath deploymentFilePath;
BuildConfiguration *bc = target()->activeBuildConfiguration(); deploymentFilePath = buildConfiguration()->buildDirectory().pathAppended(fileName);
if (bc)
deploymentFilePath = bc->buildDirectory().pathAppended(fileName);
bool hasDeploymentData = deploymentFilePath.exists(); bool hasDeploymentData = deploymentFilePath.exists();
if (!hasDeploymentData) { if (!hasDeploymentData) {