Skip to content

Commit ea04fef

Browse files
author
Iain McGinniss
committed
Use locally generated keystore
Refactoring of the build files broke this behavior, reintroducing it.
1 parent e36e330 commit ea04fef

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

app/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'checkstyle'
33
apply from: '../config/android-common.gradle'
4+
apply from: '../config/keystore.gradle'
45

56
android {
67
defaultConfig {
@@ -14,6 +15,24 @@ android {
1415
'appAuthRedirectScheme': 'com.googleusercontent.apps.YOUR-ID'
1516
]
1617
}
18+
19+
signingConfigs {
20+
debugAndRelease {
21+
storeFile file("${rootDir}/appauth.keystore")
22+
storePassword "appauth"
23+
keyAlias "appauth"
24+
keyPassword "appauth"
25+
}
26+
}
27+
28+
buildTypes {
29+
debug {
30+
signingConfig signingConfigs.debugAndRelease
31+
}
32+
release {
33+
signingConfig signingConfigs.debugAndRelease
34+
}
35+
}
1736
}
1837

1938
dependencies {

build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ subprojects {
2323
}
2424
}
2525

26+
ext.verifyKeystore()
27+
2628
def grgit = org.ajoberstar.grgit.Grgit.open(dir: '.')
2729
def lastCommit = grgit.head()
2830

@@ -38,8 +40,10 @@ project.ext.compileSdkVersion = 25
3840
project.ext.buildToolsVersion = '25.0.1'
3941
project.ext.supportLibVersion = '25.1.0'
4042

41-
task showVersion << {
42-
logger.lifecycle("Version ID: " + project.versionNum)
43-
logger.lifecycle("Version Name: " + project.versionName)
44-
logger.lifecycle("Version Date: " + project.versionDate)
43+
task showVersion {
44+
doLast {
45+
logger.lifecycle("Version ID: " + project.versionNum)
46+
logger.lifecycle("Version Name: " + project.versionName)
47+
logger.lifecycle("Version Date: " + project.versionDate)
48+
}
4549
}

config/keystore.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
def generateKeystore = { keystoreFile ->
44
exec {
55
executable "keytool"
6-
args [
6+
args(
77
"-genkey",
88
"-keystore", "appauth.keystore",
99
"-alias", "appauth",
@@ -13,14 +13,14 @@ def generateKeystore = { keystoreFile ->
1313
"-keypass", "appauth",
1414
"-storepass", "appauth",
1515
"-dname", "CN=appauth"
16-
]
16+
)
1717
}
1818
}
1919

2020
// checks that a keystore exists in the expected location, and generates one
2121
// if it does not.
2222
ext.verifyKeystore = {
23-
def keystoreFile = file(new File(projectDir, "appauth.keystore"))
23+
def keystoreFile = file("${rootDir}/appauth.keystore")
2424
if (!keystoreFile.exists()) {
2525
logger.lifecycle("appauth.keystore missing - creating one")
2626
generateKeystore(keystoreFile)

0 commit comments

Comments
 (0)