use of org.gradle.api.file.FileCollection in project atlas by alibaba.
the class AwbDataBindingExportBuildInfoConfigAction method execute.
@Override
public void execute(DataBindingExportBuildInfoTask task) {
final BaseVariantData<? extends BaseVariantOutputData> variantData = appVariantContext.getScope().getVariantData();
task.setXmlProcessor(AwbXmlProcessor.getLayoutXmlProcessor(appVariantContext, awbBundle, dataBindingBuilder));
task.setSdkDir(appVariantContext.getScope().getGlobalScope().getSdkHandler().getSdkFolder());
task.setXmlOutFolder(appVariantContext.getAwbLayoutInfoOutputForDataBinding(awbBundle));
ConventionMappingHelper.map(task, "compilerClasspath", new Callable<FileCollection>() {
@Override
public FileCollection call() {
return appVariantContext.getScope().getJavaClasspath();
}
});
ConventionMappingHelper.map(task, "compilerSources", new Callable<Iterable<ConfigurableFileTree>>() {
@Override
public Iterable<ConfigurableFileTree> call() throws Exception {
return Iterables.filter(appVariantContext.getAwSourceOutputDir(awbBundle), new Predicate<ConfigurableFileTree>() {
@Override
public boolean apply(ConfigurableFileTree input) {
File dataBindingOut = appVariantContext.getAwbClassOutputForDataBinding(awbBundle);
return !dataBindingOut.equals(input.getDir());
}
});
}
});
task.setExportClassListTo(variantData.getType().isExportDataBindingClassList() ? new File(appVariantContext.getAwbLayoutFolderOutputForDataBinding(awbBundle), "_generated.txt") : null);
task.setPrintMachineReadableErrors(printMachineReadableErrors);
task.setDataBindingClassOutput(appVariantContext.getAwbClassOutputForDataBinding(awbBundle));
}
use of org.gradle.api.file.FileCollection in project gradle by gradle.
the class JvmOptions method getManagedJvmArgs.
/**
* @return the list of jvm args we manage explicitly, for example, max heaps size or file encoding.
* The result is a subset of options returned by {@link #getAllImmutableJvmArgs()}
*/
public List<String> getManagedJvmArgs() {
List<String> args = new ArrayList<String>();
if (minHeapSize != null) {
args.add("-Xms" + minHeapSize);
}
if (maxHeapSize != null) {
args.add("-Xmx" + maxHeapSize);
}
FileCollection bootstrapClasspath = getBootstrapClasspath();
if (!bootstrapClasspath.isEmpty()) {
args.add("-Xbootclasspath:" + bootstrapClasspath.getAsPath());
}
// These are implemented as a system property, but don't really function like one
// So we include it in this “no system property” set.
formatSystemProperties(immutableSystemProperties, args);
if (assertionsEnabled) {
args.add("-ea");
}
if (debug) {
args.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005");
}
return args;
}
use of org.gradle.api.file.FileCollection in project gradle by gradle.
the class PmdPlugin method configureForSourceSet.
@Override
protected void configureForSourceSet(final SourceSet sourceSet, final Pmd task) {
task.setDescription("Run PMD analysis for " + sourceSet.getName() + " classes");
task.setSource(sourceSet.getAllJava());
ConventionMapping taskMapping = task.getConventionMapping();
taskMapping.map("classpath", new Callable<FileCollection>() {
@Override
public FileCollection call() throws Exception {
return sourceSet.getOutput().plus(sourceSet.getCompileClasspath());
}
});
}
use of org.gradle.api.file.FileCollection in project gradle by gradle.
the class DependencyAutoWireTaskFactoryTest method addsDependencyOnInputFiles.
@Test
public void addsDependencyOnInputFiles() {
final TaskInternal task = context.mock(TaskInternal.class);
final TaskInputsInternal taskInputs = context.mock(TaskInputsInternal.class);
final FileCollection inputFiles = context.mock(FileCollection.class);
context.checking(new Expectations() {
{
one(delegate).createTask(map());
will(returnValue(task));
allowing(task).getInputs();
will(returnValue(taskInputs));
allowing(taskInputs).getFiles();
will(returnValue(inputFiles));
one(task).dependsOn(inputFiles);
}
});
assertThat(factory.createTask(map()), sameInstance(task));
}
use of org.gradle.api.file.FileCollection in project gradle by gradle.
the class DefaultConfigurableFileCollectionTest method resolveAddsEachSourceObjectAndBuildDependencies.
@Test
public void resolveAddsEachSourceObjectAndBuildDependencies() {
final FileCollectionResolveContext resolveContext = context.mock(FileCollectionResolveContext.class);
final FileCollectionResolveContext nestedContext = context.mock(FileCollectionResolveContext.class);
final FileCollection fileCollectionMock = context.mock(FileCollection.class);
collection.from("file");
collection.from(fileCollectionMock);
context.checking(new Expectations() {
{
oneOf(resolveContext).push(resolverMock);
will(returnValue(nestedContext));
oneOf(nestedContext).add(collection.getFrom());
}
});
collection.visitContents(resolveContext);
}
Aggregations