org.gradle.api.internal.file.CopyActionProcessingStreamAction Java Examples

The following examples show how to use org.gradle.api.internal.file.CopyActionProcessingStreamAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example #2
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example #3
Source File: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example #4
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example #5
Source File: DuplicateHandlingCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visitedFiles = new HashSet<RelativePath>();

    return delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    if (!details.isDirectory()) {
                        DuplicatesStrategy strategy = details.getDuplicatesStrategy();

                        if (!visitedFiles.add(details.getRelativePath())) {
                            if (strategy == DuplicatesStrategy.EXCLUDE) {
                                return;
                            } else if (strategy == DuplicatesStrategy.FAIL) {
                                throw new DuplicateFileCopyingException(String.format("Encountered duplicate path \"%s\" during copy operation configured with DuplicatesStrategy.FAIL", details.getRelativePath()));
                            } else if (strategy == DuplicatesStrategy.WARN) {
                                LOGGER.warn("Encountered duplicate path \"{}\" during copy operation configured with DuplicatesStrategy.WARN", details.getRelativePath());
                            }
                        }
                    }

                    action.processFile(details);
                }
            });
        }
    });
}
 
Example #6
Source File: DuplicateHandlingCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visitedFiles = new HashSet<RelativePath>();

    return delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    if (!details.isDirectory()) {
                        DuplicatesStrategy strategy = details.getDuplicatesStrategy();

                        if (!visitedFiles.add(details.getRelativePath())) {
                            if (strategy == DuplicatesStrategy.EXCLUDE) {
                                return;
                            } else if (strategy == DuplicatesStrategy.FAIL) {
                                throw new DuplicateFileCopyingException(String.format("Encountered duplicate path \"%s\" during copy operation configured with DuplicatesStrategy.FAIL", details.getRelativePath()));
                            } else if (strategy == DuplicatesStrategy.WARN) {
                                LOGGER.warn("Encountered duplicate path \"{}\" during copy operation configured with DuplicatesStrategy.WARN", details.getRelativePath());
                            }
                        }
                    }

                    action.processFile(details);
                }
            });
        }
    });
}
 
Example #7
Source File: DuplicateHandlingCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visitedFiles = new HashSet<RelativePath>();

    return delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    if (!details.isDirectory()) {
                        DuplicatesStrategy strategy = details.getDuplicatesStrategy();

                        if (!visitedFiles.add(details.getRelativePath())) {
                            if (strategy == DuplicatesStrategy.EXCLUDE) {
                                return;
                            } else if (strategy == DuplicatesStrategy.FAIL) {
                                throw new DuplicateFileCopyingException(String.format("Encountered duplicate path \"%s\" during copy operation configured with DuplicatesStrategy.FAIL", details.getRelativePath()));
                            } else if (strategy == DuplicatesStrategy.WARN) {
                                LOGGER.warn("Encountered duplicate path \"{}\" during copy operation configured with DuplicatesStrategy.WARN", details.getRelativePath());
                            }
                        }
                    }

                    action.processFile(details);
                }
            });
        }
    });
}
 
Example #8
Source File: DuplicateHandlingCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visitedFiles = new HashSet<RelativePath>();

    return delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    if (!details.isDirectory()) {
                        DuplicatesStrategy strategy = details.getDuplicatesStrategy();

                        if (!visitedFiles.add(details.getRelativePath())) {
                            if (strategy == DuplicatesStrategy.EXCLUDE) {
                                return;
                            } else if (strategy == DuplicatesStrategy.FAIL) {
                                throw new DuplicateFileCopyingException(String.format("Encountered duplicate path \"%s\" during copy operation configured with DuplicatesStrategy.FAIL", details.getRelativePath()));
                            } else if (strategy == DuplicatesStrategy.WARN) {
                                LOGGER.warn("Encountered duplicate path \"{}\" during copy operation configured with DuplicatesStrategy.WARN", details.getRelativePath());
                            }
                        }
                    }

                    action.processFile(details);
                }
            });
        }
    });
}
 
Example #9
Source File: CopySpecActionImpl.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopySpecActionImpl(CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #10
Source File: CopySpecBackedCopyActionProcessingStream.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void process(final CopyActionProcessingStreamAction action) {
    spec.walk(new CopySpecActionImpl(action, instantiator, fileSystem));
}
 
Example #11
Source File: CopyFileVisitorImpl.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopyFileVisitorImpl(CopySpecInternal spec, CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.spec = spec;
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #12
Source File: CopySpecActionImpl.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopySpecActionImpl(CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #13
Source File: CopySpecBackedCopyActionProcessingStream.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void process(final CopyActionProcessingStreamAction action) {
    spec.walk(new CopySpecActionImpl(action, instantiator, fileSystem));
}
 
Example #14
Source File: CopyFileVisitorImpl.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopyFileVisitorImpl(CopySpecResolver spec, CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.copySpecResolver = spec;
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #15
Source File: CopySpecActionImpl.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopySpecActionImpl(CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #16
Source File: CopySpecBackedCopyActionProcessingStream.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void process(final CopyActionProcessingStreamAction action) {
    spec.walk(new CopySpecActionImpl(action, instantiator, fileSystem));
}
 
Example #17
Source File: CopyFileVisitorImpl.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopyFileVisitorImpl(CopySpecInternal spec, CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.spec = spec;
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #18
Source File: CopySpecActionImpl.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopySpecActionImpl(CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #19
Source File: CopySpecBackedCopyActionProcessingStream.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void process(final CopyActionProcessingStreamAction action) {
    spec.walk(new CopySpecActionImpl(action, instantiator, fileSystem));
}
 
Example #20
Source File: CopyFileVisitorImpl.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopyFileVisitorImpl(CopySpecResolver spec, CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) {
    this.copySpecResolver = spec;
    this.action = action;
    this.instantiator = instantiator;
    this.fileSystem = fileSystem;
}
 
Example #21
Source File: CopyActionProcessingStream.java    From pushfish-android with BSD 2-Clause "Simplified" License votes vote down vote up
void process(CopyActionProcessingStreamAction action); 
Example #22
Source File: CopyActionProcessingStream.java    From Pushjet-Android with BSD 2-Clause "Simplified" License votes vote down vote up
void process(CopyActionProcessingStreamAction action); 
Example #23
Source File: CopyActionProcessingStream.java    From pushfish-android with BSD 2-Clause "Simplified" License votes vote down vote up
void process(CopyActionProcessingStreamAction action); 
Example #24
Source File: CopyActionProcessingStream.java    From Pushjet-Android with BSD 2-Clause "Simplified" License votes vote down vote up
void process(CopyActionProcessingStreamAction action);