diff options
| author | Christian Kandeler <christian.kandeler@digia.com> | 2013-11-05 16:40:40 +0100 |
|---|---|---|
| committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-11-06 12:33:16 +0100 |
| commit | 5778df9ad083767585d7b6154db7b34c3454664b (patch) | |
| tree | a51a94185781203326144ea28b48c08489045df2 /src/lib/buildgraph | |
| parent | 7068aa68e09265fbd7d9c5c31b187b927b011188 (diff) | |
| download | qbs-5778df9ad083767585d7b6154db7b34c3454664b.tar.gz | |
Fix meaning of "Command.silent".
The new, saner meaning is: If this property is set to true, then qbs
will not print the status message (containing the command description).
Accordingly, the default is changed to false. Also, there is now a
check that prints a warning if a non-silent command has an empty
description.
Change-Id: I5a8fd4e2f8901f6e2858946901e8081a6929d43f
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/buildgraph')
| -rw-r--r-- | src/lib/buildgraph/abstractcommandexecutor.cpp | 12 | ||||
| -rw-r--r-- | src/lib/buildgraph/command.cpp | 6 | ||||
| -rw-r--r-- | src/lib/buildgraph/command.h | 4 | ||||
| -rw-r--r-- | src/lib/buildgraph/processcommandexecutor.cpp | 2 |
4 files changed, 17 insertions, 7 deletions
diff --git a/src/lib/buildgraph/abstractcommandexecutor.cpp b/src/lib/buildgraph/abstractcommandexecutor.cpp index 912a3a49d..022e71929 100644 --- a/src/lib/buildgraph/abstractcommandexecutor.cpp +++ b/src/lib/buildgraph/abstractcommandexecutor.cpp @@ -31,6 +31,9 @@ #include "command.h" +#include <logging/translator.h> +#include <tools/error.h> + namespace qbs { namespace Internal { @@ -48,7 +51,14 @@ void AbstractCommandExecutor::start(Transformer *transformer, const AbstractComm { m_transformer = transformer; m_command = cmd; - emit reportCommandDescription(m_command->highlight(), m_command->description()); + if (!m_command->isSilent()) { + if (m_command->description().isEmpty()) { + m_logger.printWarning(ErrorInfo(Tr::tr("Command is not marked silent, but has no " + "description."), m_command->codeLocation())); + } else { + emit reportCommandDescription(m_command->highlight(), m_command->description()); + } + } doStart(); } diff --git a/src/lib/buildgraph/command.cpp b/src/lib/buildgraph/command.cpp index 456ca0d7c..095e5d9a3 100644 --- a/src/lib/buildgraph/command.cpp +++ b/src/lib/buildgraph/command.cpp @@ -70,20 +70,20 @@ bool AbstractCommand::equals(const AbstractCommand *other) const void AbstractCommand::fillFromScriptValue(const QScriptValue *scriptValue, const CodeLocation &codeLocation) { - Q_UNUSED(codeLocation); m_description = scriptValue->property("description").toString(); m_highlight = scriptValue->property("highlight").toString(); m_silent = scriptValue->property("silent").toBool(); + m_codeLocation = codeLocation; } void AbstractCommand::load(QDataStream &s) { - s >> m_description >> m_highlight >> m_silent; + s >> m_description >> m_highlight >> m_silent >> m_codeLocation; } void AbstractCommand::store(QDataStream &s) { - s << m_description << m_highlight << m_silent; + s << m_description << m_highlight << m_silent << m_codeLocation; } static QScriptValue js_CommandBase(QScriptContext *context, QScriptEngine *engine) diff --git a/src/lib/buildgraph/command.h b/src/lib/buildgraph/command.h index 40ec2e768..39546cf05 100644 --- a/src/lib/buildgraph/command.h +++ b/src/lib/buildgraph/command.h @@ -53,7 +53,7 @@ public: static AbstractCommand *createByType(CommandType commandType); static QString defaultDescription() { return QString(); } static QString defaultHighLight() { return QString(); } - static bool defaultIsSilent() { return true; } + static bool defaultIsSilent() { return false; } virtual CommandType type() const = 0; virtual bool equals(const AbstractCommand *other) const; @@ -64,6 +64,7 @@ public: const QString description() const { return m_description; } const QString highlight() const { return m_highlight; } bool isSilent() const { return m_silent; } + CodeLocation codeLocation() const { return m_codeLocation; } protected: AbstractCommand(); @@ -72,6 +73,7 @@ private: QString m_description; QString m_highlight; bool m_silent; + CodeLocation m_codeLocation; }; class ProcessCommand : public AbstractCommand diff --git a/src/lib/buildgraph/processcommandexecutor.cpp b/src/lib/buildgraph/processcommandexecutor.cpp index 111ba4b64..fdb3f61f0 100644 --- a/src/lib/buildgraph/processcommandexecutor.cpp +++ b/src/lib/buildgraph/processcommandexecutor.cpp @@ -110,8 +110,6 @@ void ProcessCommandExecutor::doStart() QStringList arguments = cmd->arguments(); QString argString = commandArgsToString(arguments); - if (!cmd->isSilent()) - logger().qbsInfo() << program << argString; if (dryRun()) { QTimer::singleShot(0, this, SIGNAL(finished())); // Don't call back on the caller. return; |
