Skip to content

Commit

Permalink
add ANDROID_APK_SIGNED to make unsigned builds for F-Droid
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sokołowski <jakub@status.im>
  • Loading branch information
jakubgs committed Jul 29, 2020
1 parent 517a1be commit 788d0d5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ release-android: export BUILD_ENV ?= prod
release-android: export BUILD_TYPE ?= nightly
release-android: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER)
release-android: export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore
release-android: export ANDROID_APK_SIGNED ?= true
release-android: export ANDROID_ABI_SPLIT ?= false
release-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
release-android: keystore ##@build build release for Android
Expand Down
8 changes: 5 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ android {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
/* Caution! In production, you need to generate your own keystore file.
* See: https://facebook.github.io/react-native/docs/signed-apk-android */
release {
/* environment variables take precedence over gradle.properties file */
storeFile file(getEnvOrConfig('KEYSTORE_PATH').replaceAll("~", System.properties['user.home']))
Expand All @@ -253,11 +255,11 @@ android {
resValue "string", "build_config_package", "im.status.ethereum"
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
if (getEnvOrConfig('ANDROID_APK_SIGNED').toBoolean()) {
signingConfig signingConfigs.release
}
}
pr {
initWith release
Expand Down
4 changes: 3 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ KEYSTORE_KEY_PASSWORD=password
ANDROID_ABI_SPLIT=false
# Some platforms are excluded though
ANDROID_ABI_INCLUDE=armeabi-v7a;arm64-v8a;x86
# F-Droid builds need to be unsigned
ANDROID_APK_SIGNED=true

org.gradle.jvmargs=-Xmx8704M

versionCode=9999

# Flipper
FLIPPER_VERSION=0.35.0
FLIPPER_VERSION=0.35.0
1 change: 1 addition & 0 deletions nix/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
android = {
gradle-opts = null; # Gradle options passed for Android builds
keystore-path = null; # Path to keystore for signing the APK
apk-signed = true; # F-Droid builds aren't signed by us
abi-split = false; # If APKs should be split based on architectures
abi-include = "armeabi-v7a;arm64-v8a;x86"; # Android architectures to build for
};
Expand Down
3 changes: 2 additions & 1 deletion nix/mobile/android/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let
# If it is not we use an ad-hoc one generated with default password.
keystorePath = getConfig "android.keystore-path" keystore;

baseName = "release-android";
baseName = "${buildType}-android";
name = "status-react-build-${baseName}";

envFileName =
Expand Down Expand Up @@ -72,6 +72,7 @@ in stdenv.mkDerivation rec {

# custom env variables derived from config
STATUS_GO_SRC_OVERRIDE = getConfig "nimbus.src-override" null;
ANDROID_APK_SIGNED = getConfig "android.apk-unsigned" "true";
ANDROID_ABI_SPLIT = getConfig "android.abi-split" "false";
ANDROID_ABI_INCLUDE = androidAbiInclude;

Expand Down
1 change: 1 addition & 0 deletions scripts/release-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fi
config+="status-im.build-type=\"$(must_get_env BUILD_TYPE)\";"
config+="status-im.build-number=\"$(must_get_env BUILD_NUMBER)\";"
config+="status-im.android.keystore-path=\"$(must_get_env KEYSTORE_PATH)\";"
config+="status-im.android.apk-signed=\"$(must_get_env ANDROID_APK_SIGNED)\";"
config+="status-im.android.abi-split=\"$(must_get_env ANDROID_ABI_SPLIT)\";"
config+="status-im.android.abi-include=\"$(must_get_env ANDROID_ABI_INCLUDE)\";"
nixOpts=()
Expand Down

0 comments on commit 788d0d5

Please sign in to comment.