aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2018-10-19 16:21:33 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-10-23 07:45:50 +0000
commit25298d800a25848fe15800e365c8987e9d949642 (patch)
treede26a1f6f1e26ffa8f04c79d3c51ebb9ade28343 /sources
parent1719517834d953abb4e37be4c824854dee9795ac (diff)
Sort writing of type indices when generating module header file
Due to some unknown determinism, sometimes the type indices written to the generated module header file have a slightly different order, which means that many cpp files need to be rebuilt for no reason (semantically the content of the header file does not change). Make sure to sort the class list by type indices, to try and make the generated header file as deterministic as possible. This is a pre-requisite for improved incremental builds. Change-Id: Ie6a334453cdbfbb601fbac4b6be9291a746650f4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index 9bb5fafde..8881d71f4 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -32,6 +32,8 @@
#include <reporthandler.h>
#include <fileout.h>
+#include <algorithm>
+
#include <QtCore/QDir>
#include <QtCore/QTextStream>
#include <QtCore/QVariant>
@@ -378,7 +380,12 @@ bool HeaderGenerator::finishGeneration()
macrosStream << "// Type indices\nenum : int {\n";
AbstractMetaEnumList globalEnums = this->globalEnums();
- const AbstractMetaClassList &classList = classes();
+ AbstractMetaClassList classList = classes();
+
+ std::sort(classList.begin(), classList.end(), [](AbstractMetaClass *a, AbstractMetaClass* b) {
+ return a->typeEntry()->sbkIndex() < b->typeEntry()->sbkIndex();
+ });
+
for (const AbstractMetaClass *metaClass : classList) {
writeTypeIndexValueLines(macrosStream, metaClass);
lookForEnumsInClassesNotToBeGenerated(globalEnums, metaClass);