Przeglądaj źródła

build: Allow building release artifacts in-tree

This change avoids all need for changing any file under
VCS to insert signing keys and configs for release builds.

Example contents of keystore.properties

```
// Location of keystore, relative to module build.gradle,
// in this case, of the app module
storeFile=../wireguard.jks
storePassword=b3ty0uc4nth4xxth1s
keyAlias=wireguard
keyPassword=4ndr01dsux
```

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
master
Harsh Shandilya 6 lat temu
rodzic
commit
0496b94aa8
2 zmienionych plików z 28 dodań i 0 usunięć
  1. +2
    -0
      .gitignore
  2. +26
    -0
      app/build.gradle

+ 2
- 0
.gitignore Wyświetl plik

@@ -13,3 +13,5 @@ build/
*.class *.class
*.dex *.dex
*.iml *.iml
*.jks
keystore.properties

+ 26
- 0
app/build.gradle Wyświetl plik

@@ -1,5 +1,9 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'


// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
final def keystorePropertiesFile = rootProject.file("keystore.properties")

android { android {
buildToolsVersion '27.0.3' buildToolsVersion '27.0.3'
compileOptions { compileOptions {
@@ -17,6 +21,28 @@ android {
versionCode 422 versionCode 422
versionName '0.0.20180605' versionName '0.0.20180605'
} }
// If the keystore file exists
if (keystorePropertiesFile.exists()) {
// Initialize a new Properties() object called keystoreProperties.
final def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
}
buildTypes {
release {
if (keystorePropertiesFile.exists()) signingConfig signingConfigs.release
}
}
externalNativeBuild { externalNativeBuild {
cmake { cmake {
path 'tools/CMakeLists.txt' path 'tools/CMakeLists.txt'


Ładowanie…
Anuluj
Zapisz