-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.gradle
23 lines (20 loc) · 1.05 KB
/
config.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
adjustProperty('untillGithubRegistryUsername', null)
adjustProperty('untillGithubRegistryToken', null, true)
/////////////////////
// Private methods //
/////////////////////
void adjustProperty(String propertyName, String defaultValue, boolean required = false) {
if (!hasProperty(propertyName)) {
def sysPropName = propertyName.replaceAll('([A-Z])([A-Z][a-z])|([a-z0-9])([A-Z])', '$1$3.$2$4').toLowerCase()
def sysEnvName = propertyName.replaceAll('([A-Z])([A-Z][a-z])|([a-z0-9])([A-Z])', '$1$3_$2$4').toUpperCase()
def value = System.properties[sysPropName]
if (value == null) value = System.env[sysEnvName]
if (value == null && required)
println String.format('\tWARNING: Missing required property "%1$s"%n' +
'Please define this property one of following means: in file "gradle.properties", ' +
'as JVM system property "%2$s", as environment variable "%3$s" ' +
'or as command line parameter "-P%1$s=<value>".',
propertyName, sysPropName, sysEnvName)
ext[propertyName] = value == null ? defaultValue : value
}
}