Skip to content

Commit

Permalink
Reestablish the dependency chain between Android ABI-specific targets
Browse files Browse the repository at this point in the history
Actual dependency chain doesn't consider the changes in Android
ABI-specific targets. To make sure we rebuild per-ABI targets this
changes the dependency chain, which looks as following now:

 - <target>_make_<apk|aar|aab>
 - <target>_copy_apk_dependencies (new proxy order-only target)
 - qt_internal_android_<abi>_<target>_copy_apk_dependencies
 - qt_internal_android_<abi>_<target>_copy_apk_dependencies_stamp
 - qt_internal_android_<abi>_<target>_build_stamp
 - <target>

So the <target> dependency on the per-ABI build targets is reversed,
to guarantee that per-ABI targets react on source changes.

Fixes: QTBUG-129358
Change-Id: Id4d5fb0d45a213cd49c8a6aefa72c5db6609d714
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
(cherry picked from commit 44149f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
  • Loading branch information
semlanik authored and Qt Cherry-pick Bot committed Oct 3, 2024
1 parent 305b461 commit 348d56c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/corelib/Qt6AndroidMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,12 @@ function(qt6_android_add_apk_target target)
${uses_terminal}
)
endif()
else()
if(TARGET ${target}_copy_apk_dependencies)
add_dependencies(${target}_make_apk ${target}_copy_apk_dependencies)
add_dependencies(${target}_make_aab ${target}_copy_apk_dependencies)
add_dependencies(${target}_make_aar ${target}_copy_apk_dependencies)
endif()
endif()

set_property(GLOBAL APPEND PROPERTY _qt_apk_targets ${target})
Expand Down Expand Up @@ -1271,7 +1277,7 @@ endfunction()

# Adds the custom build step to the multi-ABI Android project
function(_qt_internal_add_android_abi_step project abi step)
cmake_parse_arguments(arg "" "" "COMMAND;DEPENDS" ${ARGV})
cmake_parse_arguments(arg "" "" "COMMAND;DEPENDS;TARGET_DEPENDS" ${ARGV})

if(NOT arg_COMMAND)
message(FATAL_ERROR "COMMAND is not set for ${project} step ${step} Android ABI ${abi}.")
Expand All @@ -1291,13 +1297,18 @@ function(_qt_internal_add_android_abi_step project abi step)
set(add_to_pool "")
endif()

if(NOT arg_TARGET_DEPENDS)
set(arg_TARGET_DEPENDS "")
endif()

_qt_internal_get_android_abi_step_stampfile(stamp ${project} ${abi} ${step})
add_custom_command(OUTPUT "${stamp}"
COMMAND ${arg_COMMAND}
COMMAND "${CMAKE_COMMAND}" -E touch "${stamp}"
${add_to_pool}
DEPENDS
${dep_stamps}
${arg_TARGET_DEPENDS}
WORKING_DIRECTORY
"${build_dir}"
VERBATIM
Expand Down Expand Up @@ -1443,7 +1454,9 @@ function(_qt_internal_configure_android_multiabi_target target)
endforeach()

set(missing_qt_abi_toolchains "")
set(previous_copy_apk_dependencies_target ${target})

add_custom_target(${target}_copy_apk_dependencies)
set(previous_copy_apk_dependencies_target ${target}_copy_apk_dependencies)
# Create external projects for each android ABI except the main one.
list(REMOVE_ITEM android_abis "${CMAKE_ANDROID_ARCH_ABI}")
foreach(abi IN ITEMS ${android_abis})
Expand Down Expand Up @@ -1489,13 +1502,14 @@ function(_qt_internal_configure_android_multiabi_target target)
_qt_internal_add_android_abi_step(qt_internal_android_${abi} ${abi} ${target}_build
DEPENDS
configure
TARGET_DEPENDS
${target}
COMMAND
"${CMAKE_COMMAND}"
--build "${android_abi_build_dir}"
--config $<CONFIG>
--target ${target}
)
add_dependencies(${target} "qt_internal_android_${abi}_${target}_build")

_qt_internal_add_android_abi_step(qt_internal_android_${abi} ${abi}
${target}_copy_apk_dependencies
Expand Down

0 comments on commit 348d56c

Please sign in to comment.