diff options
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 16 | ||||
-rw-r--r-- | src/qml/qml.pro | 13 |
2 files changed, 19 insertions, 10 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 32e8ee4da2..6702966d11 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -731,8 +731,6 @@ void ResolvedTypeReference::doDynamicTypeCheck() isFullyDynamicType = qtTypeInherits<QQmlPropertyMap>(mo); } -#if defined(QT_BUILD_INTERNAL) - static QByteArray ownLibraryChecksum() { static QByteArray libraryChecksum; @@ -740,7 +738,10 @@ static QByteArray ownLibraryChecksum() if (checksumInitialized) return libraryChecksum; checksumInitialized = true; -#if !defined(QT_NO_DYNAMIC_CAST) && QT_CONFIG(dlopen) +#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_DYNAMIC_CAST) && QT_CONFIG(dlopen) + // This is a bit of a hack to make development easier. When hacking on the code generator + // the cache files may end up being re-used. To avoid that we also add the checksum of + // the QtQml library. Dl_info libInfo; if (dladdr(reinterpret_cast<const void *>(&ownLibraryChecksum), &libInfo) != 0) { QFile library(QFile::decodeName(libInfo.dli_fname)); @@ -750,14 +751,14 @@ static QByteArray ownLibraryChecksum() libraryChecksum = hash.result(); } } +#elif defined(QML_COMPILE_HASH) + libraryChecksum = QByteArray(QT_STRINGIFY(QML_COMPILE_HASH)); #else // Not implemented. #endif return libraryChecksum; } -#endif - bool ResolvedTypeReferenceMap::addToHash(QCryptographicHash *hash, QQmlEngine *engine) const { for (auto it = constBegin(), end = constEnd(); it != end; ++it) { @@ -765,12 +766,7 @@ bool ResolvedTypeReferenceMap::addToHash(QCryptographicHash *hash, QQmlEngine *e return false; } - // This is a bit of a hack to make development easier. When hacking on the code generator - // the cache files may end up being re-used. To avoid that we also add the checksum of - // the QtQml library. -#if defined(QT_BUILD_INTERNAL) hash->addData(ownLibraryChecksum()); -#endif return true; } diff --git a/src/qml/qml.pro b/src/qml/qml.pro index be3956bb61..e9d7dcbd2d 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -16,6 +16,19 @@ gcc:isEqual(QT_ARCH, "mips"): QMAKE_CXXFLAGS += -fno-reorder-blocks DEFINES += QT_NO_FOREACH +tagFile=$$PWD/../../.tag +tag= +exists($$tagFile) { + tag=$$cat($$tagFile, singleline) + QMAKE_INTERNAL_INCLUDED_FILES += $$tagFile +} +!equals(tag, "$${LITERAL_DOLLAR}Format:%H$${LITERAL_DOLLAR}") { + DEFINES += QML_COMPILE_HASH="$$tag" +} else:exists($$PWD/../../.git) { + commit=$$system(git describe --tags --always --long --dirty) + DEFINES += QML_COMPILE_HASH="$$commit" +} + exists("qqml_enable_gcov") { QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors LIBS_PRIVATE += -lgcov |