DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11560>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11560 Taskdef does not apply reverseLoader policy on standard tasks [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | ------- Additional Comments From [EMAIL PROTECTED] 2002-08-09 16:27 ------- This new patch alloxs to alter the system and loader package root lists at classloader instantiation through new attributes and new elements. ---8<----------------------------------------------------------------- Definer.java.orig Tue Jul 09 11:28:38 2002 +++ Definer.java.packageroots Fri Aug 09 18:14:17 2002 @@ -63,6 +63,8 @@ import java.util.Properties; import java.util.Enumeration; +import java.util.Vector; +import java.util.StringTokenizer; import java.io.File; import java.io.InputStream; import java.io.FileInputStream; @@ -88,7 +90,63 @@ private String classpathId = null; private static final String REUSE_LOADER_REF = "ant.reuse.loader"; + + private Vector systemPackageRootList = new Vector(); + private Vector loaderPackageRootList = new Vector(); + + public static class PackageRoot { + + public PackageRoot() { + } + + private String name = null; + + public void setName(String s) { + name = s; + } + + public String getName() { + return name; + } + + } + public void setSystemPackageRoots(String s) { + setPackageRoots(false, s); + } + + public void setLoaderPackageRoots(String s) { + setPackageRoots(true, s); + } + + protected void setPackageRoots(boolean loaderPackageRoot, String s) { + StringTokenizer t = new StringTokenizer(s,","); + while (t.hasMoreTokens()) { + String p = t.nextToken().trim(); + if (p != null && p.length() != 0) { + createPackageRoot(loaderPackageRoot).setName(p); + } + } + } + + public PackageRoot createSystemPackageRoot() { + return createPackageRoot(false); + } + + public PackageRoot createLoaderPackageRoot() { + return createPackageRoot(true); + } + + protected PackageRoot createPackageRoot(boolean loaderPackageRoot) { + PackageRoot pr = new PackageRoot(); + if (loaderPackageRoot) { + loaderPackageRootList.addElement(pr); + } else { + systemPackageRootList.addElement(pr); + } + return pr; + } + /** * @deprecated stop using this attribute * @ant.attribute ignore="true" @@ -282,6 +340,15 @@ // be wrapped into a TaskAdapter. al.addSystemPackageRoot("org.apache.tools.ant"); + for (int i = 0; i < systemPackageRootList.size(); i++) { + PackageRoot pr = (PackageRoot)systemPackageRootList.get(i); + al.addSystemPackageRoot(pr.getName()); + } + + for (int i = 0; i < loaderPackageRootList.size(); i++) { + PackageRoot pr = (PackageRoot)loaderPackageRootList.get(i); + al.addLoaderPackageRoot(pr.getName()); + } // If the loader is new, record it for future uses by other // task/typedefs ---8<-------------------------------------------------------------- It solved my problem and is much more useable than my previous attempt. I can now use: <taskdef name="javac" classname="org.apache.tools.ant.taskdefs.Javac"> <loaderpackageroot name="org.apache.tools.ant.taskdefs" /> <classpath> <!-- contains tools.jar --> <fileset dir="${SYSTEM.JAVA_HOME}/lib" includes="*.jar,*.zip" /> <!-- contains ant.jar --> <fileset dir="${buildlibs}" includes="*.jar,*.zip" /> </classpath> </taskdef> <javac destdir="${destdir}" srcdir="${srcdir}" classpathref="javac-classpath"> <!-- referenciation needed to workaround bug to be corrected in 1.5.1 --> <classpath id="javac-classpath"> <!-- contains source dependencies --> <fileset dir="${dep.java.lib}" includes="*.jar,*.zip" /> </classpath> </javac> After the task redefinition bug is corrected, I won't need any launch script at all :) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
