bodewig 00/07/05 03:03:11
Modified: . build.xml
src/main/org/apache/tools/ant Project.java
src/main/org/apache/tools/ant/taskdefs Copydir.java
Log:
reintroduced the forseoverwrite attribute to copydir into build.xml
and made it work as well.
Revision Changes Path
1.30 +1 -0 jakarta-ant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/build.xml,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- build.xml 2000/07/05 09:13:39 1.29
+++ build.xml 2000/07/05 10:02:03 1.30
@@ -81,6 +81,7 @@
<filter token="TIME" value="${TSTAMP}" />
<copydir src="${src.dir}"
dest="${build.classes}"
+ forceoverwrite="true"
filtering="on">
<include name="**/version.txt" />
</copydir>
1.25 +27 -1 jakarta-ant/src/main/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Project.java 2000/07/04 18:18:01 1.24
+++ Project.java 2000/07/05 10:02:46 1.25
@@ -559,6 +559,19 @@
}
/**
+ * Convienence method to copy a file from a source to a
+ * destination specifying if token filtering must be used and if
+ * source files may overwrite newer destination files.
+ *
+ * @throws IOException
+ */
+ public void copyFile(String sourceFile, String destFile, boolean
filtering,
+ boolean overwrite) throws IOException {
+ copyFile(new File(sourceFile), new File(destFile), filtering,
+ overwrite);
+ }
+
+ /**
* Convienence method to copy a file from a source to a destination.
* No filtering is performed.
*
@@ -577,8 +590,21 @@
public void copyFile(File sourceFile, File destFile, boolean filtering)
throws IOException
{
+ copyFile(sourceFile, destFile, filtering, false);
+ }
+
+ /**
+ * Convienence method to copy a file from a source to a
+ * destination specifying if token filtering must be used and if
+ * source files may overwrite newer destination files.
+ *
+ * @throws IOException
+ */
+ public void copyFile(File sourceFile, File destFile, boolean filtering,
+ boolean overwrite) throws IOException {
- if (destFile.lastModified() < sourceFile.lastModified()) {
+ if (overwrite ||
+ destFile.lastModified() < sourceFile.lastModified()) {
log("Copy: " + sourceFile.getAbsolutePath() + " > "
+ destFile.getAbsolutePath(), MSG_VERBOSE);
1.9 +3 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
Index: Copydir.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Copydir.java 2000/06/27 10:42:24 1.8
+++ Copydir.java 2000/07/05 10:03:01 1.9
@@ -112,7 +112,8 @@
String fromFile = (String) enum.nextElement();
String toFile = (String) filecopyList.get(fromFile);
try {
- project.copyFile(fromFile, toFile, filtering);
+ project.copyFile(fromFile, toFile, filtering,
+ forceOverwrite);
} catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " +
toFile
+ " due to " + ioe.getMessage();
@@ -130,7 +131,7 @@
if (forceOverwrite ||
(srcFile.lastModified() > destFile.lastModified())) {
filecopyList.put(srcFile.getAbsolutePath(),
- destFile.getAbsolutePath());
+ destFile.getAbsolutePath());
}
}
}