use of org.gradle.api.internal.tasks.compile.incremental.recomp.RecompilationSpec in project gradle by gradle.
the class RecompilationSpecProvider method provideRecompilationSpec.
public RecompilationSpec provideRecompilationSpec(IncrementalTaskInputs inputs, PreviousCompilation previousCompilation, JarClasspathSnapshot jarClasspathSnapshot) {
//creating an action that will be executed against all changes
RecompilationSpec spec = new RecompilationSpec();
JavaChangeProcessor javaChangeProcessor = new JavaChangeProcessor(previousCompilation, sourceToNameConverter);
ClassChangeProcessor classChangeProcessor = new ClassChangeProcessor(previousCompilation);
JarChangeProcessor jarChangeProcessor = new JarChangeProcessor(fileOperations, jarClasspathSnapshot, previousCompilation);
InputChangeAction action = new InputChangeAction(spec, javaChangeProcessor, classChangeProcessor, jarChangeProcessor);
//go!
inputs.outOfDate(action);
if (action.spec.getFullRebuildCause() != null) {
//short circuit in case we already know that that full rebuild is needed
return action.spec;
}
inputs.removed(action);
return action.spec;
}
use of org.gradle.api.internal.tasks.compile.incremental.recomp.RecompilationSpec in project gradle by gradle.
the class RecompilationSpecProvider method provideRecompilationSpec.
public RecompilationSpec provideRecompilationSpec(CurrentCompilation current, PreviousCompilation previous) {
RecompilationSpec spec = new RecompilationSpec();
processJarClasspathChanges(current, previous, spec);
processOtherChanges(current, previous, spec);
spec.getClassesToProcess().addAll(previous.getAggregatedTypes().getDependentClasses());
return spec;
}
use of org.gradle.api.internal.tasks.compile.incremental.recomp.RecompilationSpec in project gradle by gradle.
the class SelectiveCompiler method execute.
@Override
public WorkResult execute(JavaCompileSpec spec) {
Timer clock = Time.startTimer();
CurrentCompilation currentCompilation = new CurrentCompilation(inputs, spec, jarClasspathSnapshotProvider);
RecompilationSpec recompilationSpec = recompilationSpecProvider.provideRecompilationSpec(currentCompilation, previousCompilation);
if (recompilationSpec.isFullRebuildNeeded()) {
LOG.info("Full recompilation is required because {}. Analysis took {}.", recompilationSpec.getFullRebuildCause(), clock.getElapsed());
return cleaningCompiler.execute(spec);
}
incrementalCompilationInitilizer.initializeCompilation(spec, recompilationSpec);
if (spec.getSource().isEmpty() && spec.getClasses().isEmpty()) {
LOG.info("None of the classes needs to be compiled! Analysis took {}. ", clock.getElapsed());
return new RecompilationNotNecessary();
}
try {
return cleaningCompiler.getCompiler().execute(spec);
} finally {
Collection<String> classesToCompile = recompilationSpec.getClassesToCompile();
LOG.info("Incremental compilation of {} classes completed in {}.", classesToCompile.size(), clock.getElapsed());
LOG.debug("Recompiled classes {}", classesToCompile);
}
}
Aggregations