Java 类org.gradle.api.file.CopySpec 实例源码

项目:Reer    文件:JavaScriptMinify.java   
@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()));
}
项目:Reer    文件:JavaGradlePluginPlugin.java   
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);
}
项目:Reer    文件:ApplicationPlugin.java   
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;
}
项目:Reer    文件:CopySpecWrapper.java   
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;
}
项目:Reer    文件:DefaultCopySpec.java   
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;
}
项目:Reer    文件:DefaultCopySpec.java   
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;
    }
}
项目:Reer    文件:DefaultCopySpec.java   
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));
}
项目:Reer    文件:DefaultCopySpec.java   
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));
}
项目:Reer    文件:DefaultCopySpec.java   
public CopySpec filter(final Transformer<String, String> transformer) {
    appendCopyAction(new Action<FileCopyDetails>() {
        public void execute(FileCopyDetails fileCopyDetails) {
            fileCopyDetails.filter(transformer);
        }
    });
    return this;
}
项目:Reer    文件:FileCopier.java   
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;
}
项目:Reer    文件:Jar.java   
@Internal
public CopySpec getMetaInf() {
    return metaInf.addChild();
}
项目:Reer    文件:Ear.java   
/**
 * A location for dependency libraries to include in the 'lib' directory of the EAR archive.
 */
@Internal
public CopySpec getLib() {
    return ((CopySpecInternal) lib).addChild();
}
项目:Reer    文件:DelegatingCopySpecInternal.java   
public CopySpec exclude(Closure excludeSpec) {
    return getDelegateCopySpec().exclude(excludeSpec);
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public AbstractCopyTask from(Object sourcePath, Action<? super CopySpec> configureAction) {
    getMainSpec().from(sourcePath, configureAction);
    return this;
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public CopySpec with(CopySpec... sourceSpecs) {
    getMainSpec().with(sourceSpecs);
    return this;
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public CopySpec into(Object destPath, Action<? super CopySpec> copySpec) {
    getMainSpec().into(destPath, copySpec);
    return this;
}
项目:Reer    文件:DelegatingCopySpecInternal.java   
public CopySpec exclude(String... excludes) {
    return getDelegateCopySpec().exclude(excludes);
}
项目:Reer    文件:DelegatingCopySpecInternal.java   
public CopySpec into(Object destPath, Action<? super CopySpec> copySpec) {
    return getDelegateCopySpec().into(destPath, copySpec);
}
项目:Reer    文件:DefaultProject.java   
public WorkResult sync(Action<? super CopySpec> action) {
    return getFileOperations().sync(action);
}
项目:Reer    文件:DefaultPlayDistribution.java   
public DefaultPlayDistribution(String name, CopySpec contents, PlayApplicationBinarySpec binary) {
    super(name, contents);
    this.binary = binary;
}
项目:Reer    文件:DefaultProject.java   
public CopySpec copySpec(Action<? super CopySpec> action) {
    return Actions.with(copySpec(), action);
}
项目:Reer    文件:DefaultProject.java   
public CopySpec copySpec() {
    return getFileOperations().copySpec();
}
项目:Reer    文件:DefaultScript.java   
@Override
public CopySpec copySpec(Closure closure) {
    return Actions.with(copySpec(), ConfigureUtil.configureUsing(closure));
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpecWrapper(CopySpec delegate) {
    this.delegate = delegate;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec filesMatching(String pattern, Action<? super FileCopyDetails> action) {
    delegate.filesMatching(pattern, action);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec filesMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
    delegate.filesMatching(patterns, action);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec filesNotMatching(String pattern, Action<? super FileCopyDetails> action) {
    delegate.filesNotMatching(pattern, action);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec filesNotMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
    delegate.filesNotMatching(patterns, action);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec with(CopySpec... sourceSpecs) {
    delegate.with(sourceSpecs);
    return this;
}
项目:Reer    文件:DelegatingCopySpecInternal.java   
public CopySpec eachFile(Closure closure) {
    return getDelegateCopySpec().eachFile(closure);
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec from(Object sourcePath, final Closure c) {
    return delegate.from(sourcePath, new ClosureBackedAction<CopySpec>(c));
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec setIncludes(Iterable<String> includes) {
    delegate.setIncludes(includes);
    return this;
}
项目:Reer    文件:DefaultDistribution.java   
public CopySpec getContents() {
    return contents;
}
项目:Reer    文件:DelegatingCopySpecInternal.java   
public CopySpec eachFile(Action<? super FileCopyDetails> action) {
    return getDelegateCopySpec().eachFile(action);
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec include(Iterable<String> includes) {
    delegate.include(includes);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec include(Spec<FileTreeElement> includeSpec) {
    delegate.include(includeSpec);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec exclude(String... excludes) {
    delegate.exclude(excludes);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec exclude(Iterable<String> excludes) {
    delegate.exclude(excludes);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec exclude(Spec<FileTreeElement> excludeSpec) {
    delegate.exclude(excludeSpec);
    return this;
}
项目:Reer    文件:CopySpecWrapper.java   
public CopySpec exclude(Closure excludeSpec) {
    delegate.exclude(excludeSpec);
    return this;
}