本文整理汇总了Java中org.gradle.api.file.CopySpec类的典型用法代码示例。如果您正苦于以下问题:Java CopySpec类的具体用法?Java CopySpec怎么用?Java CopySpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CopySpec类属于org.gradle.api.file包,在下文中一共展示了CopySpec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitFile
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
@Override
public void visitFile(final FileVisitDetails fileDetails) {
final File outputFileDir = new File(destinationDir, fileDetails.getRelativePath().getParent().getPathString());
// Copy the raw form
FileOperations fileOperations = (ProjectInternal) getProject();
fileOperations.copy(new Action<CopySpec>() {
@Override
public void execute(CopySpec copySpec) {
copySpec.from(fileDetails.getFile()).into(outputFileDir);
}
});
// Capture the relative file
relativeFiles.add(new RelativeFile(fileDetails.getFile(), fileDetails.getRelativePath()));
}
示例2: configureDescriptorGeneration
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
private void configureDescriptorGeneration(final Project project, final GradlePluginDevelopmentExtension extension) {
final GeneratePluginDescriptors generatePluginDescriptors = project.getTasks().create(GENERATE_PLUGIN_DESCRIPTORS_TASK_NAME, GeneratePluginDescriptors.class);
generatePluginDescriptors.conventionMapping("declarations", new Callable<List<PluginDeclaration>>() {
@Override
public List<PluginDeclaration> call() throws Exception {
return Lists.newArrayList(extension.getPlugins());
}
});
generatePluginDescriptors.conventionMapping("outputDirectory", new Callable<File>() {
@Override
public File call() throws Exception {
return new File(project.getBuildDir(), generatePluginDescriptors.getName());
}
});
Copy processResources = (Copy) project.getTasks().getByName(PROCESS_RESOURCES_TASK);
CopySpec copyPluginDescriptors = processResources.getRootSpec().addChild();
copyPluginDescriptors.into("META-INF/gradle-plugins");
copyPluginDescriptors.from(new Callable<File>() {
@Override
public File call() throws Exception {
return generatePluginDescriptors.getOutputDirectory();
}
});
processResources.dependsOn(generatePluginDescriptors);
}
示例3: configureDistSpec
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
private CopySpec configureDistSpec(CopySpec distSpec) {
Task jar = project.getTasks().getAt(JavaPlugin.JAR_TASK_NAME);
Task startScripts = project.getTasks().getAt(TASK_START_SCRIPTS_NAME);
CopySpec libChildSpec = project.copySpec();
libChildSpec.into("lib");
libChildSpec.from(jar);
libChildSpec.from(project.getConfigurations().getByName("runtime"));
CopySpec binChildSpec = project.copySpec();
binChildSpec.into("bin");
binChildSpec.from(startScripts);
binChildSpec.setFileMode(0755);
CopySpec childSpec = project.copySpec();
childSpec.from(project.file("src/dist"));
childSpec.with(libChildSpec);
childSpec.with(binChildSpec);
distSpec.with(childSpec);
distSpec.with(pluginConvention.getApplicationDistribution());
return distSpec;
}
示例4: rename
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
public CopySpec rename(final Closure closure) {
delegate.rename(new Transformer<String, String>() {
@Override
public String transform(String s) {
Object res = closure.call(s);
return res == null ? null : res.toString();
}
});
return this;
}
示例5: with
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
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;
}
示例6: from
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
public CopySpec from(Object sourcePath, Action<? super CopySpec> configureAction) {
if (configureAction == null) {
from(sourcePath);
return this;
} else {
CopySpecInternal child = addChild();
child.from(sourcePath);
CopySpecWrapper wrapper = instantiator.newInstance(CopySpecWrapper.class, child);
configureAction.execute(wrapper);
return wrapper;
}
}
示例7: filesMatching
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
public CopySpec filesMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
if (!patterns.iterator().hasNext()) {
throw new InvalidUserDataException("must provide at least one pattern to 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(unionMatcher, action));
}
示例8: filesNotMatching
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
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));
}
示例9: filter
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
public CopySpec filter(final Transformer<String, String> transformer) {
appendCopyAction(new Action<FileCopyDetails>() {
public void execute(FileCopyDetails fileCopyDetails) {
fileCopyDetails.filter(transformer);
}
});
return this;
}
示例10: createCopySpec
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
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;
}
示例11: getMetaInf
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
@Internal
public CopySpec getMetaInf() {
return metaInf.addChild();
}
示例12: getLib
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
/**
* A location for dependency libraries to include in the 'lib' directory of the EAR archive.
*/
@Internal
public CopySpec getLib() {
return ((CopySpecInternal) lib).addChild();
}
示例13: exclude
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
public CopySpec exclude(Closure excludeSpec) {
return getDelegateCopySpec().exclude(excludeSpec);
}
示例14: from
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public AbstractCopyTask from(Object sourcePath, Action<? super CopySpec> configureAction) {
getMainSpec().from(sourcePath, configureAction);
return this;
}
示例15: with
import org.gradle.api.file.CopySpec; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public CopySpec with(CopySpec... sourceSpecs) {
getMainSpec().with(sourceSpecs);
return this;
}