summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2019-08-22 10:52:52 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2019-08-22 18:15:08 +0200
commitf65cfadd041078b80389c178d4f8be055163bdae (patch)
tree3555cbdb28ca0f9d941a0becbca2be6635d86bcf /qmake
parent181e5382e741c290d72010da9d6d74908e7b2d8f (diff)
Improve readability of commands in VS project files
The commands are separated by "if errorlevel 1 goto VCEnd" lines to make sure we abort on the first failure. However, we also insert magic comments starting with "Rem" for IncrediBuild. These do not need error checking. Also, the last command does not need error checking. The XML line ending entities are also unneeded. By using proper line endings we ensure that commands appear on separate lines in Visual Studio's property editor. Change-Id: Ifbf7525281e892c820034fafc64b555fff3dc756 Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 3116238aa0..0515c7404f 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -300,14 +300,17 @@ inline XmlOutput::xml_output valueTagT( const triState v)
return valueTag(v == _True ? "true" : "false");
}
-static QString vcxCommandSeparator()
+static QString commandLinesForOutput(QStringList commands)
{
// MSBuild puts the contents of the custom commands into a batch file and calls it.
// As we want every sub-command to be error-checked (as is done by makefile-based
// backends), we insert the checks ourselves, using the undocumented jump target.
- static QString cmdSep =
- QLatin1String("&#x000D;&#x000A;if errorlevel 1 goto VCEnd&#x000D;&#x000A;");
- return cmdSep;
+ static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd");
+ for (int i = commands.count() - 2; i >= 0; --i) {
+ if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
+ commands.insert(i + 1, errchk);
+ }
+ return commands.join('\n');
}
static QString unquote(const QString &value)
@@ -1658,7 +1661,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool)
{
xml << tag("Command")
<< attrTag("Condition", condition)
- << valueTag(tool.CommandLine.join(vcxCommandSeparator()));
+ << valueTag(commandLinesForOutput(tool.CommandLine));
}
if ( !tool.Description.isEmpty() )
@@ -1712,7 +1715,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool)
{
xml
<< tag(tool.EventName)
- << tag(_Command) << valueTag(tool.CommandLine.join(vcxCommandSeparator()))
+ << tag(_Command) << valueTag(commandLinesForOutput(tool.CommandLine))
<< tag(_Message) << valueTag(tool.Description)
<< closetag(tool.EventName);
}