myrmidon-container.jar (all the container classes) myrmidon-api.jar (the API used to write tasks and other types) myrmidon-framework.jar (the framework that makes writing tasks easier) myrmidon-launcher.jar (executable jar used to setup classloaders and run myrmidon) The ClassLoader hierarchy is now System CL <--- api/framework CL <--- container <--- type library 1 <--- type library 2 <--- type library 3 <--- type library 1 <--- type library 1 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269874 13f79535-47bb-0310-9956-ffa450edef68master
@@ -105,18 +105,24 @@ Legal: | |||||
<mkdir dir="${build.lib}"/> | <mkdir dir="${build.lib}"/> | ||||
<jar jarfile="${build.lib}/ant.jar" | |||||
<jar jarfile="${build.lib}/myrmidon-launcher.jar" | |||||
basedir="${build.classes}" | basedir="${build.classes}" | ||||
manifest="${manifest.dir}/ant-manifest.mf"> | |||||
manifest="${manifest.dir}/myrmidon-launcher.mf"> | |||||
<include name="org/apache/myrmidon/launcher/*" /> | <include name="org/apache/myrmidon/launcher/*" /> | ||||
</jar> | </jar> | ||||
<jar jarfile="${build.lib}/myrmidon.jar" | |||||
<jar jarfile="${build.lib}/myrmidon-api.jar" | |||||
basedir="${build.classes}" | basedir="${build.classes}" | ||||
manifest="${manifest.dir}/myrmidon-manifest.mf"> | |||||
<include name="org/apache/**" /> | |||||
<exclude name="org/apache/myrmidon/launcher/*" /> | |||||
<exclude name="org/apache/myrmidon/libs/*" /> | |||||
manifest="${manifest.dir}/myrmidon-api.mf"> | |||||
<include name="org/apache/myrmidon/api/*" /> | |||||
<include name="org/apache/myrmidon/aspects/*" /> | |||||
<include name="org/apache/myrmidon/converter/*" /> | |||||
<include name="org/apache/myrmidon/interfaces/**" /> | |||||
<include name="org/apache/myrmidon/listeners/*" /> | |||||
<include name="org/apache/myrmidon/framework/**" /> | |||||
<!-- <include name="org/apache/myrmidon/*" /> | |||||
<include name="org/apache/myrmidon/components/**"/> | |||||
<include name="org/apache/myrmidon/frontends/*" /> --> | |||||
<zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-roles.xml"> | <zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-roles.xml"> | ||||
<include name="builtin-ant-roles.xml"/> | <include name="builtin-ant-roles.xml"/> | ||||
@@ -125,7 +131,29 @@ Legal: | |||||
<zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-descriptor.xml"> | <zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-descriptor.xml"> | ||||
<include name="builtin-ant-descriptor.xml"/> | <include name="builtin-ant-descriptor.xml"/> | ||||
</zipfileset> | </zipfileset> | ||||
</jar> | |||||
<!-- | |||||
<jar jarfile="${build.lib}/myrmidon-framework.jar" | |||||
basedir="${build.classes}" | |||||
manifest="${manifest.dir}/myrmidon-framework.mf"> | |||||
<include name="org/apache/myrmidon/framework/**" /> | |||||
<zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-roles.xml"> | |||||
<include name="builtin-ant-roles.xml"/> | |||||
</zipfileset> | |||||
<zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-descriptor.xml"> | |||||
<include name="builtin-ant-descriptor.xml"/> | |||||
</zipfileset> | |||||
</jar> | |||||
--> | |||||
<jar jarfile="${build.lib}/myrmidon-container.jar" | |||||
basedir="${build.classes}" | |||||
manifest="${manifest.dir}/myrmidon-container.mf"> | |||||
<include name="org/apache/myrmidon/components/**" /> | |||||
<include name="org/apache/myrmidon/frontends/*" /> | |||||
<include name="org/apache/myrmidon/*" /> | |||||
</jar> | </jar> | ||||
<jar jarfile="${build.lib}/core.atl" basedir="${build.classes}"> | <jar jarfile="${build.lib}/core.atl" basedir="${build.classes}"> | ||||
@@ -167,10 +195,14 @@ Legal: | |||||
<mkdir dir="${dist.ext}"/> | <mkdir dir="${dist.ext}"/> | ||||
<copy file="tools/lib/ant.jar" tofile="${dist.lib}/ant1-compat.jar" /> | <copy file="tools/lib/ant.jar" tofile="${dist.lib}/ant1-compat.jar" /> | ||||
<copy file="${build.lib}/myrmidon-launcher.jar" tofile="${dist.bin}/myrmidon-launcher.jar" /> | |||||
<copy file="${build.lib}/myrmidon-container.jar" tofile="${dist.bin}/lib/myrmidon-container.jar" /> | |||||
<copy todir="${dist.lib}"> | <copy todir="${dist.lib}"> | ||||
<fileset dir="${build.lib}"> | <fileset dir="${build.lib}"> | ||||
<exclude name="selftest.atl"/> | <exclude name="selftest.atl"/> | ||||
<exclude name="myrmidon-container.jar"/> | |||||
<exclude name="myrmidon-launcher.jar"/> | |||||
</fileset> | </fileset> | ||||
</copy> | </copy> | ||||
@@ -13,6 +13,7 @@ import java.lang.reflect.Method; | |||||
import java.net.URL; | import java.net.URL; | ||||
import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | |||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
/** | /** | ||||
@@ -40,9 +41,13 @@ public final class Main | |||||
//setup classloader appropriately for myrmidon jar | //setup classloader appropriately for myrmidon jar | ||||
final File libDir = new File( installDirectory, "lib" ); | final File libDir = new File( installDirectory, "lib" ); | ||||
final URL[] urls = buildURLList( libDir ); | |||||
final URL[] libUrls = buildURLList( libDir ); | |||||
final URLClassLoader libClassLoader = new URLClassLoader( libUrls ); | |||||
final URLClassLoader classLoader = new URLClassLoader( urls ); | |||||
final File containerLibDir = new File( installDirectory, "bin" + File.separator + "lib" ); | |||||
final URL[] containerLibUrls = buildURLList( containerLibDir ); | |||||
final URLClassLoader classLoader = | |||||
new URLClassLoader( containerLibUrls, libClassLoader ); | |||||
//load class and retrieve appropriate main method. | //load class and retrieve appropriate main method. | ||||
final Class clazz = classLoader.loadClass( "org.apache.myrmidon.frontends.CLIMain" ); | final Class clazz = classLoader.loadClass( "org.apache.myrmidon.frontends.CLIMain" ); | ||||
@@ -116,7 +121,7 @@ public final class Main | |||||
{ | { | ||||
final String element = tokenizer.nextToken(); | final String element = tokenizer.nextToken(); | ||||
if( element.endsWith( "ant.jar" ) ) | |||||
if( element.endsWith( "myrmidon-launcher.jar" ) ) | |||||
{ | { | ||||
File file = (new File( element )).getAbsoluteFile(); | File file = (new File( element )).getAbsoluteFile(); | ||||
file = file.getParentFile(); | file = file.getParentFile(); | ||||
@@ -133,3 +138,58 @@ public final class Main | |||||
throw new Exception( "Unable to locate ant.jar in classpath" ); | throw new Exception( "Unable to locate ant.jar in classpath" ); | ||||
} | } | ||||
} | } | ||||
class MyClassLoader extends URLClassLoader | |||||
{ | |||||
MyClassLoader( final URL[] urls, final ClassLoader classLoader ) | |||||
{ | |||||
super( urls, classLoader ); | |||||
} | |||||
public Class loadClass( final String name ) | |||||
throws ClassNotFoundException | |||||
{ | |||||
System.out.println( "Loading: " + name ); | |||||
try | |||||
{ | |||||
return super.loadClass( name ); | |||||
} | |||||
catch( final ClassNotFoundException cnfe ) | |||||
{ | |||||
System.out.println( "Failed to Load: " + name ); | |||||
throw cnfe; | |||||
} | |||||
} | |||||
protected Class findClass( final String name ) | |||||
throws ClassNotFoundException | |||||
{ | |||||
System.out.println( "findClass: " + name ); | |||||
try | |||||
{ | |||||
return super.findClass( name ); | |||||
} | |||||
catch( final ClassNotFoundException cnfe ) | |||||
{ | |||||
System.out.println( "Failed to Load: " + name ); | |||||
throw cnfe; | |||||
} | |||||
} | |||||
public Class loadClass( final String name, final boolean resolve ) | |||||
throws ClassNotFoundException | |||||
{ | |||||
System.out.println( "Loading: " + name ); | |||||
try | |||||
{ | |||||
return super.loadClass( name, resolve ); | |||||
} | |||||
catch( final ClassNotFoundException cnfe ) | |||||
{ | |||||
System.out.println( "Failed to Load: " + name ); | |||||
throw cnfe; | |||||
} | |||||
} | |||||
} | |||||
@@ -101,11 +101,13 @@ Legal: | |||||
<target name="ant1-tasklib-test"> | <target name="ant1-tasklib-test"> | ||||
<!-- | |||||
<ant1-tasklib prefix="a1-" lib="../../dist/lib/ant1-compat.jar"/> | <ant1-tasklib prefix="a1-" lib="../../dist/lib/ant1-compat.jar"/> | ||||
<a1-echo message="Boo!" /> | <a1-echo message="Boo!" /> | ||||
<a1-mkdir dir="../../dist/test"/> | <a1-mkdir dir="../../dist/test"/> | ||||
<a1-copy file="../../tools/lib/ant.jar" tofile="../../dist/test/ant1-compat.jar" /> | <a1-copy file="../../tools/lib/ant.jar" tofile="../../dist/test/ant1-compat.jar" /> | ||||
--> | |||||
</target> | </target> | ||||
@@ -3,5 +3,5 @@ | |||||
<role shorthand="data-type" name="org.apache.myrmidon.framework.DataType"/> | <role shorthand="data-type" name="org.apache.myrmidon.framework.DataType"/> | ||||
<role shorthand="listener" name="org.apache.myrmidon.listeners.ProjectListener"/> | <role shorthand="listener" name="org.apache.myrmidon.listeners.ProjectListener"/> | ||||
<role shorthand="aspect" name="org.apache.myrmidon.aspects.AspectHandler"/> | <role shorthand="aspect" name="org.apache.myrmidon.aspects.AspectHandler"/> | ||||
<role shorthand="project-builder" name="org.apache.myrmidon.components.builder.ProjectBuilder"/> | |||||
<role shorthand="project-builder" name="org.apache.myrmidon.interfaces.builder.ProjectBuilder"/> | |||||
</roles> | </roles> |
@@ -0,0 +1,9 @@ | |||||
Manifest-Version: 1.0 | |||||
Created-By: Apache Ant Project | |||||
Extension-Name: myrmidon.api | |||||
Specification-Title: Myrmidon API | |||||
Specification-Version: 0.01 | |||||
Specification-Vendor: Jakarta Apache | |||||
Implementation-Vendor-Id: org.apache.jakarta | |||||
Implementation-Vendor: Jakarta Apache Project | |||||
Implementation-Version: 0.01 |
@@ -0,0 +1,19 @@ | |||||
Manifest-Version: 1.0 | |||||
Created-By: Apache Ant Project | |||||
Main-Class: org.apache.myrmidon.frontends.CLIMain | |||||
Extension-Name: myrmidon.container | |||||
Specification-Title: Myrmidon Framework | |||||
Specification-Version: 0.01 | |||||
Specification-Vendor: Jakarta Apache | |||||
Implementation-Vendor-Id: org.apache.jakarta | |||||
Implementation-Vendor: Jakarta Apache Project | |||||
Implementation-Version: 0.01 | |||||
Extension-List: myrmidon_api, myrmidon_framework | |||||
myrmidon_api-Extension-Name: myrmidon.api | |||||
myrmidon_api-Specification-Version: 0.01 | |||||
myrmidon_api-Implementation-Version: 0.01 | |||||
myrmidon_api-Implementation-Vendor-Id: org.apache.jakarta | |||||
myrmidon_framework-Extension-Name: myrmidon.framework | |||||
myrmidon_framework-Specification-Version: 0.01 | |||||
myrmidon_framework-Implementation-Version: 0.01 | |||||
myrmidon_framework-Implementation-Vendor-Id: org.apache.jakarta |
@@ -0,0 +1,15 @@ | |||||
Manifest-Version: 1.0 | |||||
Created-By: Apache Ant Project | |||||
Extension-Name: myrmidon.framework | |||||
Specification-Title: Myrmidon Framework | |||||
Specification-Version: 0.01 | |||||
Specification-Vendor: Jakarta Apache | |||||
Implementation-Vendor-Id: org.apache.jakarta | |||||
Implementation-Vendor: Jakarta Apache Project | |||||
Implementation-Version: 0.01 | |||||
Extension-List: myrmidon.api | |||||
myrmidon.api-Extension-Name: myrmidon.api | |||||
myrmidon.api-Specification-Version: 0.01 | |||||
myrmidon.api-Implementation-Version: 0.01 | |||||
myrmidon.api-Implementation-Vendor-Id: org.apache.jakarta | |||||
_myrmidon.api-Implementation-URL: http://jakarta.apache.org/ant/myrmidon-api.jar |
@@ -42,4 +42,4 @@ else | |||||
fi | fi | ||||
fi | fi | ||||
$JAVACMD $ANT_OPTS -jar $ANT_HOME/lib/ant.jar $@ | |||||
$JAVACMD $ANT_OPTS -jar $ANT_HOME/bin/myrmidon-launcher.jar $@ |
@@ -57,7 +57,7 @@ goto setupArgs | |||||
:doneArgs | :doneArgs | ||||
rem Mmmmmm tasty - finished slurping args | rem Mmmmmm tasty - finished slurping args | ||||
%JAVACMD% %ANT_OPTS% -jar %ANT_HOME%\lib\ant.jar %ANT_CMD_LINE_ARGS% | |||||
%JAVACMD% %ANT_OPTS% -jar %ANT_HOME%\bin\myrmidon-launcher.jar %ANT_CMD_LINE_ARGS% | |||||
:end | :end | ||||
if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat" | if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat" |