diff options
Diffstat (limited to 'src/plugins/qmakeprojectmanager/qmakemakestep.cpp')
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakemakestep.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp index 83809bc77a..7d003a157f 100644 --- a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp @@ -52,7 +52,7 @@ using namespace ProjectExplorer; using namespace QmakeProjectManager; using namespace QmakeProjectManager::Internal; -QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl, Core::Id id) +QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl, Utils::Id id) : MakeStep(bsl, id) { if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) { @@ -65,8 +65,6 @@ QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl, Core::Id id) bool QmakeMakeStep::init() { const auto bc = static_cast<QmakeBuildConfiguration *>(buildConfiguration()); - if (!bc) - emit addTask(Task::buildConfigurationMissingTask()); const Utils::CommandLine unmodifiedMake = effectiveMakeCommand(Execution); const Utils::FilePath makeExecutable = unmodifiedMake.executable(); @@ -86,7 +84,7 @@ bool QmakeMakeStep::init() Utils::FilePath workingDirectory; if (bc->subNodeBuild()) - workingDirectory = bc->subNodeBuild()->buildDir(bc); + workingDirectory = bc->qmakeBuildSystem()->buildDir(bc->subNodeBuild()->filePath()); else workingDirectory = bc->buildDirectory(); pp->setWorkingDirectory(workingDirectory); @@ -107,7 +105,7 @@ bool QmakeMakeStep::init() // for file builds, since the rules for that are // only in those files. if (subProFile->isDebugAndRelease() && bc->fileNodeBuild()) { - if (bc->buildType() == QmakeBuildConfiguration::Debug) + if (buildType() == QmakeBuildConfiguration::Debug) makefile += ".Debug"; else makefile += ".Release"; @@ -132,7 +130,7 @@ bool QmakeMakeStep::init() if (bc->fileNodeBuild() && subProFile) { QString objectsDir = subProFile->objectsDirectory(); if (objectsDir.isEmpty()) { - objectsDir = subProFile->buildDir(bc).toString(); + objectsDir = bc->qmakeBuildSystem()->buildDir(subProFile->filePath()).toString(); if (subProFile->isDebugAndRelease()) { if (bc->buildType() == QmakeBuildConfiguration::Debug) objectsDir += "/debug"; @@ -162,23 +160,11 @@ bool QmakeMakeStep::init() makeCmd.addArg(objectFile); } - pp->setEnvironment(environment(bc)); + pp->setEnvironment(makeEnvironment()); pp->setCommandLine(makeCmd); pp->resolveAll(); - setOutputParser(new ProjectExplorer::GnuMakeParser()); - ToolChain *tc = ToolChainKitAspect::toolChain(target()->kit(), - ProjectExplorer::Constants::CXX_LANGUAGE_ID); - if (tc && tc->targetAbi().os() == Abi::DarwinOS) - appendOutputParser(new XcodebuildParser); - IOutputParser *parser = target()->kit()->createOutputParser(); - if (parser) - appendOutputParser(parser); - outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory()); - appendOutputParser(new QMakeParser); // make may cause qmake to be run, add last to make sure - // it has a low priority. - - auto rootNode = dynamic_cast<QmakeProFileNode *>(bc->project()->rootProjectNode()); + auto rootNode = dynamic_cast<QmakeProFileNode *>(project()->rootProjectNode()); QTC_ASSERT(rootNode, return false); m_scriptTarget = rootNode->projectType() == ProjectType::ScriptTemplate; m_unalignedBuildDir = !bc->isBuildDirAtSafeLocation(); @@ -194,6 +180,30 @@ bool QmakeMakeStep::init() return AbstractProcessStep::init(); } +void QmakeMakeStep::setupOutputFormatter(Utils::OutputFormatter *formatter) +{ + formatter->addLineParser(new ProjectExplorer::GnuMakeParser()); + ToolChain *tc = ToolChainKitAspect::cxxToolChain(target()->kit()); + OutputTaskParser *xcodeBuildParser = nullptr; + if (tc && tc->targetAbi().os() == Abi::DarwinOS) { + xcodeBuildParser = new XcodebuildParser; + formatter->addLineParser(xcodeBuildParser); + } + QList<Utils::OutputLineParser *> additionalParsers = target()->kit()->createOutputParsers(); + + // make may cause qmake to be run, add last to make sure it has a low priority. + additionalParsers << new QMakeParser; + + if (xcodeBuildParser) { + for (Utils::OutputLineParser * const p : qAsConst(additionalParsers)) + p->setRedirectionDetector(xcodeBuildParser); + } + formatter->addLineParsers(additionalParsers); + formatter->addSearchDir(processParameters()->effectiveWorkingDirectory()); + + AbstractProcessStep::setupOutputFormatter(formatter); +} + void QmakeMakeStep::doRun() { if (m_scriptTarget || m_ignoredNonTopLevelBuild) { |