Skip to content
Snippets Groups Projects
Commit 9c2a13fa authored by Rick Herrick's avatar Rick Herrick
Browse files

Added propertyWithDefault() helper function to work with builds without deploy and repo vars set.

parent 264df418
No related branches found
No related tags found
No related merge requests found
......@@ -290,19 +290,19 @@ dependencies {
}
cargo {
def blankProperty = "xxx"
def blankPort = 0
// These properties must be set in the ~/.gradle/gradle.properties file or passed on the Gradle command line in
// the form -PdeployPort=8080 -PdeployContext=/ -PdeployHost=localhost -PdeployUser=deploy -PdeployPassword=deploy
containerId = 'tomcat7x'
port = hasProperty('deployPort') ? getProperty('deployPort') as int : blankPort
port = propertyWithDefault('deployPort', 8080) as int
deployable {
context = hasProperty('deployContext') ? getProperty('deployContext') : blankProperty
context = propertyWithDefault('deployContext', '/')
}
remote {
hostname = hasProperty('deployHost') ? getProperty('deployHost') : blankProperty
username = hasProperty('deployUser') ? getProperty('deployUser') : blankProperty
password = hasProperty('deployPassword') ? getProperty('deployPassword') : blankProperty
hostname = propertyWithDefault('deployHost', 'localhost')
username = propertyWithDefault('deployUser', 'deploy')
password = propertyWithDefault('deployPassword', 'deploy')
}
}
......@@ -341,9 +341,9 @@ publishing {
maven {
credentials {
// These properties must be set in the ~/.gradle/gradle.properties file or passed on the Gradle command
// line in the form -DrepoUsername=foo -DrepoPassword=bar.
username hasProperty('repoUsername') ? getProperty('repoUsername') : blankProperty
password hasProperty('repoPassword') ? getProperty('repoPassword') : blankProperty
// line in the form -PrepoUsername=foo -PrepoPassword=bar.
username propertyWithDefault('repoUsername', 'username')
password propertyWithDefault('repoPassword', 'password')
}
if (project.version.endsWith('-SNAPSHOT')) {
url "http://nrgxnat.artifactoryonline.com/nrgxnat/libs-snapshot-local"
......@@ -355,8 +355,8 @@ publishing {
credentials {
// These properties must be set in the ~/.gradle/gradle.properties file or passed on the Gradle command
// line in the form -DrepoUsername=foo -DrepoPassword=bar.
username hasProperty('repoUsername') ? getProperty('repoUsername') : blankProperty
password hasProperty('repoPassword') ? getProperty('repoPassword') : blankProperty
username propertyWithDefault('repoUsername', 'username')
password propertyWithDefault('repoPassword', 'password')
}
if (project.version.endsWith('-SNAPSHOT')) {
url "http://nrgxnat.artifactoryonline.com/nrgxnat/libs-snapshot-local"
......@@ -366,3 +366,7 @@ publishing {
}
}
}
def propertyWithDefault(def String property, def Object value) {
hasProperty(property) ? getProperty(property) : value
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment