mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-09-15 04:02:21 +08:00
Fix check for config-cache usage
Now that environment variable reads are auto-detected by Gradle 7.4, we need a different mechanism to check that the configuration cache is being used successfully.
This commit is contained in:
@@ -11,10 +11,9 @@ dependencies {
|
||||
}
|
||||
|
||||
tasks.named("test").configure {
|
||||
// Use an environment variable to bypass config-cache checks
|
||||
if (System.getenv('VERIFY_CACHED_CONFIGURATION') != null) {
|
||||
throw new RuntimeException("Configuration was not cached: unexpected configuration of test task")
|
||||
}
|
||||
// Echo an output value so we can detect configuration-cache usage
|
||||
println "::set-output name=task_configured::yes"
|
||||
|
||||
doLast {
|
||||
if (System.properties.verifyCachedBuild) {
|
||||
throw new RuntimeException("Build was not cached: unexpected execution of test task")
|
||||
|
@@ -18,10 +18,9 @@ tasks.test {
|
||||
}
|
||||
|
||||
tasks.named("test").configure {
|
||||
// Use an environment variable to bypass config-cache checks
|
||||
if (System.getenv("VERIFY_CACHED_CONFIGURATION") != null) {
|
||||
throw RuntimeException("Configuration was not cached: unexpected configuration of test task")
|
||||
}
|
||||
// Echo an output value so we can detect configuration-cache usage
|
||||
println("::set-output name=task_configured::yes")
|
||||
|
||||
doLast {
|
||||
if (System.getProperties().containsKey("verifyCachedBuild")) {
|
||||
throw RuntimeException("Build was not cached: unexpected execution of test task")
|
||||
|
Reference in New Issue
Block a user