Skip to content

Commit

Permalink
Prove gradle.properties precedence is honored for nested builds
Browse files Browse the repository at this point in the history
  • Loading branch information
bamboo committed Mar 4, 2020
1 parent 9e1ff52 commit 240051f
Showing 1 changed file with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,32 @@ class CompositeBuildPropertiesIntegrationTest extends AbstractIntegrationSpec {

def "included build properties take precedence over root build properties"() {
given:
createDir("included") {
file("gradle.properties") << """
theProperty=included
"""
file("settings.gradle") << """
println("included settings script: " + theProperty)
"""
file("build.gradle") << """
println("included build script: " + theProperty)
"""
def createBuild = { String buildName, String dir ->
createDir(dir) {
file("gradle.properties") << """
theProperty=$buildName
"""
file("settings.gradle") << """
println("$buildName settings script: " + theProperty)
"""
file("build.gradle") << """
println("$buildName build script: " + theProperty)
"""
}
}
file("gradle.properties") << """
theProperty=root
"""

createBuild "root", "."
settingsFile << """
includeBuild 'included'
println("root settings script: " + theProperty)
"""
buildFile << """
println("root build script: " + theProperty)

createBuild "included", "included"
file("included/settings.gradle") << """
includeBuild '../nested'
"""

createBuild "nested", "nested"

when:
run('help')

Expand All @@ -55,5 +59,7 @@ class CompositeBuildPropertiesIntegrationTest extends AbstractIntegrationSpec {
outputContains("root build script: root")
outputContains("included settings script: included")
outputContains("included build script: included")
outputContains("nested settings script: nested")
outputContains("nested build script: nested")
}
}

0 comments on commit 240051f

Please sign in to comment.