Add command-line signing tooling

This commit is contained in:
William Brawner 2020-02-05 08:37:21 -06:00
parent 83cd3f3855
commit 09d7c66aff
3 changed files with 29 additions and 1 deletions

1
.gitignore vendored
View file

@ -12,3 +12,4 @@
/captures
.externalNativeBuild
.cxx
keystore.properties

View file

@ -2,6 +2,18 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def keystoreProperties = new Properties()
try {
def keystorePropertiesFile = rootProject.file("keystore.properties")
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} catch (FileNotFoundException ignored) {
logger.warn("Unable to load keystore properties. Using debug signing configuration instead")
keystoreProperties['keyAlias'] = "androiddebugkey"
keystoreProperties['keyPassword'] = "android"
keystoreProperties['storeFile'] = new File(System.getProperty("user.home"), ".android/debug.keystore").absolutePath
keystoreProperties['storePassword'] = "android"
}
android {
compileSdkVersion 29
defaultConfig {
@ -13,11 +25,19 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.debug
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
debuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {

View file

@ -0,0 +1,7 @@
# suppress inspection "UnusedProperty" for whole file
# Copy this file to keystore.properties and fill in the correct values to enable signing the app
# from the command line
keyAlias=
keyPassword=
storeFile=
storePassword=