@@ -1,5 +1,5 @@
/*
* Copyright 2003-2004 The Apache Software Foundation
* Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@ package org.apache.tools.ant.taskdefs;
import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.tools.ant.BuildException;
@@ -34,9 +33,6 @@ import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.IdentityMapper;
/**
* Synchronize a local target directory from the files defined
@@ -57,19 +53,19 @@ import org.apache.tools.ant.util.IdentityMapper;
public class Sync extends Task {
// Same as regular <copy> task... see at end-of-file!
private MyCopy _c opy;
private MyCopy myC opy;
// Override Task#init
public void init()
throws BuildException {
// Instantiate it
_c opy = new MyCopy();
configureTask(_c opy);
myC opy = new MyCopy();
configureTask(myC opy);
// Default config of <mycopy> for our purposes.
_c opy.setFiltering(false);
_c opy.setIncludeEmptyDirs(false);
_c opy.setPreserveLastModified(true);
myC opy.setFiltering(false);
myC opy.setIncludeEmptyDirs(false);
myC opy.setPreserveLastModified(true);
}
private void configureTask(Task helper) {
@@ -83,10 +79,10 @@ public class Sync extends Task {
public void execute()
throws BuildException {
// The destination of the files to copy
File toDir = _c opy.getToDir();
File toDir = myC opy.getToDir();
// The complete list of files to copy
Set allFiles = _c opy.nonOrphans;
Set allFiles = myC opy.nonOrphans;
// If the destination directory didn't already exist,
// or was empty, then no previous file removal is necessary!
@@ -94,7 +90,7 @@ public class Sync extends Task {
// Copy all the necessary out-of-date files
log("PASS#1: Copying files to " + toDir, Project.MSG_DEBUG);
_c opy.execute();
myC opy.execute();
// Do we need to perform further processing?
if (noRemovalNecessary) {
@@ -109,7 +105,7 @@ public class Sync extends Task {
logRemovedCount(removedFileCount[1], "dangling file", "", "s");
// Get rid of empty directories on the destination side
if (!_c opy.getIncludeEmptyDirs()) {
if (!myC opy.getIncludeEmptyDirs()) {
log("PASS#3: Removing empty directories from " + toDir,
Project.MSG_DEBUG);
int removedDirCount = removeEmptyDirectories(toDir, false);
@@ -119,7 +115,7 @@ public class Sync extends Task {
private void logRemovedCount(int count, String prefix,
String singularSuffix, String pluralSuffix) {
File toDir = _c opy.getToDir();
File toDir = myC opy.getToDir();
String what = (prefix == null) ? "" : prefix;
what += (count < 2) ? singularSuffix : pluralSuffix;
@@ -230,28 +226,28 @@ public class Sync extends Task {
* Sets the destination directory.
*/
public void setTodir(File destDir) {
_c opy.setTodir(destDir);
myC opy.setTodir(destDir);
}
/**
* Used to force listing of all names of copied files.
*/
public void setVerbose(boolean verbose) {
_c opy.setVerbose(verbose);
myC opy.setVerbose(verbose);
}
/**
* Overwrite any existing destination file(s).
*/
public void setOverwrite(boolean overwrite) {
_c opy.setOverwrite(overwrite);
myC opy.setOverwrite(overwrite);
}
/**
* Used to copy empty directories.
*/
public void setIncludeEmptyDirs(boolean includeEmpty) {
_c opy.setIncludeEmptyDirs(includeEmpty);
myC opy.setIncludeEmptyDirs(includeEmpty);
}
/**
@@ -259,14 +255,14 @@ public class Sync extends Task {
* @param failonerror true or false
*/
public void setFailOnError(boolean failonerror) {
_c opy.setFailOnError(failonerror);
myC opy.setFailOnError(failonerror);
}
/**
* Adds a set of files to copy.
*/
public void addFileset(FileSet set) {
_c opy.addFileset(set);
myC opy.addFileset(set);
}
/**
@@ -278,7 +274,7 @@ public class Sync extends Task {
* @since Ant 1.6.2
*/
public void setGranularity(long granularity) {
_c opy.setGranularity(granularity);
myC opy.setGranularity(granularity);
}
/**