Skip to content

Commit

Permalink
Finalize java-versions extension values on read (#2107)
Browse files Browse the repository at this point in the history
Finalize java-versions extension values on read to prevent changes due to interactions from other plugins
  • Loading branch information
carterkozak authored Mar 8, 2022
1 parent ec73c3b commit 92ac2e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-2107.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: improvement
improvement:
description: Finalize java-versions extension values on read to prevent changes
due to interactions from other plugins
links:
- https://github.com/palantir/gradle-baseline/pull/2107
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public BaselineJavaVersionExtension(Project project) {
target = project.getObjects().property(JavaLanguageVersion.class);
runtime = project.getObjects().property(JavaLanguageVersion.class);
overrideLibraryAutoDetection = project.getObjects().property(Boolean.class);
target.finalizeValueOnRead();
runtime.finalizeValueOnRead();
overrideLibraryAutoDetection.finalizeValueOnRead();
}

/** Target {@link JavaLanguageVersion} for compilation. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public BaselineJavaVersionsExtension(Project project) {
distributionTarget.convention(libraryTarget);
// runtime defaults to the distribution value
runtime.convention(distributionTarget);
libraryTarget.finalizeValueOnRead();
distributionTarget.finalizeValueOnRead();
runtime.finalizeValueOnRead();
}

/** Target {@link JavaLanguageVersion} for compilation of libraries that are published. */
Expand Down

0 comments on commit 92ac2e8

Please sign in to comment.