aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2014-11-25 16:30:58 +0100
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2014-12-01 12:15:45 +0100
commitce91f562feb9b6f45ba8bd5b3fe29e875be7f67f (patch)
tree71e45d17b0436cef84c580debe5a9f6eb22d0ee9
parente39f2d8395997a19880a743bd89706db466b18f4 (diff)
Sort inputs and outputs before setting up the respective JS lists.v1.3.3
If we don't do that, the order of inputs/outputs is random. Why is this bad? Consider a linker rule. Depending on the phase of the moon, the command line can look like this: ld -o myApp obj1.o obj2.o Or like this: ld -o myApp obj2.o obj1.o As a result, change tracking will yield false positives. This is very likely the reason for seemingly inexplicable re-linking steps observed in the past. Change-Id: Iec9d340579dbd680eca07e228bf42339d6e7d277 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r--src/lib/corelib/buildgraph/transformer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/corelib/buildgraph/transformer.cpp b/src/lib/corelib/buildgraph/transformer.cpp
index 6053115de..26161c754 100644
--- a/src/lib/corelib/buildgraph/transformer.cpp
+++ b/src/lib/corelib/buildgraph/transformer.cpp
@@ -43,6 +43,8 @@
#include <QDir>
+#include <algorithm>
+
namespace qbs {
namespace Internal {
@@ -110,6 +112,11 @@ QScriptValue Transformer::translateFileConfig(QScriptEngine *scriptEngine, Artif
return obj;
}
+static bool compareByFilePath(const Artifact *a1, const Artifact *a2)
+{
+ return a1->filePath() < a2->filePath();
+}
+
QScriptValue Transformer::translateInOutputs(QScriptEngine *scriptEngine, const ArtifactSet &artifacts, const QString &defaultModuleName)
{
typedef QMap<QString, QList<Artifact*> > TagArtifactsMap;
@@ -117,6 +124,8 @@ QScriptValue Transformer::translateInOutputs(QScriptEngine *scriptEngine, const
foreach (Artifact *artifact, artifacts)
foreach (const FileTag &fileTag, artifact->fileTags())
tagArtifactsMap[fileTag.toString()].append(artifact);
+ for (TagArtifactsMap::Iterator it = tagArtifactsMap.begin(); it != tagArtifactsMap.end(); ++it)
+ std::sort(it.value().begin(), it.value().end(), compareByFilePath);
QScriptValue jsTagFiles = scriptEngine->newObject();
for (TagArtifactsMap::const_iterator tag = tagArtifactsMap.constBegin(); tag != tagArtifactsMap.constEnd(); ++tag) {