Search in sources :

Example 6 with AnnotationProcessorDeclaration

use of org.gradle.api.internal.tasks.compile.processing.AnnotationProcessorDeclaration in project gradle by gradle.

the class IncrementalAnnotationProcessingCompileTask method setupProcessors.

private void setupProcessors() {
    processorClassloader = new URLClassLoader(DefaultClassPath.of(annotationProcessorPath).getAsURLArray());
    List<Processor> processors = new ArrayList<Processor>(processorDeclarations.size());
    for (AnnotationProcessorDeclaration declaredProcessor : processorDeclarations) {
        try {
            Class<?> processorClass = processorClassloader.loadClass(declaredProcessor.getClassName());
            Processor processor = (Processor) processorClass.newInstance();
            processor = decorateIfIncremental(processor, declaredProcessor.getType());
            processors.add(processor);
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }
    }
    delegate.setProcessors(processors);
}
Also used : IsolatingProcessor(org.gradle.api.internal.tasks.compile.processing.IsolatingProcessor) Processor(javax.annotation.processing.Processor) AggregatingProcessor(org.gradle.api.internal.tasks.compile.processing.AggregatingProcessor) URLClassLoader(java.net.URLClassLoader) ArrayList(java.util.ArrayList) AnnotationProcessorDeclaration(org.gradle.api.internal.tasks.compile.processing.AnnotationProcessorDeclaration)

Aggregations

AnnotationProcessorDeclaration (org.gradle.api.internal.tasks.compile.processing.AnnotationProcessorDeclaration)6 URLClassLoader (java.net.URLClassLoader)1 ArrayList (java.util.ArrayList)1 Processor (javax.annotation.processing.Processor)1 JavaCompiler (javax.tools.JavaCompiler)1 StandardJavaFileManager (javax.tools.StandardJavaFileManager)1 ClassSetAnalysis (org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis)1 ClassSetAnalysisData (org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysisData)1 PreviousCompilation (org.gradle.api.internal.tasks.compile.incremental.jar.PreviousCompilation)1 AggregatingProcessor (org.gradle.api.internal.tasks.compile.processing.AggregatingProcessor)1 IsolatingProcessor (org.gradle.api.internal.tasks.compile.processing.IsolatingProcessor)1