diff --git a/buildScripts/compile.ant.xml b/buildScripts/compile.ant.xml index bfe0617940..fff9c5b8a9 100644 --- a/buildScripts/compile.ant.xml +++ b/buildScripts/compile.ant.xml @@ -181,6 +181,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil + @@ -209,6 +210,13 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil + + + + + + + @@ -259,6 +267,8 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating ]]> + + implementation-class=lombok.gradleplugin.LombokPlugin @@ -300,6 +310,7 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating + diff --git a/buildScripts/create-eclipse-project.ant.xml b/buildScripts/create-eclipse-project.ant.xml index 0a0c759aa8..20ce0c2485 100644 --- a/buildScripts/create-eclipse-project.ant.xml +++ b/buildScripts/create-eclipse-project.ant.xml @@ -35,6 +35,7 @@ This buildfile is part of projectlombok.org. It creates the infrastructure neede + @@ -54,6 +55,7 @@ This buildfile is part of projectlombok.org. It creates the infrastructure neede + diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml index b4a8918c2b..5d3e01df48 100644 --- a/buildScripts/ivy.xml +++ b/buildScripts/ivy.xml @@ -18,6 +18,7 @@ + @@ -45,6 +46,7 @@ + diff --git a/buildScripts/setup.ant.xml b/buildScripts/setup.ant.xml index f203a91123..d30ff95bf5 100644 --- a/buildScripts/setup.ant.xml +++ b/buildScripts/setup.ant.xml @@ -314,7 +314,7 @@ This buildfile is part of projectlombok.org. It sets up the build itself. - + @@ -322,6 +322,7 @@ This buildfile is part of projectlombok.org. It sets up the build itself. + diff --git a/src/gradle-plugin/lombok/gradleplugin/LombokPlugin.java b/src/gradle-plugin/lombok/gradleplugin/LombokPlugin.java new file mode 100644 index 0000000000..c7a0df7c7f --- /dev/null +++ b/src/gradle-plugin/lombok/gradleplugin/LombokPlugin.java @@ -0,0 +1,37 @@ +package lombok.gradleplugin; + +import java.util.Arrays; +import java.util.List; + +import org.gradle.api.Action; +import org.gradle.api.Plugin; +import org.gradle.api.Project; +import org.gradle.api.Task; +import org.gradle.api.tasks.compile.JavaCompile; + +public class LombokPlugin implements Plugin { + private static final List OPENS = Arrays.asList( + "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", + "--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" + ); + + public void apply(Project target) { + target.getTasks().withType(JavaCompile.class).configureEach(new Action() { + public void execute(final JavaCompile compileJava) { + compileJava.doFirst("Opens modules for lombok", new Action() { + public void execute(Task t) { + compileJava.getOptions().setFork(true); + compileJava.getOptions().getForkOptions().getJvmArgs().addAll(OPENS); + } + }); + } + }); + } +} \ No newline at end of file