diff options
author | fuzzard <fuzzard@kodi.tv> | 2021-11-24 18:33:33 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2021-11-30 18:44:18 +1000 |
commit | b7594d5bf163736a13d44f2964ca2e74be9a3bc7 (patch) | |
tree | 040121366733e56997653d58d031c59a0d0737aa /tools/android | |
parent | 97ab1c4458824008aa61f36a6338aee531ecfd76 (diff) |
[android] use gradle to sign rather than explicit jarsigner/apksigner
Diffstat (limited to 'tools/android')
-rw-r--r-- | tools/android/packaging/Makefile.in | 42 | ||||
-rwxr-xr-x | tools/android/packaging/apksign | 10 | ||||
-rw-r--r-- | tools/android/packaging/gradle.properties | 1 | ||||
-rw-r--r-- | tools/android/packaging/xbmc/build.gradle.in | 25 |
4 files changed, 36 insertions, 42 deletions
diff --git a/tools/android/packaging/Makefile.in b/tools/android/packaging/Makefile.in index 243d49a276..459939f2bc 100644 --- a/tools/android/packaging/Makefile.in +++ b/tools/android/packaging/Makefile.in @@ -15,13 +15,20 @@ COPYDIRS = system addons media GCC_VERSION=$(shell $(CC) -dumpversion) ZIP=zip -SIGN_STORE=~/.android/debug.keystore -SIGN_STOREPASS=android -SIGN_KEY=androiddebugkey -SIGN_KEYPASS= +ifeq ($(KODI_ANDROID_STORE_FILE),) +export KODI_ANDROID_STORE_FILE:=$(HOME)/.android/debug.keystore +endif + +ifeq ($(KODI_ANDROID_STORE_PASSWORD),) +export KODI_ANDROID_STORE_PASSWORD:=android +endif + +ifeq ($(KODI_ANDROID_KEY_ALIAS),) +export KODI_ANDROID_KEY_ALIAS:=androiddebugkey +endif -ifneq ($(strip $(SIGN_KEYPASS)),) -SIGN_KEYPASS_OPT=-keypass $(SIGN_KEYPASS) +ifeq ($(KODI_ANDROID_KEY_PASSWORD),) +export KODI_ANDROID_KEY_PASSWORD:=android endif #this fixes a android ndk fuckup where the paths to @@ -54,17 +61,11 @@ libs= $(DSTLIBS) all: apk -apk: apk-clean sharedapk package apk-sign +apk: apk-clean sharedapk package obb: apk-clean sharedobb -apk-unsigned: apk-clean sharedapk package - -apk-obb: apk-clean sharedobb package apk-sign - -apk-obb-unsigned: apk-clean sharedobb package - -apk-noobb: apk-clean package apk-sign +apk-obb: apk-clean sharedobb package xbmc/assets: mkdir -p xbmc/assets @@ -134,16 +135,9 @@ java: res @cp -R xbmc/src/* xbmc/java/$(APP_PACKAGE_DIR)/ package: libs python java - @echo "Gradle build..." - ANDROID_HOME=$(SDKROOT) ./gradlew assemble$(BUILD_TYPE)Unsigned - @cp xbmc/build/outputs/apk/$(BUILD_TYPE_LC)Unsigned/xbmc-$(BUILD_TYPE_LC)Unsigned-unsigned.apk images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk - -apk-sign: - @echo "Signing..." - @jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore $(SIGN_STORE) -storepass $(SIGN_STOREPASS) $(SIGN_KEYPASS_OPT) images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk $(SIGN_KEY) - @$(ZIPALIGN) -f 4 images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk $(CMAKE_SOURCE_DIR)/@APP_NAME_LC@app-$(CPU)-debug.apk - @rm images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk - @echo "$(CMAKE_SOURCE_DIR)/@APP_NAME_LC@app-$(CPU)-debug.apk created" + @echo "Gradle build and sign..." + ANDROID_HOME=$(SDKROOT) ./gradlew assemble$(BUILD_TYPE) + @cp xbmc/build/outputs/apk/$(BUILD_TYPE_LC)/xbmc-$(BUILD_TYPE_LC).apk $(CMAKE_SOURCE_DIR)/@APP_NAME_LC@app-$(CPU)-$(BUILD_TYPE_LC).apk $(PREFIX)/lib/xbmc/lib@APP_NAME_LC@.so: $(SRCLIBS) $(MAKE) -C ../../depends/target/xbmc diff --git a/tools/android/packaging/apksign b/tools/android/packaging/apksign deleted file mode 100755 index 7ac9f57bb9..0000000000 --- a/tools/android/packaging/apksign +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -usage(){ - echo "Usage: $0 <keystore_filename> <keystore_password> <key_name> [<key_password>]" - exit 1 -} - -[[ $# -lt 3 ]] && usage - -make apk-sign SIGN_STORE=$1 SIGN_STOREPASS=$2 SIGN_KEY=$3 SIGN_KEYPASS=$4 - diff --git a/tools/android/packaging/gradle.properties b/tools/android/packaging/gradle.properties index 5bac8ac504..3c8ba69b76 100644 --- a/tools/android/packaging/gradle.properties +++ b/tools/android/packaging/gradle.properties @@ -1 +1,2 @@ android.useAndroidX=true +org.gradle.jvmargs=-Xmx1024m diff --git a/tools/android/packaging/xbmc/build.gradle.in b/tools/android/packaging/xbmc/build.gradle.in index 630d13c816..1660a0184c 100644 --- a/tools/android/packaging/xbmc/build.gradle.in +++ b/tools/android/packaging/xbmc/build.gradle.in @@ -9,17 +9,26 @@ android { versionCode @APP_VERSION_CODE_ANDROID@ versionName "@APP_VERSION@" } - buildTypes { - releaseUnsigned.initWith(buildTypes.release) - releaseUnsigned { - signingConfig null + signingConfigs { + release { + keyAlias System.getenv("KODI_ANDROID_KEY_ALIAS") + keyPassword System.getenv("KODI_ANDROID_KEY_PASSWORD") + storeFile file(System.getenv("KODI_ANDROID_STORE_FILE")) + storePassword System.getenv("KODI_ANDROID_STORE_PASSWORD") + v1SigningEnabled true + v2SigningEnabled true } - debugUnsigned.initWith(buildTypes.debug) - debugUnsigned { - signingConfig null + } + buildTypes { + debug { + zipAlignEnabled true + signingConfig signingConfigs.release + } + release { + zipAlignEnabled true + signingConfig signingConfigs.release } - } aaptOptions { ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' |