本文整理汇总了Java中org.gradle.api.tasks.incremental.IncrementalTaskInputs类的典型用法代码示例。如果您正苦于以下问题:Java IncrementalTaskInputs类的具体用法?Java IncrementalTaskInputs怎么用?Java IncrementalTaskInputs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IncrementalTaskInputs类属于org.gradle.api.tasks.incremental包,在下文中一共展示了IncrementalTaskInputs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provideRecompilationSpec
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
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;
}
示例2: getCompiler
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
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.canInferSourceRoots()) {
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);
}
示例3: compile
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
@TaskAction
public void compile(IncrementalTaskInputs inputs) {
BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
NativeCompileSpec spec = createCompileSpec();
spec.setTargetPlatform(targetPlatform);
spec.setTempDir(getTemporaryDir());
spec.setObjectFileDir(getObjectFileDir());
spec.include(includes);
spec.source(getSource());
spec.setMacros(getMacros());
spec.args(getCompilerArgs());
spec.setPositionIndependentCode(isPositionIndependentCode());
spec.setIncrementalCompile(inputs.isIncremental());
spec.setDiscoveredInputRecorder((DiscoveredInputRecorder) inputs);
spec.setOperationLogger(operationLogger);
configureSpec(spec);
PlatformToolProvider platformToolProvider = toolChain.select(targetPlatform);
setDidWork(doCompile(spec, platformToolProvider).getDidWork());
}
示例4: compile
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
@TaskAction
public void compile(IncrementalTaskInputs inputs) {
BuildOperationLogger operationLogger = getOperationLoggerFactory().newOperationLogger(getName(), getTemporaryDir());
NativeCompileSpec spec = new DefaultWindowsResourceCompileSpec();
spec.setTempDir(getTemporaryDir());
spec.setObjectFileDir(getOutputDir());
spec.include(getIncludes());
spec.source(getSource());
spec.setMacros(getMacros());
spec.args(getCompilerArgs());
spec.setIncrementalCompile(inputs.isIncremental());
spec.setDiscoveredInputRecorder((DiscoveredInputRecorder) inputs);
spec.setOperationLogger(operationLogger);
PlatformToolProvider platformToolProvider = toolChain.select(targetPlatform);
WorkResult result = doCompile(spec, platformToolProvider);
setDidWork(result.getDidWork());
}
示例5: createAnnotationJars
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
/**
* Create the annotation JARs for the input JARs
*
* @param inputs Task inputs
*/
@TaskAction
public void createAnnotationJars(IncrementalTaskInputs inputs) {
if (!inputs.isIncremental()) {
for (File file : getAnnotationJars()) {
file.delete();
}
}
inputs.outOfDate(file -> {
createAnnotationJar(file.getFile());
});
inputs.removed(file -> {
file.getFile().delete();
});
}
示例6: provideRecompilationSpec
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
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);
JarChangeProcessor jarChangeProcessor = new JarChangeProcessor(fileOperations, jarClasspathSnapshot, previousCompilation);
InputChangeAction action = new InputChangeAction(spec, javaChangeProcessor, 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;
}
示例7: getCompiler
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
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);
}
示例8: compile
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
@TaskAction
public void compile(IncrementalTaskInputs inputs) {
NativeCompileSpec spec = createCompileSpec();
spec.setTargetPlatform(targetPlatform);
spec.setTempDir(getTemporaryDir());
spec.setObjectFileDir(getObjectFileDir());
spec.include(getIncludes());
spec.source(getSource());
spec.setMacros(getMacros());
spec.args(getCompilerArgs());
spec.setPositionIndependentCode(isPositionIndependentCode());
spec.setIncrementalCompile(inputs.isIncremental());
PlatformToolProvider platformToolProvider = toolChain.select(targetPlatform);
WorkResult result = getIncrementalCompilerBuilder().createIncrementalCompiler(this, platformToolProvider.newCompiler(spec), toolChain).execute(spec);
setDidWork(result.getDidWork());
}
示例9: generate
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
@Override
public void generate(IncrementalTaskInputs inputs) {
File androidSdkResourcesFile =
ResourceUtils.getResourceAsFile(AndroidSdkDependenciesTask.RESOURCES_OUTPUT_FILE_NAME);
Resource.Pool resourcesPool = new CcResourcePool(getProject(), getVariant(), androidSdkResourcesFile);
// Parse and get configuration resource dependencies.
DependenciesParser dependenciesParser = new DependenciesParser(resourcesPool);
dependenciesParser.parseDependencies(mMergeResourcesDir);
DependenciesGenerator dependenciesGenerator = new DependenciesGenerator();
dependenciesGenerator.generateDependencies(
resourcesPool.getResources(),
getVariant().getGenerateBuildConfig().getBuildConfigPackageName(),
getVariant().getApplicationId(),
getOutputDir());
}
示例10: exec
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
@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);
}
示例11: compile
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
@TaskAction
protected void compile(IncrementalTaskInputs inputs) {
if (!compileOptions.isIncremental()) {
compile();
return;
}
SingleMessageLogger.incubatingFeatureUsed("Incremental java compilation");
DefaultJavaCompileSpec spec = createSpec();
final CacheRepository cacheRepository = getCacheRepository();
final GeneralCompileCaches generalCompileCaches = getGeneralCompileCaches();
CompileCaches compileCaches = new CompileCaches() {
private final CacheRepository repository = cacheRepository;
private final JavaCompile javaCompile = JavaCompile.this;
private final GeneralCompileCaches generalCaches = generalCompileCaches;
public ClassAnalysisCache getClassAnalysisCache() {
return generalCaches.getClassAnalysisCache();
}
public JarSnapshotCache getJarSnapshotCache() {
return generalCaches.getJarSnapshotCache();
}
public LocalJarClasspathSnapshotStore getLocalJarClasspathSnapshotStore() {
return new LocalJarClasspathSnapshotStore(repository, javaCompile);
}
public LocalClassSetAnalysisStore getLocalClassSetAnalysisStore() {
return new LocalClassSetAnalysisStore(repository, javaCompile);
}
};
IncrementalCompilerFactory factory = new IncrementalCompilerFactory(
getFileOperations(), getCachingFileHasher(), getPath(), createCompiler(spec), source, compileCaches, (IncrementalTaskInputsInternal) inputs);
Compiler<JavaCompileSpec> compiler = factory.createCompiler();
performCompilation(spec, compiler);
}
示例12: SelectiveCompiler
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
public SelectiveCompiler(IncrementalTaskInputs inputs, PreviousCompilation previousCompilation, CleaningJavaCompiler cleaningCompiler,
RecompilationSpecProvider recompilationSpecProvider, IncrementalCompilationInitializer compilationInitializer, JarClasspathSnapshotProvider jarClasspathSnapshotProvider) {
this.inputs = inputs;
this.previousCompilation = previousCompilation;
this.cleaningCompiler = cleaningCompiler;
this.recompilationSpecProvider = recompilationSpecProvider;
this.incrementalCompilationInitilizer = compilationInitializer;
this.jarClasspathSnapshotProvider = jarClasspathSnapshotProvider;
}
示例13: attachTaskAction
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
private void attachTaskAction(final Method method, TaskClassInfo taskClassInfo, Collection<String> processedMethods) {
if (method.getAnnotation(TaskAction.class) == null) {
return;
}
if (Modifier.isStatic(method.getModifiers())) {
throw new GradleException(String.format("Cannot use @TaskAction annotation on static method %s.%s().",
method.getDeclaringClass().getSimpleName(), method.getName()));
}
final Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length > 1) {
throw new GradleException(String.format(
"Cannot use @TaskAction annotation on method %s.%s() as this method takes multiple parameters.",
method.getDeclaringClass().getSimpleName(), method.getName()));
}
if (parameterTypes.length == 1) {
if (!parameterTypes[0].equals(IncrementalTaskInputs.class)) {
throw new GradleException(String.format(
"Cannot use @TaskAction annotation on method %s.%s() because %s is not a valid parameter to an action method.",
method.getDeclaringClass().getSimpleName(), method.getName(), parameterTypes[0]));
}
if (taskClassInfo.isIncremental()) {
throw new GradleException(String.format("Cannot have multiple @TaskAction methods accepting an %s parameter.", IncrementalTaskInputs.class.getSimpleName()));
}
taskClassInfo.setIncremental(true);
}
if (processedMethods.contains(method.getName())) {
return;
}
taskClassInfo.getTaskActions().add(createActionFactory(method, parameterTypes));
processedMethods.add(method.getName());
}
示例14: getInputChanges
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
public IncrementalTaskInputs getInputChanges() {
assert !upToDate : "Should not be here if the task is up-to-date";
if (canPerformIncrementalBuild()) {
taskInputs = instantiator.newInstance(ChangesOnlyIncrementalTaskInputs.class, getStates().getInputFilesChanges());
} else {
taskInputs = instantiator.newInstance(RebuildIncrementalTaskInputs.class, task);
}
return taskInputs;
}
示例15: generateClasses
import org.gradle.api.tasks.incremental.IncrementalTaskInputs; //导入依赖的package包/类
@TaskAction
void generateClasses(IncrementalTaskInputs inputs) {
inputs.outOfDate(new Action<InputFileDetails>() {
@Override
public void execute(InputFileDetails inputFileDetails) {
GraphQLCompiler.Arguments args = new GraphQLCompiler.Arguments(inputFileDetails.getFile(), outputDir,
apolloExtension.getCustomTypeMapping(), nullableValueType, apolloExtension.isUseSemanticNaming(),
apolloExtension.isGenerateModelBuilder(), apolloExtension.isUseJavaBeansSemanticNaming(), apolloExtension
.getOutputPackageName());
new GraphQLCompiler().write(args);
}
});
}