diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-02-10 12:34:43 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-02-14 13:17:28 +0100 |
commit | fef7aa6f0ff2e79bcca9304a878b07869fe65478 (patch) | |
tree | 55da1518c429cc78269a4109fe9946ea0d44a148 | |
parent | 07d7df054082c39076c386645162592caff6f0c8 (diff) |
CMake: Skip qml compile hash recreation in developer builds
The current implementation favors recreation of the hash whenever
the git tree hash is changed and a cmake reconfiguration is forcibly
done by the developer. This causes a rebuild of the Qml library.
This dependency tracking is too coarse and not very helpful.
A developer that doesn't touch the Qml library sources will be
confused why a commit rebuilds the library.
A developer that does touch the Qml library will be confused why the
qml hash hasn't changed after running ninja, and even more
confused when it is changed after a commit and reconfigure.
To improve the situation a bit, the build system will now not recreate
the hash when doing a developer build and the developer will be
expected to remove the already existing hash file when necessary.
This will not cause issues in our CI developer build configurations
where cache files are not removed.
Even though the cache files are not removed, the qtdeclarative build
directory will be clean, which means the qml hash file will not be
present and will be created with up-to-date content, thus invalidating
all cache files.
Change-Id: I809b2cffbc5bb2b09af4fb712c7e46a743bfd333
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 09aecb0d7762010249ef8f78ef92367b73a4a1e8)
-rw-r--r-- | cmake/QtDeclarativeSetup.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmake/QtDeclarativeSetup.cmake b/cmake/QtDeclarativeSetup.cmake index 479c71d28a..3513fdad0b 100644 --- a/cmake/QtDeclarativeSetup.cmake +++ b/cmake/QtDeclarativeSetup.cmake @@ -3,7 +3,13 @@ # archive with the tree hash. For unreleased versions, we'll ask git # rev-parse. If none of this works, we use CMake to hash all the files # in the src/qml/ directory. +# Skip recreation of the hash when doing a developer build. function(qt_declarative_write_tag_header target_name) + set(out_file "${CMAKE_CURRENT_BINARY_DIR}/qml_compile_hash_p.h") + if(FEATURE_developer_build AND EXISTS "${out_file}") + return() + endif() + set(tag_file "${CMAKE_CURRENT_SOURCE_DIR}/../../.tag") set(tag_contents "") if(EXISTS "${tag_file}") @@ -34,7 +40,7 @@ function(qt_declarative_write_tag_header target_name) string(LENGTH "${QML_COMPILE_HASH}" QML_COMPILE_HASH_LENGTH) if(QML_COMPILE_HASH_LENGTH GREATER 0) - configure_file("qml_compile_hash_p.h.in" "${CMAKE_CURRENT_BINARY_DIR}/qml_compile_hash_p.h") + configure_file("qml_compile_hash_p.h.in" "${out_file}") else() message(FATAL_ERROR "QML compile hash is empty! " "You need either a valid git repository or a non-empty .tag file.") |