use of org.gradle.api.file.CopySpec in project gradle by gradle.
the class Jar method metaInf.
/**
* Adds content to this JAR archive's META-INF directory.
*
* <p>The given action is executed to configure a {@code CopySpec}.</p>
*
* @param configureAction The action.
* @return The created {@code CopySpec}
* @since 3.5
*/
public CopySpec metaInf(Action<? super CopySpec> configureAction) {
CopySpec metaInf = getMetaInf();
configureAction.execute(metaInf);
return metaInf;
}
use of org.gradle.api.file.CopySpec in project gradle by gradle.
the class AntGroovydoc method execute.
public void execute(final FileCollection source, File destDir, boolean use, boolean noTimestamp, boolean noVersionStamp, String windowTitle, String docTitle, String header, String footer, String overview, boolean includePrivate, final Set<Groovydoc.Link> links, final Iterable<File> groovyClasspath, Iterable<File> classpath, Project project) {
final File tmpDir = new File(project.getBuildDir(), "tmp/groovydoc");
FileOperations fileOperations = (ProjectInternal) project;
fileOperations.delete(tmpDir);
fileOperations.copy(new Action<CopySpec>() {
public void execute(CopySpec copySpec) {
copySpec.from(source).into(tmpDir);
}
});
List<File> combinedClasspath = ImmutableList.<File>builder().addAll(classpath).addAll(groovyClasspath).build();
VersionNumber version = VersionNumber.parse(getGroovyVersion(combinedClasspath));
final Map<String, Object> args = Maps.newLinkedHashMap();
args.put("sourcepath", tmpDir.toString());
args.put("destdir", destDir);
args.put("use", use);
if (isAtLeast(version, "2.4.6")) {
args.put("noTimestamp", noTimestamp);
args.put("noVersionStamp", noVersionStamp);
}
args.put("private", includePrivate);
putIfNotNull(args, "windowtitle", windowTitle);
putIfNotNull(args, "doctitle", docTitle);
putIfNotNull(args, "header", header);
putIfNotNull(args, "footer", footer);
if (overview != null) {
args.put("overview", overview);
}
invokeGroovydoc(links, combinedClasspath, args);
}
use of org.gradle.api.file.CopySpec in project gradle by gradle.
the class DefaultCopySpec method with.
public CopySpec with(CopySpec... copySpecs) {
for (CopySpec copySpec : copySpecs) {
CopySpecInternal copySpecInternal;
if (copySpec instanceof CopySpecSource) {
CopySpecSource copySpecSource = (CopySpecSource) copySpec;
copySpecInternal = copySpecSource.getRootSpec();
} else {
copySpecInternal = (CopySpecInternal) copySpec;
}
addChildSpec(copySpecInternal);
}
return this;
}
use of org.gradle.api.file.CopySpec in project gradle by gradle.
the class DefaultCopySpec method filesNotMatching.
public CopySpec filesNotMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
if (!patterns.iterator().hasNext()) {
throw new InvalidUserDataException("must provide at least one pattern to not match");
}
List<Spec> matchers = new ArrayList<Spec>();
for (String pattern : patterns) {
matchers.add(PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern));
}
Spec unionMatcher = Specs.union(matchers.toArray(new Spec[matchers.size()]));
return eachFile(new MatchingCopyAction(Specs.<RelativePath>negate(unionMatcher), action));
}
use of org.gradle.api.file.CopySpec in project gradle by gradle.
the class FileCopier method createCopySpec.
private DestinationRootCopySpec createCopySpec(Action<? super CopySpec> action) {
DefaultCopySpec copySpec = new DefaultCopySpec(this.fileResolver, instantiator);
DestinationRootCopySpec destinationRootCopySpec = new DestinationRootCopySpec(fileResolver, copySpec);
CopySpec wrapped = instantiator.newInstance(CopySpecWrapper.class, destinationRootCopySpec);
action.execute(wrapped);
return destinationRootCopySpec;
}
Aggregations