diff options
author | hjk <[email protected]> | 2019-10-25 09:55:32 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2019-11-19 11:05:52 +0000 |
commit | 27586827238ca9079860e77a7b23ae20d163143e (patch) | |
tree | 2197dc7f97a4a70524381071888336558dc0b4a3 /src/plugins/qmakeprojectmanager/qmakemakestep.cpp | |
parent | 9073c46c9c431ec0e83987a5781163ca7b1f7ea7 (diff) |
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 <[email protected]>
Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'src/plugins/qmakeprojectmanager/qmakemakestep.cpp')
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakemakestep.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp index 77aec206cfd..3de706a50fb 100644 --- a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp @@ -48,7 +48,6 @@ #include <QDir> #include <QFileInfo> -using ExtensionSystem::PluginManager; using namespace ProjectExplorer; using namespace QmakeProjectManager; using namespace QmakeProjectManager::Internal; @@ -85,12 +84,12 @@ bool QmakeMakeStep::init() ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); - QString workingDirectory; + Utils::FilePath workingDirectory; if (bc->subNodeBuild()) - workingDirectory = bc->subNodeBuild()->buildDir(); + workingDirectory = bc->subNodeBuild()->buildDir(bc); else - workingDirectory = bc->buildDirectory().toString(); - pp->setWorkingDirectory(Utils::FilePath::fromString(workingDirectory)); + workingDirectory = bc->buildDirectory(); + pp->setWorkingDirectory(workingDirectory); // If we are cleaning, then make can fail with a error code, but that doesn't mean // we should stop the clean queue @@ -117,13 +116,14 @@ bool QmakeMakeStep::init() if (makefile != "Makefile") makeCmd.addArgs({"-f", makefile}); - m_makeFileToCheck = QDir(workingDirectory).filePath(makefile); + m_makeFileToCheck = QDir(workingDirectory.toString()).filePath(makefile); } else { - if (!bc->makefile().isEmpty()) { - makeCmd.addArgs({"-f", bc->makefile()}); - m_makeFileToCheck = QDir(workingDirectory).filePath(bc->makefile()); + QString makefile = bc->makefile(); + if (!makefile.isEmpty()) { + makeCmd.addArgs({"-f", makefile}); + m_makeFileToCheck = QDir(workingDirectory.toString()).filePath(makefile); } else { - m_makeFileToCheck = QDir(workingDirectory).filePath("Makefile"); + m_makeFileToCheck = QDir(workingDirectory.toString()).filePath("Makefile"); } } @@ -168,7 +168,9 @@ bool QmakeMakeStep::init() appendOutputParser(new QMakeParser); // make may cause qmake to be run, add last to make sure // it has a low priority. - m_scriptTarget = (static_cast<QmakeProject *>(bc->target()->project())->rootProjectNode()->projectType() == ProjectType::ScriptTemplate); + auto rootNode = dynamic_cast<QmakeProFileNode *>(bc->project()->rootProjectNode()); + QTC_ASSERT(rootNode, return false); + m_scriptTarget = rootNode->projectType() == ProjectType::ScriptTemplate; m_unalignedBuildDir = !bc->isBuildDirAtSafeLocation(); // A user doing "make clean" indicates they want a proper rebuild, so make sure to really |