Java Code Examples for org.gradle.api.tasks.incremental.IncrementalTaskInputs#isIncremental()
The following examples show how to use
org.gradle.api.tasks.incremental.IncrementalTaskInputs#isIncremental() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IncrementalCompilerDecorator.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private Compiler<JavaCompileSpec> getCompiler(IncrementalTaskInputs inputs, CompilationSourceDirs sourceDirs) { if (!inputs.isIncremental()) { LOG.lifecycle("{} - is not incremental (e.g. outputs have changed, no previous execution, etc.).", displayName); return cleaningCompiler; } if (!sourceDirs.areSourceDirsKnown()) { LOG.lifecycle("{} - is not incremental. Unable to infer the source directories.", displayName); return cleaningCompiler; } ClassSetAnalysisData data = compileCaches.getLocalClassSetAnalysisStore().get(); if (data == null) { LOG.lifecycle("{} - is not incremental. No class analysis data available from the previous build.", displayName); return cleaningCompiler; } PreviousCompilation previousCompilation = new PreviousCompilation(new ClassSetAnalysis(data), compileCaches.getLocalJarClasspathSnapshotStore(), compileCaches.getJarSnapshotCache()); return new SelectiveCompiler(inputs, previousCompilation, cleaningCompiler, staleClassDetecter, compilationInitializer, jarClasspathSnapshotMaker); }
Example 2
Source File: IncrementalCompilerDecorator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private Compiler<JavaCompileSpec> getCompiler(IncrementalTaskInputs inputs, CompilationSourceDirs sourceDirs) { if (!inputs.isIncremental()) { LOG.lifecycle("{} - is not incremental (e.g. outputs have changed, no previous execution, etc.).", displayName); return cleaningCompiler; } if (!sourceDirs.areSourceDirsKnown()) { LOG.lifecycle("{} - is not incremental. Unable to infer the source directories.", displayName); return cleaningCompiler; } ClassSetAnalysisData data = compileCaches.getLocalClassSetAnalysisStore().get(); if (data == null) { LOG.lifecycle("{} - is not incremental. No class analysis data available from the previous build.", displayName); return cleaningCompiler; } PreviousCompilation previousCompilation = new PreviousCompilation(new ClassSetAnalysis(data), compileCaches.getLocalJarClasspathSnapshotStore(), compileCaches.getJarSnapshotCache()); return new SelectiveCompiler(inputs, previousCompilation, cleaningCompiler, staleClassDetecter, compilationInitializer, jarClasspathSnapshotMaker); }
Example 3
Source File: CreateOrmLiteConfigTask.java From ormlite-android-gradle-plugin with Apache License 2.0 | 6 votes |
@TaskAction protected void exec(IncrementalTaskInputs inputs) throws IOException, SQLException, InterruptedException { if (!inputs.isIncremental()) { getProject().delete(getOutputFile()); } final Set<String> lastFilesInState = loadFileNames(); final Set<String> newFilesInState = new HashSet<>(lastFilesInState); if (!hasNewState(inputs, lastFilesInState, newFilesInState)) { return; } saveFileNames(newFilesInState); final CreateOrmLiteConfigAction createOrmLiteConfigAction = new CreateOrmLiteConfigAction(configFileName, getProject().file(sourceDir), classpath.getAsPath(), getLogger()); createOrmLiteConfigAction.execute(); this.setDidWork(true); }
Example 4
Source File: Compile.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean maybeCompileIncrementally(IncrementalTaskInputs inputs) { if (!compileOptions.isIncremental()) { return false; } //hack List<File> sourceDirs = getSourceDirs(); if (sourceDirs.isEmpty()) { LOG.lifecycle("{} cannot run incrementally because Gradle cannot infer the source directories.", getPath()); return false; } if (!inputs.isIncremental()) { LOG.lifecycle("{} is not incremental (e.g. outputs have changed, no previous execution, etc). Using regular compile.", getPath()); return false; } ClassDependencyInfoSerializer dependencyInfoSerializer = getDependencyInfoSerializer(); if (!dependencyInfoSerializer.isInfoAvailable()) { //TODO SF let's unit test a scenario when after regular compilation incremental compilation is scheduled LOG.lifecycle("{} is not incremental because there is no class dependency data left from previous incremental build.", getPath()); return false; } SingleMessageLogger.incubatingFeatureUsed("Incremental java compilation"); SelectiveJavaCompiler compiler = new SelectiveJavaCompiler(javaCompiler, getProject().fileTree(getDestinationDir())); SelectiveCompilation selectiveCompilation = new SelectiveCompilation(inputs, getSource(), getClasspath(), getDestinationDir(), dependencyInfoSerializer, getJarSnapshotCache(), compiler, sourceDirs, (FileOperations) getProject()); if (!selectiveCompilation.getCompilationNeeded()) { LOG.lifecycle("{} does not require recompilation. Skipping the compiler.", getPath()); return true; } Clock clock = new Clock(); performCompilation(selectiveCompilation.getSource(), selectiveCompilation.getClasspath(), selectiveCompilation.getFullRebuildRequired()? cleaningCompiler : compiler); LOG.lifecycle("{} - incremental compilation took {}", getPath(), clock.getTime()); return true; }
Example 5
Source File: Compile.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean maybeCompileIncrementally(IncrementalTaskInputs inputs) { if (!compileOptions.isIncremental()) { return false; } //hack List<File> sourceDirs = getSourceDirs(); if (sourceDirs.isEmpty()) { LOG.lifecycle("{} cannot run incrementally because Gradle cannot infer the source directories.", getPath()); return false; } if (!inputs.isIncremental()) { LOG.lifecycle("{} is not incremental (e.g. outputs have changed, no previous execution, etc). Using regular compile.", getPath()); return false; } ClassDependencyInfoSerializer dependencyInfoSerializer = getDependencyInfoSerializer(); if (!dependencyInfoSerializer.isInfoAvailable()) { //TODO SF let's unit test a scenario when after regular compilation incremental compilation is scheduled LOG.lifecycle("{} is not incremental because there is no class dependency data left from previous incremental build.", getPath()); return false; } SingleMessageLogger.incubatingFeatureUsed("Incremental java compilation"); SelectiveJavaCompiler compiler = new SelectiveJavaCompiler(javaCompiler, getProject().fileTree(getDestinationDir())); SelectiveCompilation selectiveCompilation = new SelectiveCompilation(inputs, getSource(), getClasspath(), getDestinationDir(), dependencyInfoSerializer, getJarSnapshotCache(), compiler, sourceDirs, (FileOperations) getProject()); if (!selectiveCompilation.getCompilationNeeded()) { LOG.lifecycle("{} does not require recompilation. Skipping the compiler.", getPath()); return true; } Clock clock = new Clock(); performCompilation(selectiveCompilation.getSource(), selectiveCompilation.getClasspath(), selectiveCompilation.getFullRebuildRequired()? cleaningCompiler : compiler); LOG.lifecycle("{} - incremental compilation took {}", getPath(), clock.getTime()); return true; }
Example 6
Source File: Dex.java From atlas with Apache License 2.0 | 4 votes |
/** * Actual entry point for the action. * Calls out to the doTaskAction as needed. */ @TaskAction public void taskAction(IncrementalTaskInputs inputs) throws IOException, InterruptedException, ProcessException { Collection<File> _inputFiles = getInputFiles(); File _inputDir = getInputDir(); if (_inputFiles == null && _inputDir == null) { throw new RuntimeException("Dex task \'" + getName() + ": inputDir and inputFiles cannot both be null"); } if (!dexOptions.getIncremental() || !enableIncremental) { doTaskAction(_inputFiles, _inputDir, false); return; } if (!inputs.isIncremental()) { getProject().getLogger().info("Unable to do incremental execution: full task run."); doTaskAction(_inputFiles, _inputDir, false); return; } final AtomicBoolean forceFullRun = new AtomicBoolean(); //noinspection GroovyAssignabilityCheck inputs.outOfDate(new Action<InputFileDetails>() { @Override public void execute(InputFileDetails change) { // force full dx run if existing jar file is modified // New jar files are fine. if (((InputFileDetails)change).isModified() && ((InputFileDetails)change).getFile().getPath().endsWith( SdkConstants.DOT_JAR)) { getProject().getLogger().info( "Force full dx run: Found updated " + String.valueOf(((InputFileDetails)change).getFile())); forceFullRun.set(true); } } }); //noinspection GroovyAssignabilityCheck inputs.removed(change -> { // force full dx run if existing jar file is removed if (((InputFileDetails)change).getFile().getPath().endsWith(SdkConstants.DOT_JAR)) { getProject().getLogger().info( "Force full dx run: Found removed " + String.valueOf(((InputFileDetails)change).getFile())); forceFullRun.set(true); } }); doTaskAction(_inputFiles, _inputDir, !forceFullRun.get()); }