bodewig 02/02/26 08:39:37
Modified: . WHATSNEW
docs/manual/CoreTasks javadoc.html style.html
src/main/org/apache/tools/ant/taskdefs XSLTProcess.java
Log:
<style> tried to tranform all children of directories that matched the
include patterns - even children that are themselves directories.
Throw in a check that the thing we want to transform is not a
directory and an attribute to avoid this non-standard (among directory
based tasks) behavior.
Revision Changes Path
1.216 +5 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -r1.215 -r1.216
--- WHATSNEW 26 Feb 2002 10:11:19 -0000 1.215
+++ WHATSNEW 26 Feb 2002 16:39:36 -0000 1.216
@@ -188,6 +188,11 @@
this feature can now be disabled by setting the new includeantruntime
attribute to false.
+* <style> behaves different than any other directory based task as it
+ processes all files that it finds in included directories in
+ addition to the files matched by your patterns. There now is a new
+ attribute to suppress this behavior.
+
Changes from Ant 1.4 to Ant 1.4.1
===========================================
1.16 +1 -1 jakarta-ant/docs/manual/CoreTasks/javadoc.html
Index: javadoc.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/javadoc.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- javadoc.html 26 Feb 2002 10:39:10 -0000 1.15
+++ javadoc.html 26 Feb 2002 16:39:37 -0000 1.16
@@ -613,7 +613,7 @@
</javadoc></pre>
<hr>
-<p align="center">Copyright © 2001 Apache Software Foundation. All
rights
+<p align="center">Copyright © 2001-2002 Apache Software Foundation. All
rights
Reserved.</p>
</body>
1.17 +7 -0 jakarta-ant/docs/manual/CoreTasks/style.html
Index: style.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/style.html,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- style.html 3 Feb 2002 22:00:42 -0000 1.16
+++ style.html 26 Feb 2002 16:39:37 -0000 1.17
@@ -147,6 +147,13 @@
"html", and "text"</td>
<td valign="top" align="center">No</td>
</tr>
+ <tr>
+ <td valign="top">scanincludeddirectories</td>
+ <td valign="top">If any directories are matched by the
+ includes/excludes patterns, try to transform all files in these
+ directories. Default is <code>true</code></td>
+ <td valign="top" align="center">No</td>
+ </tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>classpath</h4>
1.35 +34 -8
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
Index: XSLTProcess.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- XSLTProcess.java 7 Feb 2002 22:00:33 -0000 1.34
+++ XSLTProcess.java 26 Feb 2002 16:39:37 -0000 1.35
@@ -87,6 +87,8 @@
* such as images, or html files in the source directory will be
* copied into the destination directory.
*
+ * @version $Revision: 1.35 $
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Keith Visco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sam Ruby</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Russell Gold</a>
@@ -120,6 +122,13 @@
private String outputtype = null;
/**
+ * Whether to style all files in the included directories as well.
+ *
+ * @since 1.35, Ant 1.5
+ */
+ private boolean performDirectoryScan = true;
+
+ /**
* Creates a new XSLTProcess Task.
**/
public XSLTProcess() {
@@ -127,9 +136,17 @@
} //-- XSLTProcess
/**
+ * Whether to style all files in the included directories as well.
+ *
+ * @since 1.35, Ant 1.5
+ */
+ public void setScanIncludedDirectories(boolean b) {
+ performDirectoryScan = b;
+ }
+
+ /**
* Executes the task.
*/
-
public void execute() throws BuildException {
DirectoryScanner scanner;
String[] list;
@@ -190,12 +207,14 @@
process( baseDir, list[i], destDir, stylesheet );
}
- // Process all the directoried marked for styling
- dirs = scanner.getIncludedDirectories();
- for (int j = 0;j < dirs.length;++j){
- list=new File(baseDir,dirs[j]).list();
- for (int i = 0;i < list.length;++i) {
- process( baseDir, list[i], destDir, stylesheet );
+ if (performDirectoryScan) {
+ // Process all the directories marked for styling
+ dirs = scanner.getIncludedDirectories();
+ for (int j = 0;j < dirs.length;++j){
+ list=new File(baseDir,dirs[j]).list();
+ for (int i = 0;i < list.length;++i) {
+ process( baseDir, list[i], destDir, stylesheet );
+ }
}
}
} //-- execute
@@ -325,7 +344,7 @@
/**
* Processes the given input XML file and stores the result
* in the given resultFile.
- **/
+ */
private void process(File baseDir, String xmlFile, File destDir,
File stylesheet)
throws BuildException {
@@ -337,6 +356,13 @@
try {
long styleSheetLastModified = stylesheet.lastModified();
inFile = new File(baseDir,xmlFile);
+
+ if (inFile.isDirectory()) {
+ log("Skipping " + inFile + " it is a directory.",
+ Project.MSG_VERBOSE);
+ return;
+ }
+
int dotPos = xmlFile.lastIndexOf('.');
if(dotPos>0){
outFile = new
File(destDir,xmlFile.substring(0,xmlFile.lastIndexOf('.'))+fileExt);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>