lenya/src/java/org/apache/lenya/cms/ant CopyJavaSourcesTask.java,1.7,1.8 CopyTask.java,1.2,1.3
Michael Wechner <[email protected]> Mon, 19 May 2003 12:10:19 +0200
| Newsgroups | gmane.comp.cms.wyona.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /repository/lenya/src/java/org/apache/lenya/cms/ant
In directory erbium:/tmp/cvs-serv28000/src/java/org/apache/lenya/cms/ant
Modified Files:
CopyJavaSourcesTask.java CopyTask.java
Log Message:
single publications can be specified
Index: CopyJavaSourcesTask.java
===================================================================
RCS file: /repository/lenya/src/java/org/apache/lenya/cms/ant/CopyJavaSourcesTask.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CopyJavaSourcesTask.java 24 Apr 2003 13:52:37 -0000 1.7
--- CopyJavaSourcesTask.java 19 May 2003 10:10:16 -0000 1.8
***************
*** 79,90 ****
File path = new File(pubsRootDir);
if (path.isDirectory()) {
! String[] pubs = path.list();
! for (int i = 0; i < pubs.length; i++) {
! //System.out.println("CopyJavaSourcesTask.execute(): " + pubs[i]);
! File pubJavaDir = new File(path, new File(pubs[i], javaDir).toString());
! //System.out.println("CopyJavaSourcesTask.execute(): " + pubJavaDir);
! //System.out.println("CopyJavaSourcesTask.execute(): " + absoluteBuildDir);
! copyDir(pubJavaDir, absoluteBuildDir, twoTuple, new JavaFilenameFilter());
}
} else {
--- 79,95 ----
File path = new File(pubsRootDir);
if (path.isDirectory()) {
! if (new File(path, "publication.xml").isFile()) {
! copyContentOfDir(new File(path, javaDir), absoluteBuildDir, twoTuple, new JavaFilenameFilter());
! } else {
! // FIXME: Look for publications defined by the file "publication.xml"
! String[] pubs = path.list();
! for (int i = 0; i < pubs.length; i++) {
! //System.out.println("CopyJavaSourcesTask.execute(): " + pubs[i]);
! File pubJavaDir = new File(path, new File(pubs[i], javaDir).toString());
! //System.out.println("CopyJavaSourcesTask.execute(): " + pubJavaDir);
! //System.out.println("CopyJavaSourcesTask.execute(): " + absoluteBuildDir);
! copyContentOfDir(pubJavaDir, absoluteBuildDir, twoTuple, new JavaFilenameFilter());
! }
}
} else {
***************
*** 98,106 ****
}
-
/**
! *
*/
static public void copyDir(File source, File destination, TwoTuple twoTuple, FilenameFilter filenameFilter) {
if (source.isDirectory()) {
String[] files;
--- 103,120 ----
}
/**
! * Copies the directory "source" into the directory "destination"
*/
static public void copyDir(File source, File destination, TwoTuple twoTuple, FilenameFilter filenameFilter) {
+ File actualDestination = new File(destination, source.getName());
+ actualDestination.mkdirs();
+ copyContentOfDir(source, actualDestination, twoTuple, filenameFilter);
+ }
+
+
+ /**
+ * Copies the content of a directory into another directory
+ */
+ static public void copyContentOfDir(File source, File destination, TwoTuple twoTuple, FilenameFilter filenameFilter) {
if (source.isDirectory()) {
String[] files;
***************
*** 110,113 ****
--- 124,129 ----
files = source.list();
}
+
+
for (int i = 0; i < files.length; i++) {
File file = new File(source, files[i]);
***************
*** 116,124 ****
} else if (file.isDirectory()) {
//System.out.println("CopyJavaSourcesTask.copyDir(): " + source + " " + destination);
! copyDir(file, new File(destination, files[i]), twoTuple, filenameFilter);
} else {
System.err.println("CopyJavaSourcesTask.copyDir(): Neither file nor directory: " + file);
}
}
}
}
--- 132,142 ----
} else if (file.isDirectory()) {
//System.out.println("CopyJavaSourcesTask.copyDir(): " + source + " " + destination);
! copyContentOfDir(file, new File(destination, files[i]), twoTuple, filenameFilter);
} else {
System.err.println("CopyJavaSourcesTask.copyDir(): Neither file nor directory: " + file);
}
}
+ } else {
+ //System.err.println("CopyJavaSourcesTask.copyContentOfDir(): No such directory: " + source);
}
}
***************
*** 126,130 ****
/**
! *
*/
static public void copyFile(File source, File destination, TwoTuple twoTuple) {
--- 144,149 ----
/**
! * Copies the content of a file into another file
! * @param destination File (not a directory!)
*/
static public void copyFile(File source, File destination, TwoTuple twoTuple) {
***************
*** 164,167 ****
--- 183,188 ----
System.err.println("CopyJavaSourcesTask.copyFile(): " + e);
}
+ } else {
+ System.err.println("CopyJavaSourcesTask.copyFile(): No such file: " + source);
}
}
Index: CopyTask.java
===================================================================
RCS file: /repository/lenya/src/java/org/apache/lenya/cms/ant/CopyTask.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CopyTask.java 24 Apr 2003 13:52:37 -0000 1.2
--- CopyTask.java 19 May 2003 10:10:16 -0000 1.3
***************
*** 70,74 ****
String pubsRootDir = st.nextToken();
//System.out.println("CopyTask.execute(): " + pubsRootDir);
! CopyJavaSourcesTask.copyDir(new File(pubsRootDir), new File(toDir.toString()), twoTuple, null);
}
--- 70,79 ----
String pubsRootDir = st.nextToken();
//System.out.println("CopyTask.execute(): " + pubsRootDir);
! if(new File(pubsRootDir, "publication.xml").isFile()) {
! CopyJavaSourcesTask.copyDir(new File(pubsRootDir), new File(toDir.toString()), twoTuple, null);
! } else {
! // FIXME: Look for publications defined by the file "publication.xml"
! CopyJavaSourcesTask.copyContentOfDir(new File(pubsRootDir), new File(toDir.toString()), twoTuple, null);
! }
}