diff options
author | Michal Klocek <michal.klocek@qt.io> | 2023-03-28 08:36:09 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-05-15 13:14:53 +0000 |
commit | d103445039bcb0881f1e752aca62fcf79f3f196b (patch) | |
tree | 4dd496f93be6c34e0f8d62648a8467de12aa1ab0 | |
parent | f1cf7b1e4f54b52aa9f907629a5b6c82c13349ea (diff) | |
download | qtwebengine-d103445039bcb0881f1e752aca62fcf79f3f196b.tar.gz |
Add update-chromium target and unify 'Update Chromium' commits
To save some typing when doing 3rdparty udpate introduce
'update-chromium' target, which creates commit with nicely
formated commit message with shas, it can be used for example
with following steps:
* qtwebengine repo is at the origin HEAD with nothing stagged
* there are some new commits in 3rdparty
* code compiles and there are no issues
* make update commit by typing in <build_dir>
* ninja update-chromium
or
* cmake --build . --target update-chromium
* push the commit
You can also create the commit from <source_dir> with:
cmake -P cmake/SubmoduleUpdate.cmake
Change-Id: Ia6b051cd2df0646707c2cc88175245841728794f
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Yigit Akcay <yigit.akcay@qt.io>
(cherry picked from commit c228e708678f32ced2efb26b9dfb24a515e8e4f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | cmake/SubmoduleUpdate.cmake | 70 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 8 |
2 files changed, 78 insertions, 0 deletions
diff --git a/cmake/SubmoduleUpdate.cmake b/cmake/SubmoduleUpdate.cmake new file mode 100644 index 000000000..123db55bf --- /dev/null +++ b/cmake/SubmoduleUpdate.cmake @@ -0,0 +1,70 @@ +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT CMAKE_SCRIPT_MODE_FILE) + message("This file should run only in script mode") + return() +endif() + +get_filename_component(WEBENGINE_ROOT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/.." REALPATH) +get_filename_component(WEBENGINE_ROOT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" REALPATH) + +include(${WEBENGINE_ROOT_SOURCE_DIR}/.cmake.conf) +include(${WEBENGINE_ROOT_SOURCE_DIR}/cmake/Functions.cmake) + +find_program(GIT_EXECUTABLE NAMES git REQUIRED) + +execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD + WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR}/src/3rdparty + OUTPUT_VARIABLE SUBMODULE_NEW_SHA + OUTPUT_STRIP_TRAILING_WHITESPACE +) +execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD:src/3rdparty + WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR} + OUTPUT_VARIABLE SUBMODULE_OLD_SHA + OUTPUT_STRIP_TRAILING_WHITESPACE +) +set(shas "${SUBMODULE_OLD_SHA}..${SUBMODULE_NEW_SHA}") +set(format "* %s") +execute_process( + COMMAND ${GIT_EXECUTABLE} log + --pretty=format:${format} + --abbrev-commit ${shas} + WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR}/src/3rdparty + OUTPUT_VARIABLE SUBMODULE_COMMITS + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +if(SUBMODULE_COMMITS) + message("commits found for ${shas}") + execute_process( + COMMAND ${GIT_EXECUTABLE} add src/3rdparty + WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR} + ) + set(commits ${SUBMODULE_COMMITS}) + execute_process( + COMMAND ${GIT_EXECUTABLE} commit + --allow-empty + -m "Update Chromium" + -m "Submodule src/3rdparty ${shas}:\n${commits}" + WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR} + RESULT_VARIABLE gitResult + OUTPUT_VARIABLE gitOutput + ERROR_VARIABLE gitError + ) + + if(NOT gitResult EQUAL 0) + message(FATAL_ERROR "\n-- Git Commit FAILED\n${gitOutput}\n${gitError}\n${gitResult}\n") + else() + string(REGEX REPLACE "\n$" "" gnOutput "${gitOutput}") + message("-- Git Commit ${gitOutput}") + execute_process( + COMMAND ${GIT_EXECUTABLE} show HEAD + WORKING_DIRECTORY ${WEBENGINE_ROOT_SOURCE_DIR} + ) + endif() +else() + message(FATAL_ERROR "-- Git Commit found no commits for ${shas}") +endif() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 1adcf50b3..6450d37e8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -593,3 +593,11 @@ if(QT_FEATURE_webengine_spellchecker AND NOT CMAKE_CROSSCOMPILING) add_dependencies(${dict_target_name} WebEngineCore) endif() +## +# CHROMIUM UPDATE +## + +add_custom_target(update-chromium + COMMAND ${CMAKE_COMMAND} -P ${WEBENGINE_ROOT_SOURCE_DIR}/cmake/SubmoduleUpdate.cmake + DEPENDS ${WEBENGINE_ROOT_SOURCE_DIR}/cmake/SubmoduleUpdate.cmake +) |