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
This commit is contained in:
IllusionMan1212
2025-04-05 02:21:56 +02:00
parent 44950d5f37
commit da885fb807
3 changed files with 47 additions and 69 deletions

View File

@@ -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<String> 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<String> flag_args = {};
@@ -1671,11 +1669,6 @@ gb_internal bool parse_build_flags(Array<String> 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:<string>")) {
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.");
}
}