@@ -10,11 +10,15 @@ initscript {
10
10
return
11
11
}
12
12
13
+ // the way this closure reads system properties means they are not tracked as inputs to the configuration cache model,
14
+ // the same is the case when reading environment variables with Gradle [6.5, 7.3]
13
15
def getInputParam = { String name ->
14
16
def envVarName = name. toUpperCase(). replace(' .' , ' _' ). replace(' -' , ' _' )
15
17
return gradle. startParameter. systemPropertiesArgs[name] ?: System . getenv(envVarName)
16
18
}
17
19
20
+ // the following local variables do not change between the build invocations of the same experiment run
21
+ // thus, reading their values in way that the configuration cache does not track them is acceptable
18
22
def pluginRepositoryUrl = getInputParam(' com.gradle.enterprise.build-validation.gradle.plugin-repository.url' )
19
23
def gePluginVersion = getInputParam(' com.gradle.enterprise.build-validation.gradle-enterprise.plugin.version' )
20
24
def ccudPluginVersion = getInputParam(' com.gradle.enterprise.build-validation.ccud.plugin.version' )
@@ -59,11 +63,15 @@ if (!isTopLevelBuild) {
59
63
return
60
64
}
61
65
66
+ // the way this closure reads system properties means they are not tracked as inputs to the configuration cache model,
67
+ // the same is the case when reading environment variables with Gradle [6.5, 7.3]
62
68
def getInputParam = { String name ->
63
69
def envVarName = name. toUpperCase(). replace(' .' , ' _' ). replace(' -' , ' _' )
64
70
return gradle. startParameter. systemPropertiesArgs[name] ?: System . getenv(envVarName)
65
71
}
66
72
73
+ // the following local variables do not change between the build invocations of the same experiment run
74
+ // thus, reading their values in way that the configuration cache does not track them is acceptable
67
75
def geUrl = getInputParam(' com.gradle.enterprise.build-validation.gradle-enterprise.url' )
68
76
def geAllowUntrustedServer = Boolean . parseBoolean(getInputParam(' com.gradle.enterprise.build-validation.gradle-enterprise.allow-untrusted-server' ))
69
77
def gePluginVersion = getInputParam(' com.gradle.enterprise.build-validation.gradle-enterprise.plugin.version' )
@@ -86,11 +94,15 @@ if (ccudPluginVersion && isNotAtLeast(ccudPluginVersion, '1.7')) {
86
94
def registerBuildScanActions = { def buildScan ->
87
95
def scanFile = new File (expDir, ' build-scans.csv' )
88
96
buildScan. buildScanPublished { publishedBuildScan ->
89
- def getInputParamCompatibleWithCC = { String name ->
97
+ // defer reading the `runNum` system property until execution time since it does not affect
98
+ // the configuration of the build, and given its value changes between consecutive build invocations
99
+ // it would always invalidate the configuration cache model from the first build invocation
100
+ // in the second build invocation
101
+ def getRunNumInputParam = { String name ->
90
102
def envVarName = name. toUpperCase(). replace(' .' , ' _' ). replace(' -' , ' _' )
91
103
return System . getProperty(name) ?: System . getenv(envVarName)
92
104
}
93
- def runNum = getInputParamCompatibleWithCC (' com.gradle.enterprise.build-validation.runNum' )
105
+ def runNum = getRunNumInputParam (' com.gradle.enterprise.build-validation.runNum' )
94
106
def buildScanUri = publishedBuildScan. buildScanUri
95
107
def buildScanId = publishedBuildScan. buildScanId
96
108
def port = (buildScanUri. port != -1 ) ? ' :' + buildScanUri. port : ' '
0 commit comments