diff --git a/src/cli/cli.cc b/src/cli/cli.cc index 4c203bd65b..6f84f8b0e6 100644 --- a/src/cli/cli.cc +++ b/src/cli/cli.cc @@ -3492,6 +3492,23 @@ int main (int argc, char* argv[]) { trim(tmpl(tmpl(gAndroidManifest, settings), manifestContext)) ); + settings["android_signingconfig_release"] = ""; + settings["android_buildtypes_release_config"] = ""; + + if ( + settings["android_codesign_keystore_file"].size() > 0 && + settings["android_codesign_keystore_password"].size() > 0 && + settings["android_codesign_key_alias"].size() > 0 && + settings["android_codesign_key_password"].size() + ) { + settings["android_signingconfig_release"] += " storeFile file('{{android_codesign_keystore_file}}')\n"; + settings["android_signingconfig_release"] += " storePassword '{{android_codesign_keystore_password}}'\n"; + settings["android_signingconfig_release"] += " keyAlias '{{android_codesign_key_alias}}'\n"; + settings["android_signingconfig_release"] += " keyPassword '{{android_codesign_key_password}}'\n"; + settings["android_buildtypes_release_config"] += " signingConfig signingConfigs.release\n"; + } + + writeFile(app / "proguard-rules.pro", trim(tmpl(gProGuardRules, settings))); writeFile(app / "build.gradle", trim(tmpl(gGradleBuildForSource, settings))); @@ -4077,6 +4094,10 @@ int main (int argc, char* argv[]) { "security cms -D -i " + pathToProfile.string() ); + if (Env::has("APPLE_KEYCHAIN")) { + command += " -k" + Env::get("APPLE_KEYCHAIN"); + } + auto r = exec(command); std::regex reUuid(R"(UUID<\/key>\n\s*(.*)<\/string>)"); std::smatch matchUuid; diff --git a/src/cli/templates.hh b/src/cli/templates.hh index a73e160a98..8268d97670 100644 --- a/src/cli/templates.hh +++ b/src/cli/templates.hh @@ -1399,6 +1399,14 @@ android { {{android_default_config_external_native_build}} } + signingConfigs { + release { +{{android_signingconfig_release}} + v1SigningEnabled = true + v2SigningEnabled = true + } + } + aaptOptions { {{android_aapt}} noCompress {{android_aapt_no_compress}} @@ -1422,6 +1430,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' //productFlavors.dev productFlavors.live + {{android_buildtypes_release_config}} } debug {