src/android: skip signing the APK if KEY_ALIAS env var is not set
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 14 Sep 2015 17:44:57 +0000 (13:44 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 14 Sep 2015 17:44:57 +0000 (13:44 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/platform/android.nit

index 72c219f..1a6f458 100644 (file)
@@ -337,11 +337,16 @@ $(call import-module,android/native_app_glue)
                        var tsa_server= "TSA_SERVER".environ
 
                        if key_alias.is_empty then
-                               toolcontext.error(null,
-                                       "Error: the environment variable `KEY_ALIAS` must be set to use the `--release` option on Android projects.")
+                               toolcontext.warning(null, "key-alias",
+                                       "Warning: the environment variable `KEY_ALIAS` is not set, the APK file will not be signed.")
+
+                               # Just move the unsigned APK to outname
+                               args = ["mv", apk_path, outname]
+                               toolcontext.exec_and_check(args, "Android project error")
                                return
                        end
 
+                       # We have a key_alias, try to sign the APK
                        args = ["jarsigner", "-sigalg", "MD5withRSA", "-digestalg", "SHA1", apk_path, key_alias]
 
                        ## Use a custom keystore