From da885fb80789ba07475bd85415f9f0b662e9c282 Mon Sep 17 00:00:00 2001 From: IllusionMan1212 Date: Sat, 5 Apr 2025 02:21:56 +0200 Subject: android bundling improvements replace `jarsigner` with build tools' `apksigner` which is capable of using newer signature schemes remove the `android-manifest` flag and assume the file exists in the directory we're bundling make `android-keystore-alias` and `android-keystore-password` optional. The former is not needed if there's only one key in the keystore, and the latter will be prompted by `apksigner` if missing don't change the working directory to the bundled directory to prevent confusion when passing a relative path to `android-keystore` add the `res`, `assets`, and `lib` directories to the bundle if they exist in the bundled directory --- src/main.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 5a54e9bc3..155e48d9c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -413,7 +413,6 @@ enum BuildFlagKind { BuildFlag_AndroidKeystore, BuildFlag_AndroidKeystoreAlias, BuildFlag_AndroidKeystorePassword, - BuildFlag_AndroidManifest, BuildFlag_COUNT, }; @@ -634,7 +633,6 @@ gb_internal bool parse_build_flags(Array args) { add_flag(&build_flags, BuildFlag_AndroidKeystore, str_lit("android-keystore"), BuildFlagParam_String, Command_bundle_android); add_flag(&build_flags, BuildFlag_AndroidKeystoreAlias, str_lit("android-keystore-alias"), BuildFlagParam_String, Command_bundle_android); add_flag(&build_flags, BuildFlag_AndroidKeystorePassword, str_lit("android-keystore-password"), BuildFlagParam_String, Command_bundle_android); - add_flag(&build_flags, BuildFlag_AndroidManifest, str_lit("android-manifest"), BuildFlagParam_String, Command_bundle_android); Array flag_args = {}; @@ -1671,11 +1669,6 @@ gb_internal bool parse_build_flags(Array args) { GB_ASSERT(value.kind == ExactValue_String); build_context.android_keystore_password = value.value_string; break; - - case BuildFlag_AndroidManifest: - GB_ASSERT(value.kind == ExactValue_String); - build_context.android_manifest = value.value_string; - break; } } @@ -2208,7 +2201,7 @@ gb_internal void remove_temp_files(lbGenerator *gen) { return; } - TIME_SECTION("remove keep temp files"); + TIME_SECTION("remove temp files"); for (String const &path : gen->output_temp_paths) { gb_file_remove(cast(char const *)path.text); @@ -2560,7 +2553,7 @@ gb_internal void print_show_help(String const arg0, String command, String optio if (print_flag("-minimum-os-version:")) { print_usage_line(2, "Sets the minimum OS version targeted by the application."); print_usage_line(2, "Default: -minimum-os-version:11.0.0"); - print_usage_line(2, "Only used when target is Darwin, if given, linking mismatched versions will emit a warning."); + print_usage_line(2, "Only used when target is Darwin or subtarget is Android, if given, linking mismatched versions will emit a warning."); } } -- cgit v1.2.3 From ef49d2f0b8f37cb90a1e10f3af8f67f8245ca7c0 Mon Sep 17 00:00:00 2001 From: Hisham Aburaqibah Date: Sat, 5 Apr 2025 09:52:31 +0200 Subject: print android-specific flags for the bundle command --- src/main.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 155e48d9c..b2cfbe018 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2848,6 +2848,25 @@ gb_internal void print_show_help(String const arg0, String command, String optio print_usage_line(2, "Treats warning messages as error messages."); } } + + if (bundle) { + print_usage_line(0, ""); + print_usage_line(1, "Android-specific flags"); + print_usage_line(0, ""); + if (print_flag("-android-keystore:")) { + print_usage_line(2, "Specifies the keystore file to use to sign the apk."); + } + + if (print_flag("-android-keystore-alias:")) { + print_usage_line(2, "Specifies the key alias to use when signing the apk"); + print_usage_line(2, "Can be omitted if the keystore only contains one key"); + } + + if (print_flag("-android-keystore-password:")) { + print_usage_line(2, "Sets the password to use to unlock the keystore"); + print_usage_line(2, "If this is omitted, the terminal will prompt you to provide it."); + } + } } gb_internal void print_show_unused(Checker *c) { -- cgit v1.2.3