From 87baeb48179497a9fec382ca36d9c04dac7c6d38 Mon Sep 17 00:00:00 2001 From: Andrew Ash Date: Wed, 6 Mar 2024 22:28:03 -0800 Subject: [PATCH 1/2] Make checkJavaVersions task amenable to gradle8 configuration cache --- .../plugins/javaversions/BaselineJavaVersion.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/javaversions/BaselineJavaVersion.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/javaversions/BaselineJavaVersion.java index 673ea397b..cfdaf2fa4 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/javaversions/BaselineJavaVersion.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/javaversions/BaselineJavaVersion.java @@ -84,6 +84,7 @@ public void execute(JavaToolchainSpec javaToolchainSpec) { public void execute(CheckJavaVersionsTask task) { task.getTargetVersion().set(extension.target()); task.getRuntimeVersion().set(extension.runtime()); + task.getProjectDisplayName().set(project.getDisplayName()); } }); project.getTasks().named("check").configure(check -> check.dependsOn(checkJavaVersions)); @@ -218,6 +219,7 @@ public static class CheckJavaVersionsTask extends DefaultTask { private final Property targetVersion; private final Property runtimeVersion; + private final Property projectDisplayName; @Inject public CheckJavaVersionsTask() { @@ -226,6 +228,7 @@ public CheckJavaVersionsTask() { + "The runtime version must be greater than or equal to the target version."); targetVersion = getProject().getObjects().property(ChosenJavaVersion.class); runtimeVersion = getProject().getObjects().property(ChosenJavaVersion.class); + projectDisplayName = getProject().getObjects().property(String.class); } @Input @@ -238,6 +241,11 @@ public Property getRuntimeVersion() { return runtimeVersion; } + @Input + Property getProjectDisplayName() { + return projectDisplayName; + } + @TaskAction public final void checkJavaVersions() { ChosenJavaVersion target = getTargetVersion().get(); @@ -245,7 +253,7 @@ public final void checkJavaVersions() { getLogger() .debug( "BaselineJavaVersion configured project {} with target version {} and runtime version {}", - getProject(), + projectDisplayName, target, runtime); From d9df3615ac39a922324d89f8bbc4be984f2762fa Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Thu, 7 Mar 2024 06:33:57 +0000 Subject: [PATCH 2/2] Add generated changelog entries --- changelog/@unreleased/pr-2739.v2.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/@unreleased/pr-2739.v2.yml diff --git a/changelog/@unreleased/pr-2739.v2.yml b/changelog/@unreleased/pr-2739.v2.yml new file mode 100644 index 000000000..1c31ba333 --- /dev/null +++ b/changelog/@unreleased/pr-2739.v2.yml @@ -0,0 +1,6 @@ +type: fix +fix: + description: Make checkJavaVersions task more amenable to gradle8 configuration + cache + links: + - https://github.com/palantir/gradle-baseline/pull/2739