diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-11-18 10:27:47 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-11-30 20:16:13 +0100 |
commit | d162ce3732bc125ad42c5c5e98050a8e09ab9054 (patch) | |
tree | bbd93892a79518526b230e8b57d2525bc0a67e25 /src/corelib/Qt6AndroidMacros.cmake | |
parent | 54536bb5aea2da08d97670810b3baf14f90ed4f5 (diff) |
Add _make_aab target
Add target triggering AAB creation. Since the _make_aab target is
not added to the ALL set, we may avoid dependency check for it and
admit that the target is "always out of date".
[ChangeLog][Android][Platform Specific Changes] Add the extra
_make_aab targets for each executable target, that can be used
to generate android app bundles. Also add aab metatarget to build
all _make_aab targets that are created in the project.
Pick-to: 6.2
Fixes: QTBUG-96710
Change-Id: I3b0c7fbb5a7dd493ca7a124c4e4b91fd857386bd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/Qt6AndroidMacros.cmake')
-rw-r--r-- | src/corelib/Qt6AndroidMacros.cmake | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index a8843e4675..9495be94e5 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -322,9 +322,10 @@ function(qt6_android_add_apk_target target) message(FATAL_ERROR "Target ${target} is not a valid android executable target\n") endif() - # Make global apk target depend on the current apk target. + # Make global apk and aab targets depend on the current apk target. if(TARGET apk) add_dependencies(apk ${target}_make_apk) + add_dependencies(aab ${target}_make_aab) _qt_internal_create_global_apk_all_target_if_needed() endif() @@ -407,19 +408,44 @@ function(qt6_android_add_apk_target target) COMMENT "Creating APK for ${target}" ) endif() + + # Add target triggering AAB creation. Since the _make_aab target is not added to the ALL + # set, we may avoid dependency check for it and admit that the target is "always out + # of date". + add_custom_target(${target}_make_aab + DEPENDS ${target}_prepare_apk_dir + COMMAND ${deployment_tool} + --input ${deployment_file} + --output ${apk_final_dir} + --apk ${apk_final_file_path} + --aab + ${extra_args} + COMMENT "Creating AAB for ${target}" + ) + set_property(GLOBAL APPEND PROPERTY _qt_apk_targets ${target}) _qt_internal_collect_target_apk_dependencies_defer(${target}) endfunction() -function(_qt_internal_create_global_apk_target) +function(_qt_internal_create_global_android_targets) + macro(_qt_internal_create_global_android_targets_impl target) + string(TOUPPER "${target}" target_upper) + if(NOT QT_NO_GLOBAL_${target_upper}_TARGET) + if(NOT TARGET ${target}) + add_custom_target(${target} COMMENT "Building all apks") + endif() + endif() + endmacro() + # Create a top-level "apk" target for convenience, so that users can call 'ninja apk'. # It will trigger building all the apk build targets that are added as part of the project. # Allow opting out. - if(NOT QT_NO_GLOBAL_APK_TARGET) - if(NOT TARGET apk) - add_custom_target(apk COMMENT "Building all apks") - endif() - endif() + _qt_internal_create_global_android_targets_impl(apk) + + # Create a top-level "aab" target for convenience, so that users can call 'ninja aab'. + # It will trigger building all the apk build targets that are added as part of the project. + # Allow opting out. + _qt_internal_create_global_android_targets_impl(aab) endfunction() # The function collects all known non-imported shared libraries that are created in the build tree. |