Skip to content

Commit

Permalink
Fix BaselineModuleJvmArgs with enable-preview functionality (#2336)
Browse files Browse the repository at this point in the history
Fix the `BaselineModuleJvmArgs` plugin to once again work as intended in multi-project builds
  • Loading branch information
iamdanfox authored Jul 29, 2022
1 parent ef871ad commit 7944f5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-2336.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: fix
fix:
description: Fix the `BaselineModuleJvmArgs` plugin to once again work as intended
in multi-project builds
links:
- https://github.com/palantir/gradle-baseline/pull/2336
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.common.collect.ImmutableMap;
import com.palantir.baseline.extensions.BaselineModuleJvmArgsExtension;
import com.palantir.baseline.plugins.javaversions.BaselineJavaVersion;
import com.palantir.baseline.plugins.javaversions.BaselineJavaVersionsExtension;
import com.palantir.baseline.plugins.javaversions.BaselineJavaVersionExtension;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -225,8 +225,8 @@ public Iterable<String> asArguments() {

// Derive this plugin's `enablePreview` property from BaselineJavaVersion's extension
project.getPlugins().withType(BaselineJavaVersion.class, _unused -> {
BaselineJavaVersionsExtension javaVersionsExtension =
project.getExtensions().getByType(BaselineJavaVersionsExtension.class);
BaselineJavaVersionExtension javaVersionsExtension =
project.getExtensions().getByType(BaselineJavaVersionExtension.class);
extension.setEnablePreview(javaVersionsExtension.runtime().map(chosenJavaVersion -> {
return chosenJavaVersion.enablePreview()
? Optional.of(chosenJavaVersion.javaLanguageVersion())
Expand Down

0 comments on commit 7944f5b

Please sign in to comment.