From 11c74eaa4efa76fdca3cb27c23248ea86a35675c Mon Sep 17 00:00:00 2001 From: weisj Date: Sun, 25 Oct 2020 21:15:09 +0100 Subject: [PATCH] Make SynthesiseLafProcessor incremental. --- ...fProcessor.java => SynthesiseLafProcessor.java} | 14 ++++++++++---- .../gradle/incremental.annotation.processors | 1 + .../services/javax.annotation.processing.Processor | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) rename annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/{SynthesisesLafProcessor.java => SynthesiseLafProcessor.java} (89%) create mode 100644 annotations-processor/src/main/resources/META-INF/gradle/incremental.annotation.processors diff --git a/annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesisesLafProcessor.java b/annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesiseLafProcessor.java similarity index 89% rename from annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesisesLafProcessor.java rename to annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesiseLafProcessor.java index b74b52d2..1f49883f 100644 --- a/annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesisesLafProcessor.java +++ b/annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesiseLafProcessor.java @@ -27,7 +27,9 @@ import java.util.Collection; import java.util.List; import java.util.Set; -import javax.annotation.processing.*; +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; @@ -37,8 +39,7 @@ import javax.tools.JavaFileObject; import com.github.weisj.darklaf.annotations.SynthesiseLaf; @SupportedAnnotationTypes("com.github.weisj.darklaf.annotations.SynthesiseLaf") -@SupportedSourceVersion(SourceVersion.RELEASE_8) -public class SynthesisesLafProcessor extends AbstractProcessor { +public class SynthesiseLafProcessor extends AbstractProcessor { private static final String IDENT = " "; @@ -63,7 +64,7 @@ public class SynthesisesLafProcessor extends AbstractProcessor { .append("());\n").append(IDENT).append("}\n").append("}"); try { - JavaFileObject javaFileObject = processingEnv.getFiler().createSourceFile(synthesisedName); + JavaFileObject javaFileObject = processingEnv.getFiler().createSourceFile(synthesisedName, typeElement); Writer writer = javaFileObject.openWriter(); writer.write(builder.toString()); writer.close(); @@ -73,4 +74,9 @@ public class SynthesisesLafProcessor extends AbstractProcessor { } return false; } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latestSupported(); + } } diff --git a/annotations-processor/src/main/resources/META-INF/gradle/incremental.annotation.processors b/annotations-processor/src/main/resources/META-INF/gradle/incremental.annotation.processors new file mode 100644 index 00000000..574fc749 --- /dev/null +++ b/annotations-processor/src/main/resources/META-INF/gradle/incremental.annotation.processors @@ -0,0 +1 @@ +com.github.weisj.darklaf.annotations.processor.SynthesiseLafProcessor,ISOLATING diff --git a/annotations-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/annotations-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor index e2106102..464e923f 100644 --- a/annotations-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor +++ b/annotations-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor @@ -1 +1 @@ -com.github.weisj.darklaf.annotations.processor.SynthesisesLafProcessor +com.github.weisj.darklaf.annotations.processor.SynthesiseLafProcessor