forked from qt-creator/qt-creator
ProjectExplorer: Move BuildSystem owership to BuildConfiguration
... or Target. This patch moves build system from conceptually "one per project" to "one per target (i.e. per project-and-kit)" or "per BuildConfigurations" for targets where the builds differ significantly. Building requires usually items from the kit (Qt version, compiler, ...) so a target-agnostic build is practically almost always wrong. Moving the build system to the target also has the potential to solve issues caused by switching targets while parsing, that used Project::activeTarget() regularly, with potentially different results before and after the switch. This patch might create performance/size regressions when several targets are set up per project as the build system implementation's internal data are duplicated in this case. The idea is to fix that by sharing per-project pieces again in the project implementation once these problems occur. Change-Id: I87f640ce418b93175b5029124eaa55f3b8721dca Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -42,13 +42,13 @@ using namespace ProjectExplorer;
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
AutotoolsBuildSystem::AutotoolsBuildSystem(Project *project)
|
||||
: BuildSystem(project)
|
||||
AutotoolsBuildSystem::AutotoolsBuildSystem(Target *target)
|
||||
: BuildSystem(target)
|
||||
, m_cppCodeModelUpdater(new CppTools::CppProjectUpdater)
|
||||
{
|
||||
connect(project, &Project::activeBuildConfigurationChanged, this, [this]() { requestParse(); });
|
||||
connect(target, &Target::activeBuildConfigurationChanged, this, [this]() { requestParse(); });
|
||||
|
||||
connect(project, &Project::projectFileIsDirty, this, [this]() { requestParse(); });
|
||||
connect(target->project(), &Project::projectFileIsDirty, this, [this]() { requestParse(); });
|
||||
}
|
||||
|
||||
AutotoolsBuildSystem::~AutotoolsBuildSystem()
|
||||
@@ -62,7 +62,7 @@ AutotoolsBuildSystem::~AutotoolsBuildSystem()
|
||||
}
|
||||
}
|
||||
|
||||
void AutotoolsBuildSystem::parseProject(BuildSystem::ParsingContext &&ctx)
|
||||
void AutotoolsBuildSystem::triggerParsing()
|
||||
{
|
||||
if (m_makefileParserThread) {
|
||||
// The thread is still busy parsing a previous configuration.
|
||||
@@ -78,8 +78,7 @@ void AutotoolsBuildSystem::parseProject(BuildSystem::ParsingContext &&ctx)
|
||||
}
|
||||
|
||||
// Parse the makefile asynchronously in a thread
|
||||
m_makefileParserThread = new MakefileParserThread(project()->projectFilePath().toString(),
|
||||
std::move(ctx.guard));
|
||||
m_makefileParserThread = new MakefileParserThread(this);
|
||||
|
||||
connect(m_makefileParserThread,
|
||||
&MakefileParserThread::finished,
|
||||
@@ -114,7 +113,7 @@ void AutotoolsBuildSystem::makefileParsingFinished()
|
||||
QVector<Utils::FilePath> filesToWatch;
|
||||
|
||||
// Apply sources to m_files, which are returned at AutotoolsBuildSystem::files()
|
||||
const QFileInfo fileInfo = project()->projectFilePath().toFileInfo();
|
||||
const QFileInfo fileInfo = projectFilePath().toFileInfo();
|
||||
const QDir dir = fileInfo.absoluteDir();
|
||||
const QStringList files = m_makefileParserThread->sources();
|
||||
foreach (const QString& file, files)
|
||||
@@ -202,7 +201,7 @@ void AutotoolsBuildSystem::updateCppCodeModel()
|
||||
rpp.setMacros(m_makefileParserThread->macros());
|
||||
rpp.setFiles(m_files);
|
||||
|
||||
m_cppCodeModelUpdater->update({project(), kitInfo, project()->activeParseEnvironment(), {rpp}});
|
||||
m_cppCodeModelUpdater->update({project(), kitInfo, activeParseEnvironment(), {rpp}});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user