forked from projectlombok/lombok
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Project> { | ||
private static final List<String> 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<JavaCompile>() { | ||
public void execute(final JavaCompile compileJava) { | ||
compileJava.doFirst("Opens modules for lombok", new Action<Task>() { | ||
public void execute(Task t) { | ||
compileJava.getOptions().setFork(true); | ||
compileJava.getOptions().getForkOptions().getJvmArgs().addAll(OPENS); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} |