[Build] randomizedtesting: Allow property values to be closures (#34319)

Makes it easier to have property values that are evaluated at build time
rather than configuration time in a Gradle idiomatic way.
This commit is contained in:
Alpar Torok 2018-10-05 18:57:23 +03:00 committed by GitHub
parent 6f5daadb3c
commit c031322c18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,7 +264,11 @@ class RandomizedTestingTask extends DefaultTask {
throw new InvalidUserDataException('Seed should be ' +
'set on the project instead of a system property')
}
sysproperty key: prop.getKey(), value: prop.getValue().toString()
if (prop.getValue() instanceof Closure) {
sysproperty key: prop.getKey(), value: (prop.getValue() as Closure).call().toString()
} else {
sysproperty key: prop.getKey(), value: prop.getValue().toString()
}
}
systemProperty 'tests.seed', project.testSeed
for (Map.Entry<String, Object> envvar : environmentVariables) {