@@ -97,6 +97,11 @@ def enableSeparateBuildPerCPUArchitecture = false
9797 */
9898def enableProguardInReleaseBuilds = false
9999
100+ /**
101+ * Fetch the keystore file's path from the environment
102+ */
103+ String keystorePath = System . getenv(" KEYSTORE_FILE" )
104+
100105android {
101106 compileSdkVersion rootProject. ext. compileSdkVersion
102107
@@ -123,19 +128,17 @@ android {
123128
124129 signingConfigs {
125130 // originally derived from https://gist.github.com/gabrielemariotti/6856974
126- String filePath = System . getenv(" KEYSTORE_FILE" )
127-
128- if (filePath == null ) {
131+ if (keystorePath == null ) {
129132 logger. warn " env['KEYSTORE_FILE'] not set"
130133 release
131134 return
132135 } else {
133- logger. warn " env['KEYSTORE_FILE'] = ${ filePath } "
136+ logger. warn " env['KEYSTORE_FILE'] = ${ keystorePath } "
134137 }
135138
136- def propFile = new File (filePath )
139+ def propFile = new File (keystorePath )
137140 if (! propFile. canRead()) {
138- logger. warn " ${ filePath } is not readable"
141+ logger. warn " ${ keystorePath } is not readable"
139142 release
140143 return
141144 }
@@ -170,7 +173,9 @@ android {
170173
171174 minifyEnabled enableProguardInReleaseBuilds
172175 proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
173- signingConfig signingConfigs. release
176+ if (keystorePath != null ) {
177+ signingConfig signingConfigs. release
178+ }
174179 }
175180 }
176181
0 commit comments