From 81cd18ad67a3c91d649d5414d19c3b443584049e Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Wed, 18 Mar 2020 12:03:25 -0400 Subject: [PATCH 1/3] [build] Signing android apps is easier Signing parameters can be passed on the command line, e.g. "ANDROID_SIGNING_STORE_FILE=foobar", or they can be written to a ~/.gradle/gradle.properties file using the "EPSILON_SIGNING_STORE_FILE=foobar" syntax. --- ion/src/simulator/android/Makefile | 13 ++++++------- ion/src/simulator/android/build.gradle | 18 ++++++++++++++---- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ion/src/simulator/android/Makefile b/ion/src/simulator/android/Makefile index 44771b25e..2c3af707c 100644 --- a/ion/src/simulator/android/Makefile +++ b/ion/src/simulator/android/Makefile @@ -72,14 +72,13 @@ $(eval $(call rule_for_gradle,assembleRelease,.official.)) DEFAULT = epsilon.apk -.PHONY: epsilon%apk -ifdef ANDROID_SIGNING_STORE_FILE -epsilon%apk: gradle_assembleCodesigned_% -else -epsilon%apk: gradle_assembleRelease_% - $(warning Building without code signing. Define ANDROID_SIGNING_STORE_FILE, ANDROID_SIGNING_STORE_PASSWORD, ANDROID_SIGNING_KEY_ALIAS and ANDROID_SIGNING_KEY_PASSWORD for a signed build.) -endif +.PHONY: epsilon%signed.apk +epsilon%signed.apk: gradle_assembleCodesigned_% + $(warning This is a signed build.) +.PHONY: epsilon%apk +epsilon%apk: gradle_assembleRelease_% + $(warning Building without code signing. Build epsilon$*signed.apk to generate a signed version.) .PHONY: epsilon_run epsilon_run: gradle_installDebug diff --git a/ion/src/simulator/android/build.gradle b/ion/src/simulator/android/build.gradle index eb4c8e160..158615d97 100644 --- a/ion/src/simulator/android/build.gradle +++ b/ion/src/simulator/android/build.gradle @@ -1,5 +1,15 @@ def BUILD_DIR = '../../../../'+System.getenv('BUILD_DIR')+'/app' +def projectVariable(name) { + /* This function retrieves a variable from the environment and falls back + * to the Gradle projects's properties (e.g. ~/.gradle/gradle.properties) */ + return System.getenv('ANDROID_'+name) ?: project.findProperty('EPSILON_'+name) +} + +def fileIfPath(path) { + return path ? new File(path) : null +} + buildscript { repositories { jcenter() @@ -33,10 +43,10 @@ android { } signingConfigs { environment { - storeFile System.getenv('ANDROID_SIGNING_STORE_FILE') ? new File(System.getenv('RELEASE_STORE_FILE')) : null - storePassword System.getenv('ANDROID_SIGNING_STORE_PASSWORD') - keyAlias System.getenv('ANDROID_SIGNING_KEY_ALIAS') - keyPassword System.getenv('ANDROID_SIGNING_KEY_PASSWORD') + storeFile fileIfPath(projectVariable('SIGNING_STORE_FILE')) + storePassword projectVariable('SIGNING_STORE_PASSWORD') + keyAlias projectVariable('SIGNING_KEY_ALIAS') + keyPassword projectVariable('SIGNING_KEY_PASSWORD') } } buildTypes { From 180903727362fd55db19de0f7433813f55e63142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 19 Mar 2020 12:25:22 +0100 Subject: [PATCH 2/3] [ion] Fix epsilon.official.ipa dependencies --- ion/src/simulator/ios/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ion/src/simulator/ios/Makefile b/ion/src/simulator/ios/Makefile index c19966b28..57e1cf41e 100644 --- a/ion/src/simulator/ios/Makefile +++ b/ion/src/simulator/ios/Makefile @@ -87,10 +87,10 @@ simulator_app_deps += $(call simulator_app_resource,$(1), \ launch.storyboardc \ ) -$(BUILD_DIR)/app/epsilon%ipa: $(subst ..,.,$(call simulator_app_deps,Epsilon$*)) +$(BUILD_DIR)/app/epsilon%ipa: $$(subst ..,.,$$(call simulator_app_deps,Epsilon$$*)) ifdef IOS_PROVISIONNING_PROFILE $(call rule_label,SIGN) - $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "Apple Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon.app + $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "Apple Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon$*app endif $(call rule_label,ZIP) $(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) Payload From 5f5636fe4d5881627a20c9862a935f08d865b265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 19 Mar 2020 15:30:43 +0100 Subject: [PATCH 3/3] [build] Fix all_official target --- build/targets.all.mak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/targets.all.mak b/build/targets.all.mak index e6d989add..1a48a316e 100644 --- a/build/targets.all.mak +++ b/build/targets.all.mak @@ -54,8 +54,8 @@ all_official: $(Q) cp output/release/simulator/web/epsilon.official.js.mem output/all_official/epsilon.python.js.mem $(Q) echo "BUILD_FIRMWARE SIMULATOR ANDROID" $(Q) $(MAKE) PLATFORM=simulator TARGET=android clean - $(Q) $(MAKE) PLATFORM=simulator TARGET=android epsilon.official.apk - $(Q) cp output/release/simulator/android/app/outputs/apk/release/android-release-unsigned.apk output/all_official/epsilon.apk + $(Q) $(MAKE) PLATFORM=simulator TARGET=android epsilon.official.signed.apk + $(Q) cp output/release/simulator/android/app/outputs/apk/codesigned/android-codesigned.apk output/all_official/epsilon.official.apk $(Q) echo "BUILD_FIRMWARE SIMULATOR IOS" $(Q) $(MAKE) PLATFORM=simulator TARGET=ios clean $(Q) $(MAKE) PLATFORM=simulator TARGET=ios IOS_PROVISIONNING_PROFILE=$(IOS_MOBILE_PROVISION) output/release/simulator/ios/app/epsilon.official.ipa