aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-03-09 14:47:10 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2018-03-12 08:11:46 +0000
commitc6f0044d74fc6cbf6076d1f1c80b179a8067e387 (patch)
tree6a2cc1e73c74810a7d088a67dad87eefa5414628
parentb608f25a930710dc146e9e4ed99104be36de1024 (diff)
Add product name to command descriptions
The pure file name that the description usually contains does not always provide enough context: It's not necessarily clear from a file name which product it belongs to, and some files can be built as part of more than one product. Because we print the full product name, including the multiplexing information if necessary, we also remove the JS code that provided this kind of disambiguation for GCC compiler and linker rules only. [ChangeLog] Command descriptions now also contain the product name. Change-Id: I9702a6cff3faffb086e5c93e02fffa6e65fb1043 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--share/qbs/modules/cpp/gcc.js14
-rw-r--r--src/lib/corelib/buildgraph/abstractcommandexecutor.cpp9
-rw-r--r--src/lib/corelib/buildgraph/abstractcommandexecutor.h2
-rw-r--r--src/lib/corelib/buildgraph/jscommandexecutor.cpp4
-rw-r--r--src/lib/corelib/buildgraph/jscommandexecutor.h2
-rw-r--r--src/lib/corelib/buildgraph/processcommandexecutor.cpp4
-rw-r--r--src/lib/corelib/buildgraph/processcommandexecutor.h2
-rw-r--r--src/lib/corelib/buildgraph/rulecommands.cpp5
-rw-r--r--src/lib/corelib/buildgraph/rulecommands.h1
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp2
10 files changed, 21 insertions, 24 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js
index e5614127d..ce6871c70 100644
--- a/share/qbs/modules/cpp/gcc.js
+++ b/share/qbs/modules/cpp/gcc.js
@@ -959,17 +959,6 @@ function prepareAssembler(project, product, inputs, outputs, input, output) {
return cmd;
}
-function nativeConfigString(product) {
- var props = [];
- if ((product.multiplexed || product.aggregate) && product.multiplexConfigurationId) {
- if (product.qbs.targetOS.containsAny(["android", "darwin"]))
- props.push(product.qbs.architecture);
- if (product.qbs.targetOS.contains("darwin"))
- props.push(product.qbs.buildVariant);
- }
- return props.length > 0 ? (" (" + props.join(", ") + ")") : "";
-}
-
function compilerEnvVars(config, compilerInfo)
{
if (config.qbs.toolchain.contains("qcc"))
@@ -1037,7 +1026,6 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli
cmd.description = (pchOutput ? 'pre' : '') + 'compiling ' + input.fileName;
if (pchOutput)
cmd.description += ' (' + compilerInfo.tag + ')';
- cmd.description += nativeConfigString(product);
cmd.highlight = "compiler";
cmd.relevantEnvironmentVariables = compilerEnvVars(input, compilerInfo);
cmd.responseFileArgumentIndex = wrapperArgsLength;
@@ -1256,7 +1244,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) {
}
cmd = new Command(linkerPath, args);
- cmd.description = 'linking ' + primaryOutput.fileName + nativeConfigString(product);
+ cmd.description = 'linking ' + primaryOutput.fileName;
cmd.highlight = 'linker';
cmd.relevantEnvironmentVariables = linkerEnvVars(product, inputs);
cmd.responseFileArgumentIndex = responseFileArgumentIndex;
diff --git a/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp b/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp
index 3790da9c8..4626c6a1a 100644
--- a/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp
@@ -40,7 +40,9 @@
#include "abstractcommandexecutor.h"
#include "rulecommands.h"
+#include "transformer.h"
+#include <language/language.h>
#include <logging/translator.h>
#include <tools/error.h>
@@ -63,11 +65,11 @@ void AbstractCommandExecutor::start(Transformer *transformer, AbstractCommand *c
m_transformer = transformer;
m_command = cmd;
doSetup();
- doReportCommandDescription();
+ doReportCommandDescription(transformer->product()->fullDisplayName());
doStart();
}
-void AbstractCommandExecutor::doReportCommandDescription()
+void AbstractCommandExecutor::doReportCommandDescription(const QString &productName)
{
if (m_command->isSilent() || m_echoMode == CommandEchoModeSilent)
return;
@@ -77,7 +79,8 @@ void AbstractCommandExecutor::doReportCommandDescription()
ErrorInfo(Tr::tr("Command is not marked silent, but has no description."),
m_command->codeLocation()));
} else {
- emit reportCommandDescription(m_command->highlight(), m_command->description());
+ emit reportCommandDescription(m_command->highlight(),
+ m_command->fullDescription(productName));
}
}
diff --git a/src/lib/corelib/buildgraph/abstractcommandexecutor.h b/src/lib/corelib/buildgraph/abstractcommandexecutor.h
index 94ac15afc..f140b5d82 100644
--- a/src/lib/corelib/buildgraph/abstractcommandexecutor.h
+++ b/src/lib/corelib/buildgraph/abstractcommandexecutor.h
@@ -73,7 +73,7 @@ signals:
void finished(const qbs::ErrorInfo &err = ErrorInfo()); // !hasError() <=> command successful
protected:
- virtual void doReportCommandDescription();
+ virtual void doReportCommandDescription(const QString &productName);
AbstractCommand *command() const { return m_command; }
Transformer *transformer() const { return m_transformer; }
ScriptEngine *scriptEngine() const { return m_mainThreadScriptEngine; }
diff --git a/src/lib/corelib/buildgraph/jscommandexecutor.cpp b/src/lib/corelib/buildgraph/jscommandexecutor.cpp
index 35e80cb68..cbdf70085 100644
--- a/src/lib/corelib/buildgraph/jscommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/jscommandexecutor.cpp
@@ -201,7 +201,7 @@ JsCommandExecutor::~JsCommandExecutor()
m_thread->wait();
}
-void JsCommandExecutor::doReportCommandDescription()
+void JsCommandExecutor::doReportCommandDescription(const QString &productName)
{
if ((m_echoMode == CommandEchoModeCommandLine
|| m_echoMode == CommandEchoModeCommandLineWithEnvironment)
@@ -210,7 +210,7 @@ void JsCommandExecutor::doReportCommandDescription()
return;
}
- AbstractCommandExecutor::doReportCommandDescription();
+ AbstractCommandExecutor::doReportCommandDescription(productName);
}
void JsCommandExecutor::waitForFinished()
diff --git a/src/lib/corelib/buildgraph/jscommandexecutor.h b/src/lib/corelib/buildgraph/jscommandexecutor.h
index f70d54711..ec9d43147 100644
--- a/src/lib/corelib/buildgraph/jscommandexecutor.h
+++ b/src/lib/corelib/buildgraph/jscommandexecutor.h
@@ -64,7 +64,7 @@ signals:
private:
void onJavaScriptCommandFinished();
- void doReportCommandDescription();
+ void doReportCommandDescription(const QString &productName);
void doStart();
void cancel();
diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.cpp b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
index 2442f7a70..cee45bcd0 100644
--- a/src/lib/corelib/buildgraph/processcommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
@@ -372,7 +372,7 @@ static QString environmentVariableString(const QString &key, const QString &valu
return str;
}
-void ProcessCommandExecutor::doReportCommandDescription()
+void ProcessCommandExecutor::doReportCommandDescription(const QString &productName)
{
if (m_echoMode == CommandEchoModeCommandLine ||
m_echoMode == CommandEchoModeCommandLineWithEnvironment) {
@@ -391,7 +391,7 @@ void ProcessCommandExecutor::doReportCommandDescription()
return;
}
- AbstractCommandExecutor::doReportCommandDescription();
+ AbstractCommandExecutor::doReportCommandDescription(productName);
}
void ProcessCommandExecutor::removeResponseFile()
diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.h b/src/lib/corelib/buildgraph/processcommandexecutor.h
index 1e4b18777..bebe3a5e2 100644
--- a/src/lib/corelib/buildgraph/processcommandexecutor.h
+++ b/src/lib/corelib/buildgraph/processcommandexecutor.h
@@ -70,7 +70,7 @@ private:
void onProcessFinished();
void doSetup();
- void doReportCommandDescription();
+ void doReportCommandDescription(const QString &productName);
void doStart();
void cancel();
diff --git a/src/lib/corelib/buildgraph/rulecommands.cpp b/src/lib/corelib/buildgraph/rulecommands.cpp
index d2fab43c9..38adeba5c 100644
--- a/src/lib/corelib/buildgraph/rulecommands.cpp
+++ b/src/lib/corelib/buildgraph/rulecommands.cpp
@@ -124,6 +124,11 @@ void AbstractCommand::fillFromScriptValue(const QScriptValue *scriptValue, const
<< silentProperty();
}
+QString AbstractCommand::fullDescription(const QString &productName) const
+{
+ return description() + QLatin1String(" [") + productName + QLatin1Char(']');
+}
+
void AbstractCommand::load(PersistentPool &pool)
{
serializationOp<PersistentPool::Load>(pool);
diff --git a/src/lib/corelib/buildgraph/rulecommands.h b/src/lib/corelib/buildgraph/rulecommands.h
index 9f7615506..7583de2b6 100644
--- a/src/lib/corelib/buildgraph/rulecommands.h
+++ b/src/lib/corelib/buildgraph/rulecommands.h
@@ -75,6 +75,7 @@ public:
virtual bool equals(const AbstractCommand *other) const;
virtual void fillFromScriptValue(const QScriptValue *scriptValue, const CodeLocation &codeLocation);
+ QString fullDescription(const QString &productName) const;
const QString description() const { return m_description; }
const QString extendedDescription() const { return m_extendedDescription; }
const QString highlight() const { return m_highlight; }
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 2c321a901..bc2d69572 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -3314,7 +3314,7 @@ void TestBlackbox::fileDependencies()
WAIT_FOR_NEW_TIMESTAMP();
touch("awesomelib/magnificent.h");
QCOMPARE(runQbs(), 0);
- QVERIFY(m_qbsStdout.contains("compiling narf.cpp"));
+ QVERIFY2(m_qbsStdout.contains("compiling narf.cpp [myapp]"), m_qbsStdout.constData());
QVERIFY(!m_qbsStdout.contains("compiling zort.cpp"));
}