Skip to content

Commit

Permalink
Revert #2368 (Workaround to IDEA-301084) (#2369)
Browse files Browse the repository at this point in the history
Revert #2368 (Workaround to IDEA-301084)
  • Loading branch information
iamdanfox authored Sep 2, 2022
1 parent 8281110 commit 59a8771
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
6 changes: 6 additions & 0 deletions changelog/@unreleased/pr-2369.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: fix
fix:
description: Reverts a change introduced to baseline-java-version 4.160.0, which
was causing failures on multi-project builds.
links:
- https://github.com/palantir/gradle-baseline/pull/2369
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.gradle.api.tasks.JavaExec;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.api.tasks.compile.CompileOptions;
import org.gradle.api.tasks.compile.GroovyCompile;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc;
Expand Down Expand Up @@ -101,7 +100,6 @@ public void execute(JavaCompile javaCompileTask) {
.getOptions()
.getCompilerArgumentProviders()
.add(new EnablePreviewArgumentProvider(target));
hackTryToMakePreviewFeaturesWorkInIntellij(target, javaCompileTask.getOptions());

// Set sourceCompatibility to opt out of '-release', allowing opens/exports to be used.
javaCompileTask.doFirst(new Action<Task>() {
Expand Down Expand Up @@ -269,21 +267,6 @@ public final void checkJavaVersions() {
}
}

/**
* <a href="https://github.com/JetBrains/intellij-community/pull/2135">Further details available here.</a>
* This is not guaranteed to work - there's a race that depends on plugin application vs when the javaVersions
* closer is applied. However, based on the root project being configured before subprojects, this will likely
* catch practical occurrences.
* An artifact of this is that compile tasks will get _two_ --enable-preview flags set, although this is
* semantically meaningless.
*/
private static void hackTryToMakePreviewFeaturesWorkInIntellij(
Provider<ChosenJavaVersion> provider, CompileOptions compileOptions) {
if (provider.get().enablePreview()) {
compileOptions.getCompilerArgs().add(EnablePreviewArgumentProvider.FLAG);
}
}

private static class EnablePreviewArgumentProvider implements CommandLineArgumentProvider {

public static final String FLAG = "--enable-preview";
Expand Down

0 comments on commit 59a8771

Please sign in to comment.