use of org.gradle.api.internal.tasks.compile.incremental.processing.AnnotationProcessingData 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");
}
use of org.gradle.api.internal.tasks.compile.incremental.processing.AnnotationProcessingData in project gradle by gradle.
the class IncrementalResultStoringCompiler method storeResult.
private void storeResult(JavaCompileSpec spec, WorkResult result) {
ClassSetAnalysisData outputSnapshot = classpathSnapshotter.analyzeOutputFolder(spec.getDestinationDir());
ClassSetAnalysisData classpathSnapshot = classpathSnapshotter.getClasspathSnapshot(Iterables.concat(spec.getCompileClasspath(), spec.getModulePath()));
AnnotationProcessingData annotationProcessingData = getAnnotationProcessingData(spec, result);
CompilerApiData compilerApiData = getCompilerApiData(spec, result);
ClassSetAnalysisData minimizedClasspathSnapshot = classpathSnapshot.reduceToTypesAffecting(outputSnapshot, compilerApiData);
PreviousCompilationData data = new PreviousCompilationData(outputSnapshot, annotationProcessingData, minimizedClasspathSnapshot, compilerApiData);
File previousCompilationDataFile = Objects.requireNonNull(spec.getCompileOptions().getPreviousCompilationDataFile());
previousCompilationAccess.writePreviousCompilationData(data, previousCompilationDataFile);
}
Aggregations