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

项目:Reer    文件:JavaGradlePluginPlugin.java   
public void execute(FileCopyDetails fileCopyDetails) {
    PluginDescriptor descriptor;
    try {
        descriptor = new PluginDescriptor(fileCopyDetails.getFile().toURI().toURL());
    } catch (MalformedURLException e) {
        // Not sure under what scenario (if any) this would occur,
        // but there's no sense in collecting the descriptor if it does.
        return;
    }
    if (descriptor.getImplementationClassName() != null) {
        descriptors.add(descriptor);
    }
}
项目:Reer    文件:TarCopyAction.java   
private void visitFile(FileCopyDetails fileDetails) {
    try {
        TarEntry archiveEntry = new TarEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setModTime(fileDetails.getLastModified());
        archiveEntry.setSize(fileDetails.getSize());
        archiveEntry.setMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(tarOutStr);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", fileDetails, tarFile), e);
    }
}
项目:Reer    文件:TarCopyAction.java   
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash on name indicates entry is a directory
        TarEntry archiveEntry = new TarEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setModTime(dirDetails.getLastModified());
        archiveEntry.setMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", dirDetails, tarFile), e);
    }
}
项目:Reer    文件:ZipCopyAction.java   
private void visitFile(FileCopyDetails fileDetails) {
    try {
        ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setTime(fileDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        zipOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(zipOutStr);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e);
    }
}
项目:Reer    文件:ZipCopyAction.java   
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash in name indicates that entry is a directory
        ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setTime(dirDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        zipOutStr.putNextEntry(archiveEntry);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e);
    }
}
项目:Reer    文件:CopyFileVisitorImpl.java   
private void processFile(FileVisitDetails visitDetails) {
    DefaultFileCopyDetails details = createDefaultFileCopyDetails(visitDetails);
    for (Action<? super FileCopyDetails> action : copySpecResolver.getAllCopyActions()) {
        action.execute(details);
        if (details.isExcluded()) {
            return;
        }
    }
    action.processFile(details);
}
项目: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 Class<? extends FilterReader> filterType) {
    appendCopyAction(new Action<FileCopyDetails>() {
        public void execute(FileCopyDetails fileCopyDetails) {
            fileCopyDetails.filter(filterType);
        }
    });
    return this;
}
项目: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    文件:DefaultCopySpec.java   
public CopySpec filter(final Map<String, ?> properties, final Class<? extends FilterReader> filterType) {
    appendCopyAction(new Action<FileCopyDetails>() {
        public void execute(FileCopyDetails fileCopyDetails) {
            fileCopyDetails.filter(properties, filterType);
        }
    });
    return this;
}
项目:Reer    文件:DefaultCopySpec.java   
public CopySpec expand(final Map<String, ?> properties) {
    appendCopyAction(new Action<FileCopyDetails>() {
        public void execute(FileCopyDetails fileCopyDetails) {
            fileCopyDetails.expand(properties);
        }
    });
    return this;
}
项目:Reer    文件:DefaultCopySpec.java   
public Collection<? extends Action<? super FileCopyDetails>> getAllCopyActions() {
    if (parentResolver == null) {
        return copyActions;
    }
    List<Action<? super FileCopyDetails>> allActions = new ArrayList<Action<? super FileCopyDetails>>();
    allActions.addAll(parentResolver.getAllCopyActions());
    allActions.addAll(copyActions);
    return allActions;
}
项目:Reer    文件:RenamingCopyAction.java   
public void execute(FileCopyDetails fileCopyDetails) {
    RelativePath path = fileCopyDetails.getRelativePath();
    String newName = transformer.transform(path.getLastName());
    if (newName != null) {
        path = path.replaceLastName(newName);
        fileCopyDetails.setRelativePath(path);
    }
}
项目:Pushjet-Android    文件:JavaGradlePluginPlugin.java   
public void execute(FileCopyDetails fileCopyDetails) {
    PluginDescriptor descriptor;
    try {
        descriptor = new PluginDescriptor(fileCopyDetails.getFile().toURI().toURL());
    } catch (MalformedURLException e) {
        // Not sure under what scenario (if any) this would occur,
        // but there's no sense in collecting the descriptor if it does.
        return;
    }
    if (descriptor.getImplementationClassName() != null) {
        descriptors.add(descriptor);
    }
}
项目:Pushjet-Android    文件:TarCopyAction.java   
private void visitFile(FileCopyDetails fileDetails) {
    try {
        TarEntry archiveEntry = new TarEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setModTime(fileDetails.getLastModified());
        archiveEntry.setSize(fileDetails.getSize());
        archiveEntry.setMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(tarOutStr);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", fileDetails, tarFile), e);
    }
}
项目:Pushjet-Android    文件:TarCopyAction.java   
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash on name indicates entry is a directory
        TarEntry archiveEntry = new TarEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setModTime(dirDetails.getLastModified());
        archiveEntry.setMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", dirDetails, tarFile), e);
    }
}
项目:Pushjet-Android    文件:ZipCopyAction.java   
private void visitFile(FileCopyDetails fileDetails) {
    try {
        ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setTime(fileDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        zipOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(zipOutStr);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e);
    }
}
项目:Pushjet-Android    文件:ZipCopyAction.java   
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash in name indicates that entry is a directory
        ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setTime(dirDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        zipOutStr.putNextEntry(archiveEntry);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e);
    }
}
项目:Pushjet-Android    文件:CopyFileVisitorImpl.java   
private void processFile(FileVisitDetails visitDetails) {
    DefaultFileCopyDetails details = createDefaultFileCopyDetails(visitDetails);
    for (Action<? super FileCopyDetails> action : copySpecResolver.getAllCopyActions()) {
        action.execute(details);
        if (details.isExcluded()) {
            return;
        }
    }
    action.processFile(details);
}
项目:Pushjet-Android    文件:TarCopyAction.java   
private void visitFile(FileCopyDetails fileDetails) {
    try {
        TarEntry archiveEntry = new TarEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setModTime(fileDetails.getLastModified());
        archiveEntry.setSize(fileDetails.getSize());
        archiveEntry.setMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(tarOutStr);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", fileDetails, tarFile), e);
    }
}
项目:Pushjet-Android    文件:TarCopyAction.java   
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash on name indicates entry is a directory
        TarEntry archiveEntry = new TarEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setModTime(dirDetails.getLastModified());
        archiveEntry.setMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", dirDetails, tarFile), e);
    }
}
项目:Pushjet-Android    文件:ZipCopyAction.java   
private void visitFile(FileCopyDetails fileDetails) {
    try {
        ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setTime(fileDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        zipOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(zipOutStr);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e);
    }
}
项目:Pushjet-Android    文件:ZipCopyAction.java   
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash in name indicates that entry is a directory
        ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setTime(dirDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        zipOutStr.putNextEntry(archiveEntry);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e);
    }
}
项目:Pushjet-Android    文件:CopyFileVisitorImpl.java   
private void processFile(FileVisitDetails visitDetails) {
    DefaultFileCopyDetails details = createDefaultFileCopyDetails(visitDetails);
    for (Action<? super FileCopyDetails> action : spec.getAllCopyActions()) {
        action.execute(details);
        if (details.isExcluded()) {
            return;
        }
    }
    action.processFile(details);
}
项目:gradle-gzjar-plugin    文件:GzJarCopyAction.java   
private void writeOriginalFile(FileCopyDetails fileDetails) {
    String path = fileDetails.getRelativePath().getPathString();
    try {
        ZipEntry archiveEntry = new ZipEntry(path);
        archiveEntry.setTime(fileDetails.getLastModified());
        zipOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(zipOutStr);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", path, zipFile), e);
    }
}
项目:gradle-gzjar-plugin    文件:GzJarCopyAction.java   
private void writeGzippedFile(FileCopyDetails fileDetails) {
    String path = fileDetails.getRelativePath().getPathString() + ".gz";
    try {
        ZipEntry archiveEntry = new ZipEntry(path);
        archiveEntry.setTime(fileDetails.getLastModified());
        zipOutStr.putNextEntry(archiveEntry);
        GZIPOutputStream out = new GZIPOutputStream(zipOutStr, true);
        fileDetails.copyTo(out);
        out.finish();
        out.flush();
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", path, zipFile), e);
    }
}
项目:gradle-gzjar-plugin    文件:GzJarCopyAction.java   
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash in name indicates that entry is a directory
        ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setTime(dirDetails.getLastModified());
        zipOutStr.putNextEntry(archiveEntry);
        zipOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e);
    }
}
项目:jarjar    文件:JarjarCopyAction.java   
private void visitFile(@Nonnull FileCopyDetails fileDetails) {
    try {
        JarArchiveEntry archiveEntry = new JarArchiveEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setTime(fileDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        zipOutStr.putArchiveEntry(archiveEntry);
        fileDetails.copyTo(zipOutStr);
        zipOutStr.closeArchiveEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e);
    }
}
项目:jarjar    文件:JarjarCopyAction.java   
private void visitDir(@Nonnull FileCopyDetails dirDetails) {
    try {
        // Trailing slash in name indicates that entry is a directory
        JarArchiveEntry archiveEntry = new JarArchiveEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setTime(dirDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        zipOutStr.putArchiveEntry(archiveEntry);
        zipOutStr.closeArchiveEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e);
    }
}
项目:bazel    文件:JarjarCopyAction.java   
private void visitFile(@Nonnull FileCopyDetails fileDetails) {
    try {
        JarArchiveEntry archiveEntry = new JarArchiveEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setTime(fileDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        zipOutStr.putArchiveEntry(archiveEntry);
        fileDetails.copyTo(zipOutStr);
        zipOutStr.closeArchiveEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e);
    }
}
项目:bazel    文件:JarjarCopyAction.java   
private void visitDir(@Nonnull FileCopyDetails dirDetails) {
    try {
        // Trailing slash in name indicates that entry is a directory
        JarArchiveEntry archiveEntry = new JarArchiveEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setTime(dirDetails.getLastModified());
        archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        zipOutStr.putArchiveEntry(archiveEntry);
        zipOutStr.closeArchiveEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e);
    }
}
项目:Reer    文件:JavaGradlePluginPlugin.java   
public void execute(FileCopyDetails fileCopyDetails) {
    classList.add(fileCopyDetails.getRelativePath().toString());
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public AbstractCopyTask filesMatching(String pattern, Action<? super FileCopyDetails> action) {
    getMainSpec().filesMatching(pattern, action);
    return this;
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public AbstractCopyTask filesMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
    getMainSpec().filesMatching(patterns, action);
    return this;
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public AbstractCopyTask filesNotMatching(String pattern, Action<? super FileCopyDetails> action) {
    getMainSpec().filesNotMatching(pattern, action);
    return this;
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public AbstractCopyTask filesNotMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
    getMainSpec().filesNotMatching(patterns, action);
    return this;
}
项目:Reer    文件:AbstractCopyTask.java   
/**
 * {@inheritDoc}
 */
public AbstractCopyTask eachFile(Action<? super FileCopyDetails> action) {
    getMainSpec().eachFile(action);
    return this;
}
项目:Reer    文件:MatchingCopyAction.java   
public MatchingCopyAction(Spec<RelativePath> matchSpec, Action<? super FileCopyDetails> toApply) {
    this.matchSpec = matchSpec;
    this.toApply = toApply;
}
项目:Reer    文件:MatchingCopyAction.java   
public void execute(FileCopyDetails details) {
    if (matchSpec.isSatisfiedBy(details.getRelativeSourcePath())) {
        toApply.execute(details);
    }
}