Test config-cache support for multiple builds in one job

This commit is contained in:
Daz DeBoer 2021-12-07 13:26:16 -07:00
parent 887e1a09ab
commit 69aad1f173
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
2 changed files with 37 additions and 1 deletions

View file

@ -16,3 +16,15 @@ dependencies {
tasks.test {
useJUnitPlatform()
}
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")
}
doLast {
if (System.getProperties().containsKey("verifyCachedBuild")) {
throw RuntimeException("Build was not cached: unexpected execution of test task")
}
}
}