Browse Source

Make SynthesiseLafProcessor incremental.

pull/214/head
weisj 4 years ago
parent
commit
11c74eaa4e
  1. 14
      annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesiseLafProcessor.java
  2. 1
      annotations-processor/src/main/resources/META-INF/gradle/incremental.annotation.processors
  3. 2
      annotations-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor

14
annotations-processor/src/main/java/com/github/weisj/darklaf/annotations/processor/SynthesisesLafProcessor.java → 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();
}
}

1
annotations-processor/src/main/resources/META-INF/gradle/incremental.annotation.processors

@ -0,0 +1 @@
com.github.weisj.darklaf.annotations.processor.SynthesiseLafProcessor,ISOLATING

2
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

Loading…
Cancel
Save