From: Nick C. <ch...@us...> - 2004-08-16 05:08:52
|
Update of /cvsroot/antworks/antlets/scripts/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30523/scripts/src Modified Files: xbuild.xml Log Message: Use macrodef. Index: xbuild.xml =================================================================== RCS file: /cvsroot/antworks/antlets/scripts/src/xbuild.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xbuild.xml 22 Mar 2004 01:57:57 -0000 1.2 --- xbuild.xml 16 Aug 2004 05:08:43 -0000 1.3 *************** *** 1,6 **** <?xml version="1.0"?> <!-- $Header$ --> ! <project default="version-stamp" name="scripts.antlet"> ! <description> Generate a script to execute a given java class. Set these parameters as needed: --- 1,6 ---- <?xml version="1.0"?> <!-- $Header$ --> ! <project default="make-main-scripts" name="scripts.antlet"> ! <description> Generate a script to execute a given java class. Set these parameters as needed: *************** *** 9,68 **** scripts.antlet.extra.classpath </description> ! <import file="usage.xml"/> ! ! <!-- Antlet Specific Properties --> ! <dirname property="scripts.antlet.dir" file="${ant.file.scripts.antlet}"/> ! <property name="scripts-antlet:work.dir" ! value="${project.build.dir}/work"/> ! - ! ! <!-- =================================================================== --> ! <!-- Make a execution script for a given class --> ! <!-- =================================================================== --> ! <target name="make-main-scripts" description="Make execution script for a given java class"> ! ! <property name="scripts.antlet.script.name" value="Main"/> ! <property name="scripts.antlet.class" value="mypackage.${scripts.antlet.script.name}"/> ! <property name="scripts.antlet.extra.classpath" value=""/> ! <mkdir dir="${java.antlet:dist.bin.dir}/bin"/> ! <!-- Make sh script --> ! <copy file="${scripts.antlet.dir}/resources/main.sh.template" ! tofile="${java.antlet:dist.bin.dir}/bin/${scripts.antlet.script.name}"> ! <filterset> ! <filter token="PROJECT" value="${project.name}"/> <!-- TODO: Make UPPER CASE--> ! <filter token="PROJECT_JAR" value="${project.version.package-jar}"/> ! <filter token="project" value="${project.name}"/> ! <filter token="MAIN" value="${scripts.antlet.class}"/> ! <filter token="EXTCLASSPATH" value="${scripts.antlet.extra.classpath}"/> ! </filterset> ! </copy> ! <chmod ! file="${java.antlet:dist.bin.dir}/bin/${scripts.antlet.script.name}" ! perm="774"/> ! <!-- Make bat script --> ! <copy file="${scripts.antlet.dir}/resources/main.bat.template" ! tofile="${java.antlet:dist.bin.dir}/bin/${scripts.antlet.script.name}.bat"> ! <filterset> ! <filter token="PROJECT" value="${project.name}"/> <!-- TODO: Make UPPER CASE--> ! <filter token="PROJECT_JAR" value="${project.version.package-jar}"/> ! <filter token="project" value="${project.name}"/> ! <filter token="MAIN" value="${scripts.antlet.class}"/> ! <filter token="EXTCLASSPATH" value="${scripts.antlet.extra.classpath}"/> ! </filterset> ! </copy> ! <copy file="${scripts.antlet.dir}/resources/lcp.bat" ! tofile="${java.antlet:dist.bin.dir}/bin/lcp.bat"/> ! </target> </project> --- 9,79 ---- scripts.antlet.extra.classpath </description> ! <import file="usage.xml" /> ! <!-- Antlet Specific Properties --> + <dirname property="scripts.antlet.dir" file="${ant.file.scripts.antlet}" /> + <property name="scripts-antlet:work.dir" value="${project.build.dir}/work" /> + <!-- = = = = = = = = = = = = = = = = = + macrodef: main-script + = = = = = = = = = = = = = = = = = --> + <macrodef name="main-script"> + <attribute name="name" default="Main" /> + <attribute name="class" /> + <attribute name="extra.classpath" default="" /> + <sequential> ! <mkdir dir="${java.antlet:dist.bin.dir}/bin" /> ! <!-- Make sh script --> ! <copy file="${scripts.antlet.dir}/resources/main.sh.template" tofile="${java.antlet:dist.bin.dir}/bin/@{name}"> ! <filterset> ! <filter token="PROJECT" value="${project.name}" /> ! <!-- TODO: Make UPPER CASE--> ! <filter token="PROJECT_JAR" value="${project.version.package-jar}" /> ! <filter token="project" value="${project.name}" /> ! <filter token="MAIN" value="@{class}" /> ! <filter token="EXTCLASSPATH" value="@{extra.classpath}" /> ! </filterset> ! </copy> ! <chmod file="${java.antlet:dist.bin.dir}/bin/@{name}" perm="774" /> ! <!-- Make bat script --> ! <copy file="${scripts.antlet.dir}/resources/main.bat.template" tofile="${java.antlet:dist.bin.dir}/bin/@{name}.bat"> ! <filterset> ! <filter token="PROJECT" value="${project.name}" /> ! <!-- TODO: Make UPPER CASE--> ! <filter token="PROJECT_JAR" value="${project.version.package-jar}" /> ! <filter token="project" value="${project.name}" /> ! <filter token="MAIN" value="@{class}" /> ! <filter token="EXTCLASSPATH" value="@{extra.classpath}" /> ! </filterset> ! </copy> ! <copy file="${scripts.antlet.dir}/resources/lcp.bat" tofile="${java.antlet:dist.bin.dir}/bin/lcp.bat" /> ! </sequential> ! </macrodef> ! ! ! ! ! ! ! <!-- =================================================================== --> ! <!-- Make a execution script for a given class --> ! <!-- =================================================================== --> ! <target name="make-main-scripts" description="Make execution script for a given java class"> ! <property name="scripts.antlet.script.name" value="Main" /> ! <property name="scripts.antlet.class" value="mypackage.${scripts.antlet.script.name}" /> ! <property name="scripts.antlet.extra.classpath" value="" /> ! ! <main-script name="${scripts.antlet.script.name}" class="${scripts.antlet.class}" extra.classpath="${scripts.antlet.extra.classpath}" /> ! ! ! </target> </project> |