QmakeProjectManager: Code cosmetics

Namespaces...

Change-Id: I8014c932895ebaea78319b22d2693de16f270fc4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-04-23 04:54:46 +02:00
parent eef041a1a8
commit a916c0a235
2 changed files with 30 additions and 26 deletions

View File

@@ -50,10 +50,11 @@
#include <QFileInfo> #include <QFileInfo>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QmakeProjectManager; using namespace Utils;
using namespace QmakeProjectManager::Internal;
QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl, Utils::Id id) namespace QmakeProjectManager {
QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl, Id id)
: MakeStep(bsl, id) : MakeStep(bsl, id)
{ {
if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) { if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
@@ -71,8 +72,8 @@ bool QmakeMakeStep::init()
const auto bc = static_cast<QmakeBuildConfiguration *>(buildConfiguration()); const auto bc = static_cast<QmakeBuildConfiguration *>(buildConfiguration());
const Utils::CommandLine unmodifiedMake = effectiveMakeCommand(Execution); const CommandLine unmodifiedMake = effectiveMakeCommand(Execution);
const Utils::FilePath makeExecutable = unmodifiedMake.executable(); const FilePath makeExecutable = unmodifiedMake.executable();
if (makeExecutable.isEmpty()) if (makeExecutable.isEmpty())
emit addTask(makeCommandMissingTask()); emit addTask(makeCommandMissingTask());
@@ -87,14 +88,14 @@ bool QmakeMakeStep::init()
ProcessParameters *pp = processParameters(); ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander()); pp->setMacroExpander(bc->macroExpander());
Utils::FilePath workingDirectory; FilePath workingDirectory;
if (bc->subNodeBuild()) if (bc->subNodeBuild())
workingDirectory = bc->qmakeBuildSystem()->buildDir(bc->subNodeBuild()->filePath()); workingDirectory = bc->qmakeBuildSystem()->buildDir(bc->subNodeBuild()->filePath());
else else
workingDirectory = bc->buildDirectory(); workingDirectory = bc->buildDirectory();
pp->setWorkingDirectory(workingDirectory); pp->setWorkingDirectory(workingDirectory);
Utils::CommandLine makeCmd(makeExecutable); CommandLine makeCmd(makeExecutable);
QmakeProjectManager::QmakeProFileNode *subProFile = bc->subNodeBuild(); QmakeProjectManager::QmakeProFileNode *subProFile = bc->subNodeBuild();
if (subProFile) { if (subProFile) {
@@ -125,7 +126,7 @@ bool QmakeMakeStep::init()
} }
} }
makeCmd.addArgs(unmodifiedMake.arguments(), Utils::CommandLine::Raw); makeCmd.addArgs(unmodifiedMake.arguments(), CommandLine::Raw);
if (bc->fileNodeBuild() && subProFile) { if (bc->fileNodeBuild() && subProFile) {
QString objectsDir = subProFile->objectsDirectory(); QString objectsDir = subProFile->objectsDirectory();
@@ -140,8 +141,8 @@ bool QmakeMakeStep::init()
} }
if (subProFile->isObjectParallelToSource()) { if (subProFile->isObjectParallelToSource()) {
const Utils::FilePath sourceFileDir = bc->fileNodeBuild()->filePath().parentDir(); const FilePath sourceFileDir = bc->fileNodeBuild()->filePath().parentDir();
const Utils::FilePath proFileDir = subProFile->proFile()->sourceDir().canonicalPath(); const FilePath proFileDir = subProFile->proFile()->sourceDir().canonicalPath();
if (!objectsDir.endsWith('/')) if (!objectsDir.endsWith('/'))
objectsDir += QLatin1Char('/'); objectsDir += QLatin1Char('/');
objectsDir += sourceFileDir.relativeChildPath(proFileDir).toString(); objectsDir += sourceFileDir.relativeChildPath(proFileDir).toString();
@@ -179,22 +180,22 @@ bool QmakeMakeStep::init()
return true; return true;
} }
void QmakeMakeStep::setupOutputFormatter(Utils::OutputFormatter *formatter) void QmakeMakeStep::setupOutputFormatter(OutputFormatter *formatter)
{ {
formatter->addLineParser(new ProjectExplorer::GnuMakeParser()); formatter->addLineParser(new GnuMakeParser());
ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit()); ToolChain *tc = ToolChainKitAspect::cxxToolChain(kit());
OutputTaskParser *xcodeBuildParser = nullptr; OutputTaskParser *xcodeBuildParser = nullptr;
if (tc && tc->targetAbi().os() == Abi::DarwinOS) { if (tc && tc->targetAbi().os() == Abi::DarwinOS) {
xcodeBuildParser = new XcodebuildParser; xcodeBuildParser = new XcodebuildParser;
formatter->addLineParser(xcodeBuildParser); formatter->addLineParser(xcodeBuildParser);
} }
QList<Utils::OutputLineParser *> additionalParsers = kit()->createOutputParsers(); QList<OutputLineParser *> additionalParsers = kit()->createOutputParsers();
// make may cause qmake to be run, add last to make sure it has a low priority. // make may cause qmake to be run, add last to make sure it has a low priority.
additionalParsers << new QMakeParser; additionalParsers << new QMakeParser;
if (xcodeBuildParser) { if (xcodeBuildParser) {
for (Utils::OutputLineParser * const p : qAsConst(additionalParsers)) for (OutputLineParser * const p : qAsConst(additionalParsers))
p->setRedirectionDetector(xcodeBuildParser); p->setRedirectionDetector(xcodeBuildParser);
} }
formatter->addLineParsers(additionalParsers); formatter->addLineParsers(additionalParsers);
@@ -224,7 +225,7 @@ void QmakeMakeStep::doRun()
void QmakeMakeStep::finish(bool success) void QmakeMakeStep::finish(bool success)
{ {
if (!success && !isCanceled() && m_unalignedBuildDir if (!success && !isCanceled() && m_unalignedBuildDir
&& QmakeSettings::warnAgainstUnalignedBuildDir()) { && Internal::QmakeSettings::warnAgainstUnalignedBuildDir()) {
const QString msg = tr("The build directory is not at the same level as the source " const QString msg = tr("The build directory is not at the same level as the source "
"directory, which could be the reason for the build failure."); "directory, which could be the reason for the build failure.");
emit addTask(BuildSystemTask(Task::Warning, msg)); emit addTask(BuildSystemTask(Task::Warning, msg));
@@ -240,6 +241,8 @@ QStringList QmakeMakeStep::displayArguments() const
return {}; return {};
} }
namespace Internal {
/// ///
// QmakeMakeStepFactory // QmakeMakeStepFactory
/// ///
@@ -250,3 +253,6 @@ QmakeMakeStepFactory::QmakeMakeStepFactory()
setSupportedProjectType(Constants::QMAKEPROJECT_ID); setSupportedProjectType(Constants::QMAKEPROJECT_ID);
setDisplayName(MakeStep::defaultDisplayName()); setDisplayName(MakeStep::defaultDisplayName());
} }
} // Internal
} // QmakeProjectManager

View File

@@ -30,17 +30,6 @@
#include <projectexplorer/makestep.h> #include <projectexplorer/makestep.h>
namespace QmakeProjectManager { namespace QmakeProjectManager {
namespace Internal {
class QmakeMakeStepFactory : public ProjectExplorer::BuildStepFactory
{
public:
QmakeMakeStepFactory();
};
} //namespace Internal
class QmakeProject;
class QMAKEPROJECTMANAGER_EXPORT QmakeMakeStep : public ProjectExplorer::MakeStep class QMAKEPROJECTMANAGER_EXPORT QmakeMakeStep : public ProjectExplorer::MakeStep
{ {
@@ -62,4 +51,13 @@ private:
bool m_ignoredNonTopLevelBuild = false; bool m_ignoredNonTopLevelBuild = false;
}; };
namespace Internal {
class QmakeMakeStepFactory : public ProjectExplorer::BuildStepFactory
{
public:
QmakeMakeStepFactory();
};
} // Internal
} // QmakeProjectManager } // QmakeProjectManager