Minor gradle script changes

This commit is contained in:
topjohnwu 2020-07-02 05:01:55 -07:00
parent c2e6622016
commit f6a2b1c882

View File

@ -2,12 +2,6 @@ import java.nio.file.Paths
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def props = new Properties()
def configPath = project.hasProperty('configPath') ?
new File(project.configPath) : rootProject.file('config.prop')
if (configPath.exists())
configPath.withInputStream { is -> props.load(is) }
buildscript {
ext.vKotlin = '1.3.72'
ext.vNav = '2.3.0'
@ -33,6 +27,13 @@ task clean(type: Delete) {
delete rootProject.buildDir
}
String.metaClass.toFile = { new File(this) }
def configFile = rootProject.findProperty('configPath')?.toFile() ?: rootProject.file('config.prop')
if (!configFile.exists())
throw new GradleException("Please setup config.prop")
def props = new Properties()
configFile.withInputStream { is -> props.load(is) }
ext.props = props
subprojects {
@ -98,17 +99,19 @@ subprojects {
android {
signingConfigs {
config {
storeFile new File(props['keyStore'])
storePassword props['keyStorePass']
keyAlias props['keyAlias']
keyPassword props['keyPass']
if (props.containsKey('keyStore')) {
storeFile new File(props['keyStore'])
storePassword props['keyStorePass']
keyAlias props['keyAlias']
keyPassword props['keyPass']
}
}
}
buildTypes {
debug {
// If keystore exists, sign the APK with custom signature
if (signingConfigs.config.storeFile.exists())
if (signingConfigs.config.storeFile?.exists())
signingConfig signingConfigs.config
}
release {