diff --git a/changelog/@unreleased/pr-694.v2.yml b/changelog/@unreleased/pr-694.v2.yml new file mode 100644 index 000000000..d2680fd99 --- /dev/null +++ b/changelog/@unreleased/pr-694.v2.yml @@ -0,0 +1,7 @@ +type: improvement +improvement: + description: | + Don't cache test tasks in the build cache by default. + It's possible to restore caching by adding `com.palantir.baseline.restore-test-cache = true` to your `gradle.properties`. + links: + - https://github.com/palantir/gradle-baseline/pull/694 diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineTesting.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineTesting.java index 7601a6583..ea1117c5d 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineTesting.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/BaselineTesting.java @@ -30,8 +30,13 @@ public final class BaselineTesting implements Plugin { @Override public void apply(Project project) { - project.getTasks().withType(Test.class).all(task -> { + project.getTasks().withType(Test.class).configureEach(task -> { task.jvmArgs("-XX:+HeapDumpOnOutOfMemoryError", "-XX:+CrashOnOutOfMemoryError"); + + if (!Objects.equals("true", project.findProperty("com.palantir.baseline.restore-test-cache"))) { + // Never cache test tasks, until we work out the correct inputs for ETE / integration tests + task.getOutputs().cacheIf(t -> false); + } }); project.getPlugins().withType(JavaPlugin.class, p -> {