1
1
import org.gradle.util.GradleVersion
2
2
import java.nio.charset.StandardCharsets
3
3
4
- def getInputParam = { String name ->
4
+ static getInputParam ( String name ) {
5
5
def ENV_VAR_PREFIX = ' '
6
6
def envVarName = ENV_VAR_PREFIX + name. toUpperCase(). replace(' .' , ' _' ). replace(' -' , ' _' )
7
- return gradle . startParameter . systemPropertiesArgs[ name] ?: System . getenv(envVarName)
7
+ return System . getProperty( name) ?: System . getenv(envVarName)
8
8
}
9
9
10
10
def isTopLevelBuild = ! gradle. parent
@@ -31,16 +31,12 @@ def registerBuildScanActions = { def buildScan, def rootProjectName ->
31
31
// the configuration of the build, and given its value changes between consecutive build invocations
32
32
// it would always invalidate the configuration cache model from the first build invocation
33
33
// in the second build invocation
34
- //
35
- // System.getProperty can be used here because system properties can be read at *execution* time
36
- // safely for Gradle 7.0.2 and earlier, and we must do so anyway because referencing a Gradle
37
- // script object, e.g., 'gradle.startParameter', from a Groovy closure is not compatible with
38
- // configuration cache
39
- def getRunNumInputParam = { String name ->
40
- def envVarName = name. toUpperCase(). replace(' .' , ' _' ). replace(' -' , ' _' )
34
+ def getInputParam = { String name ->
35
+ def ENV_VAR_PREFIX = ' '
36
+ def envVarName = ENV_VAR_PREFIX + name. toUpperCase(). replace(' .' , ' _' ). replace(' -' , ' _' )
41
37
return System . getProperty(name) ?: System . getenv(envVarName)
42
38
}
43
- def runNum = getRunNumInputParam (' develocity.build-validation.runNum' )
39
+ def runNum = getInputParam (' develocity.build-validation.runNum' )
44
40
def buildScanUri = publishedBuildScan. buildScanUri
45
41
def buildScanId = publishedBuildScan. buildScanId
46
42
def port = (buildScanUri. port != -1 ) ? ' :' + buildScanUri. port : ' '
0 commit comments