forked from qt-creator/qt-creator
Utils: Make Environment::setEnglishOutput a proper member function
The previous indirection was useful as long as they were overloads for QProcessEnvironment and QStringList, but these are gone now. Change-Id: I5066bd2e72fd06948a5cc7bbac6dda9006db96ed Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -130,11 +130,10 @@ Environment Environment::systemEnvironment()
|
|||||||
return *staticSystemEnvironment();
|
return *staticSystemEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Environment::setupEnglishOutput(Environment *environment)
|
void Environment::setupEnglishOutput()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(environment, return);
|
set("LC_MESSAGES", "en_US.utf8");
|
||||||
environment->set("LC_MESSAGES", "en_US.utf8");
|
set("LANGUAGE", "en_US:en");
|
||||||
environment->set("LANGUAGE", "en_US:en");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath Environment::searchInDirectory(const QStringList &execs, const FilePath &directory,
|
FilePath Environment::searchInDirectory(const QStringList &execs, const FilePath &directory,
|
||||||
|
@@ -45,7 +45,6 @@ public:
|
|||||||
using NameValueDictionary::NameValueDictionary;
|
using NameValueDictionary::NameValueDictionary;
|
||||||
|
|
||||||
static Environment systemEnvironment();
|
static Environment systemEnvironment();
|
||||||
static void setupEnglishOutput(Environment *environment);
|
|
||||||
|
|
||||||
QProcessEnvironment toProcessEnvironment() const;
|
QProcessEnvironment toProcessEnvironment() const;
|
||||||
|
|
||||||
@@ -58,6 +57,8 @@ public:
|
|||||||
void prependOrSetLibrarySearchPath(const QString &value);
|
void prependOrSetLibrarySearchPath(const QString &value);
|
||||||
void prependOrSetLibrarySearchPaths(const QStringList &values);
|
void prependOrSetLibrarySearchPaths(const QStringList &values);
|
||||||
|
|
||||||
|
void setupEnglishOutput();
|
||||||
|
|
||||||
using PathFilter = std::function<bool(const FilePath &)>;
|
using PathFilter = std::function<bool(const FilePath &)>;
|
||||||
FilePath searchInPath(const QString &executable,
|
FilePath searchInPath(const QString &executable,
|
||||||
const FilePaths &additionalDirs = FilePaths(),
|
const FilePaths &additionalDirs = FilePaths(),
|
||||||
|
@@ -52,7 +52,7 @@ static QString runExecutable(const Utils::CommandLine &commandLine,
|
|||||||
|
|
||||||
SynchronousProcess cpp;
|
SynchronousProcess cpp;
|
||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
Environment::setupEnglishOutput(&env);
|
env.setupEnglishOutput();
|
||||||
cpp.setEnvironment(env);
|
cpp.setEnvironment(env);
|
||||||
cpp.setCommand(commandLine);
|
cpp.setCommand(commandLine);
|
||||||
|
|
||||||
|
@@ -192,7 +192,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
|||||||
|
|
||||||
setEnvironmentModifier([](Environment &env) {
|
setEnvironmentModifier([](Environment &env) {
|
||||||
const QString ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
const QString ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
||||||
Environment::setupEnglishOutput(&env);
|
env.setupEnglishOutput();
|
||||||
if (!env.expandedValueForKey("NINJA_STATUS").startsWith(ninjaProgressString))
|
if (!env.expandedValueForKey("NINJA_STATUS").startsWith(ninjaProgressString))
|
||||||
env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] ");
|
env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] ");
|
||||||
});
|
});
|
||||||
|
@@ -202,7 +202,7 @@ static FilePath qmakeFromCMakeCache(const CMakeConfig &config)
|
|||||||
cmake.setTimeoutS(5);
|
cmake.setTimeoutS(5);
|
||||||
cmake.setDisableUnixTerminal();
|
cmake.setDisableUnixTerminal();
|
||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
Environment::setupEnglishOutput(&env);
|
env.setupEnglishOutput();
|
||||||
cmake.setEnvironment(env);
|
cmake.setEnvironment(env);
|
||||||
cmake.setTimeOutMessageBoxEnabled(false);
|
cmake.setTimeOutMessageBoxEnabled(false);
|
||||||
|
|
||||||
|
@@ -197,7 +197,7 @@ void CMakeTool::runCMake(SynchronousProcess &cmake, const QStringList &args, int
|
|||||||
cmake.setTimeoutS(timeoutS);
|
cmake.setTimeoutS(timeoutS);
|
||||||
cmake.setDisableUnixTerminal();
|
cmake.setDisableUnixTerminal();
|
||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
Environment::setupEnglishOutput(&env);
|
env.setupEnglishOutput();
|
||||||
cmake.setEnvironment(env);
|
cmake.setEnvironment(env);
|
||||||
cmake.setTimeOutMessageBoxEnabled(false);
|
cmake.setTimeOutMessageBoxEnabled(false);
|
||||||
cmake.setCommand({cmakeExecutable(), args});
|
cmake.setCommand({cmakeExecutable(), args});
|
||||||
|
@@ -84,7 +84,7 @@ static bool runPatchHelper(const QByteArray &input, const QString &workingDirect
|
|||||||
if (!workingDirectory.isEmpty())
|
if (!workingDirectory.isEmpty())
|
||||||
patchProcess.setWorkingDirectory(workingDirectory);
|
patchProcess.setWorkingDirectory(workingDirectory);
|
||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
Environment::setupEnglishOutput(&env);
|
env.setupEnglishOutput();
|
||||||
patchProcess.setEnvironment(env);
|
patchProcess.setEnvironment(env);
|
||||||
QStringList args;
|
QStringList args;
|
||||||
// Add argument 'apply' when git is used as patch command since git 2.5/Windows
|
// Add argument 'apply' when git is used as patch command since git 2.5/Windows
|
||||||
|
@@ -4976,7 +4976,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
|
|||||||
|
|
||||||
SynchronousProcess proc;
|
SynchronousProcess proc;
|
||||||
Environment envLang(QProcess::systemEnvironment());
|
Environment envLang(QProcess::systemEnvironment());
|
||||||
Environment::setupEnglishOutput(&envLang);
|
envLang.setupEnglishOutput();
|
||||||
proc.setEnvironment(envLang);
|
proc.setEnvironment(envLang);
|
||||||
proc.setCommand({debugger.executable, args});
|
proc.setCommand({debugger.executable, args});
|
||||||
proc.runBlocking();
|
proc.runBlocking();
|
||||||
|
@@ -153,7 +153,7 @@ void AbstractProcessStep::setEnvironmentModifier(const std::function<void (Envir
|
|||||||
|
|
||||||
void AbstractProcessStep::setUseEnglishOutput()
|
void AbstractProcessStep::setUseEnglishOutput()
|
||||||
{
|
{
|
||||||
d->m_environmentModifier = [](Environment &env) { Environment::setupEnglishOutput(&env); };
|
d->m_environmentModifier = [](Environment &env) { env.setupEnglishOutput(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractProcessStep::setCommandLineProvider(const std::function<CommandLine()> &provider)
|
void AbstractProcessStep::setCommandLineProvider(const std::function<CommandLine()> &provider)
|
||||||
|
@@ -83,7 +83,7 @@ static QByteArray runGcc(const FilePath &gcc, const QStringList &arguments, cons
|
|||||||
|
|
||||||
SynchronousProcess cpp;
|
SynchronousProcess cpp;
|
||||||
Environment environment(env);
|
Environment environment(env);
|
||||||
Environment::setupEnglishOutput(&environment);
|
environment.setupEnglishOutput();
|
||||||
|
|
||||||
cpp.setEnvironment(environment);
|
cpp.setEnvironment(environment);
|
||||||
cpp.setTimeoutS(10);
|
cpp.setTimeoutS(10);
|
||||||
|
@@ -273,7 +273,7 @@ bool MakeStep::userArgsContainsJobCount() const
|
|||||||
Environment MakeStep::makeEnvironment() const
|
Environment MakeStep::makeEnvironment() const
|
||||||
{
|
{
|
||||||
Environment env = buildEnvironment();
|
Environment env = buildEnvironment();
|
||||||
Utils::Environment::setupEnglishOutput(&env);
|
env.setupEnglishOutput();
|
||||||
if (makeCommand().isEmpty()) {
|
if (makeCommand().isEmpty()) {
|
||||||
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
||||||
const QList<ToolChain *> tcs = preferredToolChains(target()->kit());
|
const QList<ToolChain *> tcs = preferredToolChains(target()->kit());
|
||||||
|
Reference in New Issue
Block a user