Fix issue with resolving the path for the Android keystore file
The previous logic passed the path to the Android keystore as-is to an external tool. This causes the tool to fail if the path is Godot-specific (e.g: 'res://<path_to_keystore>'
This commit is contained in:
parent
029aadef56
commit
6fd5238955
2 changed files with 18 additions and 8 deletions
|
@ -1393,6 +1393,14 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
|
|||
p_manifest = ret;
|
||||
}
|
||||
|
||||
String EditorExportPlatformAndroid::_get_keystore_path(const Ref<EditorExportPreset> &p_preset, bool p_debug) {
|
||||
String keystore_preference = p_debug ? "keystore/debug" : "keystore/release";
|
||||
String keystore_env_variable = p_debug ? ENV_ANDROID_KEYSTORE_DEBUG_PATH : ENV_ANDROID_KEYSTORE_RELEASE_PATH;
|
||||
String keystore_path = p_preset->get_or_env(keystore_preference, keystore_env_variable);
|
||||
|
||||
return ProjectSettings::get_singleton()->globalize_path(keystore_path).simplify_path();
|
||||
}
|
||||
|
||||
String EditorExportPlatformAndroid::_parse_string(const uint8_t *p_bytes, bool p_utf8) {
|
||||
uint32_t offset = 0;
|
||||
uint32_t len = 0;
|
||||
|
@ -2347,10 +2355,10 @@ static bool has_valid_keystore_credentials(String &r_error_str, const String &p_
|
|||
}
|
||||
|
||||
bool EditorExportPlatformAndroid::has_valid_username_and_password(const Ref<EditorExportPreset> &p_preset, String &r_error) {
|
||||
String dk = p_preset->get_or_env("keystore/debug", ENV_ANDROID_KEYSTORE_DEBUG_PATH);
|
||||
String dk = _get_keystore_path(p_preset, true);
|
||||
String dk_user = p_preset->get_or_env("keystore/debug_user", ENV_ANDROID_KEYSTORE_DEBUG_USER);
|
||||
String dk_password = p_preset->get_or_env("keystore/debug_password", ENV_ANDROID_KEYSTORE_DEBUG_PASS);
|
||||
String rk = p_preset->get_or_env("keystore/release", ENV_ANDROID_KEYSTORE_RELEASE_PATH);
|
||||
String rk = _get_keystore_path(p_preset, false);
|
||||
String rk_user = p_preset->get_or_env("keystore/release_user", ENV_ANDROID_KEYSTORE_RELEASE_USER);
|
||||
String rk_password = p_preset->get_or_env("keystore/release_password", ENV_ANDROID_KEYSTORE_RELEASE_PASS);
|
||||
|
||||
|
@ -2449,7 +2457,7 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
|
|||
|
||||
// Validate the rest of the export configuration.
|
||||
|
||||
String dk = p_preset->get_or_env("keystore/debug", ENV_ANDROID_KEYSTORE_DEBUG_PATH);
|
||||
String dk = _get_keystore_path(p_preset, true);
|
||||
String dk_user = p_preset->get_or_env("keystore/debug_user", ENV_ANDROID_KEYSTORE_DEBUG_USER);
|
||||
String dk_password = p_preset->get_or_env("keystore/debug_password", ENV_ANDROID_KEYSTORE_DEBUG_PASS);
|
||||
|
||||
|
@ -2467,7 +2475,7 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
|
|||
}
|
||||
}
|
||||
|
||||
String rk = p_preset->get_or_env("keystore/release", ENV_ANDROID_KEYSTORE_RELEASE_PATH);
|
||||
String rk = _get_keystore_path(p_preset, false);
|
||||
String rk_user = p_preset->get_or_env("keystore/release_user", ENV_ANDROID_KEYSTORE_RELEASE_USER);
|
||||
String rk_password = p_preset->get_or_env("keystore/release_password", ENV_ANDROID_KEYSTORE_RELEASE_PASS);
|
||||
|
||||
|
@ -2724,7 +2732,7 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportP
|
|||
Error EditorExportPlatformAndroid::sign_apk(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &export_path, EditorProgress &ep) {
|
||||
int export_format = int(p_preset->get("gradle_build/export_format"));
|
||||
String export_label = export_format == EXPORT_FORMAT_AAB ? "AAB" : "APK";
|
||||
String release_keystore = p_preset->get_or_env("keystore/release", ENV_ANDROID_KEYSTORE_RELEASE_PATH);
|
||||
String release_keystore = _get_keystore_path(p_preset, false);
|
||||
String release_username = p_preset->get_or_env("keystore/release_user", ENV_ANDROID_KEYSTORE_RELEASE_USER);
|
||||
String release_password = p_preset->get_or_env("keystore/release_password", ENV_ANDROID_KEYSTORE_RELEASE_PASS);
|
||||
String target_sdk_version = p_preset->get("gradle_build/target_sdk");
|
||||
|
@ -2746,7 +2754,7 @@ Error EditorExportPlatformAndroid::sign_apk(const Ref<EditorExportPreset> &p_pre
|
|||
String password;
|
||||
String user;
|
||||
if (p_debug) {
|
||||
keystore = p_preset->get_or_env("keystore/debug", ENV_ANDROID_KEYSTORE_DEBUG_PATH);
|
||||
keystore = _get_keystore_path(p_preset, true);
|
||||
password = p_preset->get_or_env("keystore/debug_password", ENV_ANDROID_KEYSTORE_DEBUG_PASS);
|
||||
user = p_preset->get_or_env("keystore/debug_user", ENV_ANDROID_KEYSTORE_DEBUG_USER);
|
||||
|
||||
|
@ -3231,7 +3239,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||
|
||||
if (should_sign) {
|
||||
if (p_debug) {
|
||||
String debug_keystore = p_preset->get_or_env("keystore/debug", ENV_ANDROID_KEYSTORE_DEBUG_PATH);
|
||||
String debug_keystore = _get_keystore_path(p_preset, true);
|
||||
String debug_password = p_preset->get_or_env("keystore/debug_password", ENV_ANDROID_KEYSTORE_DEBUG_PASS);
|
||||
String debug_user = p_preset->get_or_env("keystore/debug_user", ENV_ANDROID_KEYSTORE_DEBUG_USER);
|
||||
|
||||
|
@ -3253,7 +3261,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
|
|||
cmdline.push_back("-Pdebug_keystore_password=" + debug_password); // argument to specify the debug keystore password.
|
||||
} else {
|
||||
// Pass the release keystore info as well
|
||||
String release_keystore = p_preset->get_or_env("keystore/release", ENV_ANDROID_KEYSTORE_RELEASE_PATH);
|
||||
String release_keystore = _get_keystore_path(p_preset, false);
|
||||
String release_username = p_preset->get_or_env("keystore/release_user", ENV_ANDROID_KEYSTORE_RELEASE_USER);
|
||||
String release_password = p_preset->get_or_env("keystore/release_password", ENV_ANDROID_KEYSTORE_RELEASE_PASS);
|
||||
if (release_keystore.is_relative_path()) {
|
||||
|
|
|
@ -166,6 +166,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
|||
|
||||
void _fix_manifest(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_manifest, bool p_give_internet);
|
||||
|
||||
static String _get_keystore_path(const Ref<EditorExportPreset> &p_preset, bool p_debug);
|
||||
|
||||
static String _parse_string(const uint8_t *p_bytes, bool p_utf8);
|
||||
|
||||
void _fix_resources(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &r_manifest);
|
||||
|
|
Loading…
Reference in a new issue