ProcessParameter: Ensure macro expansion is done in the main thread

The macro expanders are not thread safe. Also the values should be
expanded in init() as later changes to e.g. the buildconfiguration
should not affect the build anymore.

Change-Id: I82f5cd229d82cdb9f897c1db69c47b028cca29d1
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Daniel Teske
2012-11-28 15:29:55 +01:00
parent 2b2f41db4f
commit 2f862681d7
11 changed files with 18 additions and 0 deletions

View File

@@ -161,6 +161,7 @@ bool AutogenStep::init()
pp->setWorkingDirectory(bc->buildDirectory()); pp->setWorkingDirectory(bc->buildDirectory());
pp->setCommand(QLatin1String("autogen.sh")); pp->setCommand(QLatin1String("autogen.sh"));
pp->setArguments(additionalArguments()); pp->setArguments(additionalArguments());
pp->resolveAll();
return AbstractProcessStep::init(); return AbstractProcessStep::init();
} }

View File

@@ -160,6 +160,7 @@ bool AutoreconfStep::init()
pp->setWorkingDirectory(bc->buildDirectory()); pp->setWorkingDirectory(bc->buildDirectory());
pp->setCommand(QLatin1String("autoreconf")); pp->setCommand(QLatin1String("autoreconf"));
pp->setArguments(additionalArguments()); pp->setArguments(additionalArguments());
pp->resolveAll();
return AbstractProcessStep::init(); return AbstractProcessStep::init();
} }

View File

@@ -161,6 +161,7 @@ bool ConfigureStep::init()
pp->setWorkingDirectory(bc->buildDirectory()); pp->setWorkingDirectory(bc->buildDirectory());
pp->setCommand(QLatin1String("configure")); pp->setCommand(QLatin1String("configure"));
pp->setArguments(additionalArguments()); pp->setArguments(additionalArguments());
pp->resolveAll();
return AbstractProcessStep::init(); return AbstractProcessStep::init();
} }

View File

@@ -189,6 +189,7 @@ bool MakeStep::init()
pp->setWorkingDirectory(bc->buildDirectory()); pp->setWorkingDirectory(bc->buildDirectory());
pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make")); pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make"));
pp->setArguments(arguments); pp->setArguments(arguments);
pp->resolveAll();
setOutputParser(new GnuMakeParser()); setOutputParser(new GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser(); IOutputParser *parser = target()->kit()->createOutputParser();

View File

@@ -198,6 +198,7 @@ bool MakeStep::init()
pp->setWorkingDirectory(bc->buildDirectory()); pp->setWorkingDirectory(bc->buildDirectory());
pp->setCommand(makeCommand(tc, bc->environment())); pp->setCommand(makeCommand(tc, bc->environment()));
pp->setArguments(arguments); pp->setArguments(arguments);
pp->resolveAll();
setOutputParser(new ProjectExplorer::GnuMakeParser()); setOutputParser(new ProjectExplorer::GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser(); IOutputParser *parser = target()->kit()->createOutputParser();

View File

@@ -121,6 +121,7 @@ bool GenericMakeStep::init()
pp->setEnvironment(env); pp->setEnvironment(env);
pp->setCommand(makeCommand(bc->environment())); pp->setCommand(makeCommand(bc->environment()));
pp->setArguments(allArguments()); pp->setArguments(allArguments());
pp->resolveAll();
// If we are cleaning, then make can fail with an error code, but that doesn't mean // If we are cleaning, then make can fail with an error code, but that doesn't mean
// we should stop the clean queue // we should stop the clean queue

View File

@@ -198,3 +198,10 @@ QString ProcessParameters::summaryInWorkdir(const QString &displayName) const
prettyArguments(), prettyArguments(),
QDir::toNativeSeparators(effectiveWorkingDirectory())); QDir::toNativeSeparators(effectiveWorkingDirectory()));
} }
void ProcessParameters::resolveAll()
{
effectiveCommand();
effectiveArguments();
effectiveWorkingDirectory();
}

View File

@@ -76,6 +76,7 @@ public:
QString summary(const QString &displayName) const; QString summary(const QString &displayName) const;
QString summaryInWorkdir(const QString &displayName) const; QString summaryInWorkdir(const QString &displayName) const;
void resolveAll();
private: private:
QString m_workingDirectory; QString m_workingDirectory;
QString m_command; QString m_command;

View File

@@ -97,6 +97,8 @@ bool ProcessStep::init()
pp->setWorkingDirectory(workingDirectory()); pp->setWorkingDirectory(workingDirectory());
pp->setCommand(m_command); pp->setCommand(m_command);
pp->setArguments(m_arguments); pp->setArguments(m_arguments);
pp->resolveAll();
IOutputParser *parser = target()->kit()->createOutputParser(); IOutputParser *parser = target()->kit()->createOutputParser();
if (parser) if (parser)
setOutputParser(parser); setOutputParser(parser);

View File

@@ -242,6 +242,7 @@ bool MakeStep::init()
pp->setEnvironment(env); pp->setEnvironment(env);
pp->setArguments(args); pp->setArguments(args);
pp->resolveAll();
setOutputParser(new ProjectExplorer::GnuMakeParser()); setOutputParser(new ProjectExplorer::GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser(); IOutputParser *parser = target()->kit()->createOutputParser();

View File

@@ -289,6 +289,7 @@ bool QMakeStep::init()
pp->setCommand(program.toString()); pp->setCommand(program.toString());
pp->setArguments(args); pp->setArguments(args);
pp->setEnvironment(qt4bc->environment()); pp->setEnvironment(qt4bc->environment());
pp->resolveAll();
setOutputParser(new QMakeParser); setOutputParser(new QMakeParser);