add ANDROID_APK_SIGNED to make unsigned builds for F-Droid

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-07-28 10:33:37 +02:00
parent 517a1be27c
commit 788d0d5cc5
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
6 changed files with 13 additions and 5 deletions

View File

@ -159,6 +159,7 @@ release-android: export BUILD_ENV ?= prod
release-android: export BUILD_TYPE ?= nightly release-android: export BUILD_TYPE ?= nightly
release-android: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER) release-android: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER)
release-android: export KEYSTORE_PATH ?= $(HOME)/.gradle/status-im.keystore 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_SPLIT ?= false
release-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86 release-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
release-android: keystore ##@build build release for Android release-android: keystore ##@build build release for Android

View File

@ -228,6 +228,8 @@ android {
keyAlias 'androiddebugkey' keyAlias 'androiddebugkey'
keyPassword 'android' 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 { release {
/* environment variables take precedence over gradle.properties file */ /* environment variables take precedence over gradle.properties file */
storeFile file(getEnvOrConfig('KEYSTORE_PATH').replaceAll("~", System.properties['user.home'])) storeFile file(getEnvOrConfig('KEYSTORE_PATH').replaceAll("~", System.properties['user.home']))
@ -253,11 +255,11 @@ android {
resValue "string", "build_config_package", "im.status.ethereum" resValue "string", "build_config_package", "im.status.ethereum"
} }
release { 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 minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release if (getEnvOrConfig('ANDROID_APK_SIGNED').toBoolean()) {
signingConfig signingConfigs.release
}
} }
pr { pr {
initWith release initWith release

View File

@ -42,10 +42,12 @@ KEYSTORE_KEY_PASSWORD=password
ANDROID_ABI_SPLIT=false ANDROID_ABI_SPLIT=false
# Some platforms are excluded though # Some platforms are excluded though
ANDROID_ABI_INCLUDE=armeabi-v7a;arm64-v8a;x86 ANDROID_ABI_INCLUDE=armeabi-v7a;arm64-v8a;x86
# F-Droid builds need to be unsigned
ANDROID_APK_SIGNED=true
org.gradle.jvmargs=-Xmx8704M org.gradle.jvmargs=-Xmx8704M
versionCode=9999 versionCode=9999
# Flipper # Flipper
FLIPPER_VERSION=0.35.0 FLIPPER_VERSION=0.35.0

View File

@ -7,6 +7,7 @@
android = { android = {
gradle-opts = null; # Gradle options passed for Android builds gradle-opts = null; # Gradle options passed for Android builds
keystore-path = null; # Path to keystore for signing the APK 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-split = false; # If APKs should be split based on architectures
abi-include = "armeabi-v7a;arm64-v8a;x86"; # Android architectures to build for abi-include = "armeabi-v7a;arm64-v8a;x86"; # Android architectures to build for
}; };

View File

@ -28,7 +28,7 @@ let
# If it is not we use an ad-hoc one generated with default password. # If it is not we use an ad-hoc one generated with default password.
keystorePath = getConfig "android.keystore-path" keystore; keystorePath = getConfig "android.keystore-path" keystore;
baseName = "release-android"; baseName = "${buildType}-android";
name = "status-react-build-${baseName}"; name = "status-react-build-${baseName}";
envFileName = envFileName =
@ -72,6 +72,7 @@ in stdenv.mkDerivation rec {
# custom env variables derived from config # custom env variables derived from config
STATUS_GO_SRC_OVERRIDE = getConfig "nimbus.src-override" null; 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_SPLIT = getConfig "android.abi-split" "false";
ANDROID_ABI_INCLUDE = androidAbiInclude; ANDROID_ABI_INCLUDE = androidAbiInclude;

View File

@ -33,6 +33,7 @@ fi
config+="status-im.build-type=\"$(must_get_env BUILD_TYPE)\";" config+="status-im.build-type=\"$(must_get_env BUILD_TYPE)\";"
config+="status-im.build-number=\"$(must_get_env BUILD_NUMBER)\";" 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.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-split=\"$(must_get_env ANDROID_ABI_SPLIT)\";"
config+="status-im.android.abi-include=\"$(must_get_env ANDROID_ABI_INCLUDE)\";" config+="status-im.android.abi-include=\"$(must_get_env ANDROID_ABI_INCLUDE)\";"
nixOpts=() nixOpts=()