Search in sources :

Example 1 with AnnotationProcessingResult

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

the class ClassSetAnalysisUpdater method visitAnnotationProcessingResult.

private void visitAnnotationProcessingResult(JavaCompileSpec spec, WorkResult result, CompilationResultAnalyzer analyzer) {
    if (!spec.getEffectiveAnnotationProcessors().isEmpty()) {
        AnnotationProcessingResult annotationProcessingResult = null;
        if (result instanceof JdkJavaCompilerResult) {
            annotationProcessingResult = ((JdkJavaCompilerResult) result).getAnnotationProcessingResult();
        }
        analyzer.visitAnnotationProcessingResult(annotationProcessingResult);
    }
}
Also used : JdkJavaCompilerResult(org.gradle.api.internal.tasks.compile.JdkJavaCompilerResult) AnnotationProcessingResult(org.gradle.api.internal.tasks.compile.incremental.processing.AnnotationProcessingResult)

Example 2 with AnnotationProcessingResult

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

the class IncrementalResultStoringCompiler method getAnnotationProcessingData.

private AnnotationProcessingData getAnnotationProcessingData(JavaCompileSpec spec, WorkResult result) {
    Set<AnnotationProcessorDeclaration> processors = spec.getEffectiveAnnotationProcessors();
    if (processors.isEmpty()) {
        return new AnnotationProcessingData();
    }
    AnnotationProcessingData previousAnnotationProcessingData = null;
    RecompilationSpec recompilationSpec = null;
    if (result instanceof IncrementalCompilationResult) {
        previousAnnotationProcessingData = ((IncrementalCompilationResult) result).getPreviousCompilationData().getAnnotationProcessingData();
        recompilationSpec = ((IncrementalCompilationResult) result).getRecompilationSpec();
        result = ((IncrementalCompilationResult) result).getCompilerResult();
    }
    Set<String> changedClasses = recompilationSpec == null ? Collections.emptySet() : recompilationSpec.getClassesToCompile();
    if (result instanceof ApiCompilerResult) {
        AnnotationProcessingResult processingResult = ((ApiCompilerResult) result).getAnnotationProcessingResult();
        AnnotationProcessingData newAnnotationProcessingData = new AnnotationProcessingData(processingResult.getGeneratedTypesWithIsolatedOrigin(), processingResult.getAggregatedTypes(), processingResult.getGeneratedAggregatingTypes(), processingResult.getGeneratedResourcesWithIsolatedOrigin(), processingResult.getGeneratedAggregatingResources(), processingResult.getFullRebuildCause());
        if (previousAnnotationProcessingData == null) {
            return newAnnotationProcessingData;
        }
        return mergeAnnotationProcessingData(previousAnnotationProcessingData, newAnnotationProcessingData, changedClasses);
    }
    return new AnnotationProcessingData(ImmutableMap.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableMap.of(), ImmutableSet.of(), "the chosen compiler did not support incremental annotation processing");
}
Also used : AnnotationProcessingData(org.gradle.api.internal.tasks.compile.incremental.processing.AnnotationProcessingData) RecompilationSpec(org.gradle.api.internal.tasks.compile.incremental.recomp.RecompilationSpec) IncrementalCompilationResult(org.gradle.api.internal.tasks.compile.incremental.recomp.IncrementalCompilationResult) AnnotationProcessingResult(org.gradle.api.internal.tasks.compile.incremental.processing.AnnotationProcessingResult) ApiCompilerResult(org.gradle.api.internal.tasks.compile.ApiCompilerResult) AnnotationProcessorDeclaration(org.gradle.api.internal.tasks.compile.processing.AnnotationProcessorDeclaration)

Aggregations

AnnotationProcessingResult (org.gradle.api.internal.tasks.compile.incremental.processing.AnnotationProcessingResult)2 ApiCompilerResult (org.gradle.api.internal.tasks.compile.ApiCompilerResult)1 JdkJavaCompilerResult (org.gradle.api.internal.tasks.compile.JdkJavaCompilerResult)1 AnnotationProcessingData (org.gradle.api.internal.tasks.compile.incremental.processing.AnnotationProcessingData)1 IncrementalCompilationResult (org.gradle.api.internal.tasks.compile.incremental.recomp.IncrementalCompilationResult)1 RecompilationSpec (org.gradle.api.internal.tasks.compile.incremental.recomp.RecompilationSpec)1 AnnotationProcessorDeclaration (org.gradle.api.internal.tasks.compile.processing.AnnotationProcessorDeclaration)1