* Added an <antlib-jar> task to the build, for Jar-ing up antlibs. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271449 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -56,24 +56,21 @@ Legal: | |||
| <fileset dir="${java.dir}"> | |||
| <include name="${antlib.include}/*.java" /> | |||
| </fileset> | |||
| <template templateFile="${manifest.dir}/core-ant-descriptor.template" | |||
| <template templateFile="${manifest.dir}/ant-descriptor.template" | |||
| destinationfile="${antlib.descriptor}"/> | |||
| <template templateFile="${manifest.dir}/builtin-ant-roles.template" | |||
| <template templateFile="${manifest.dir}/ant-roles.template" | |||
| destinationfile="${antlib.role.descriptor}"/> | |||
| </xdoclet> | |||
| </target> | |||
| <!-- Creates the jars file --> | |||
| <target name="jar" depends="xdoclet"> | |||
| <jar jarfile="${build.lib}/${antlib.name}.atl" basedir="${build.classes}"> | |||
| <antlib-jar jarfile="${build.lib}/${antlib.name}.atl" | |||
| basedir="${build.classes}" | |||
| descriptor="${gen.dir}/${antlib.descriptor}" | |||
| rolesDescriptor="${gen.dir}/${antlib.role.descriptor}"> | |||
| <include name="${antlib.include}" /> | |||
| <zipfileset dir="${gen.dir}" fullpath="META-INF/ant-descriptor.xml"> | |||
| <include name="${antlib.descriptor}"/> | |||
| </zipfileset> | |||
| <zipfileset dir="${gen.dir}" fullpath="META-INF/ant-roles.xml"> | |||
| <include name="${antlib.role.descriptor}"/> | |||
| </zipfileset> | |||
| </jar> | |||
| </antlib-jar> | |||
| </target> | |||
| </project> | |||
| @@ -182,6 +182,16 @@ Legal: | |||
| </target> | |||
| <!-- Compiles and installs the custom build tasks --> | |||
| <target name="custom-tasks"> | |||
| <property name="custom-tasks-dir" value="${build.dir}/tasks"/> | |||
| <mkdir dir="${custom-tasks-dir}"/> | |||
| <javac srcdir="src/make" destdir="${custom-tasks-dir}"> | |||
| </javac> | |||
| <taskdef name="antlib-jar" classname="org.apache.myrmidon.build.AntlibJarTask"> | |||
| <classpath location="${custom-tasks-dir}"/> | |||
| </taskdef> | |||
| </target> | |||
| <!-- Compiles the source code --> | |||
| <target name="compile" depends="check_for_optional_packages"> | |||
| @@ -292,7 +302,7 @@ Legal: | |||
| </target> | |||
| <!-- Creates the jars file --> | |||
| <target name="jars" depends="compile"> | |||
| <target name="jars" depends="custom-tasks, compile"> | |||
| <mkdir dir="${build.lib}"/> | |||
| @@ -302,9 +312,12 @@ Legal: | |||
| <include name="org/apache/myrmidon/launcher/*" /> | |||
| </jar> | |||
| <jar jarfile="${build.lib}/myrmidon-api.jar" | |||
| basedir="${build.classes}" | |||
| manifest="${manifest.dir}/myrmidon-api.mf"> | |||
| <antlib-jar jarfile="${build.lib}/myrmidon-api.jar" | |||
| basedir="${build.classes}" | |||
| manifest="${manifest.dir}/myrmidon-api.mf" | |||
| rolesDescriptor="${manifest.dir}/builtin-ant-roles.xml" | |||
| descriptor="${manifest.dir}/builtin-ant-descriptor.xml" | |||
| servicesDescriptor="${manifest.dir}/core-services.xml" > | |||
| <include name="org/apache/myrmidon/api/*" /> | |||
| <include name="org/apache/myrmidon/aspects/*" /> | |||
| <include name="org/apache/myrmidon/converter/*" /> | |||
| @@ -316,19 +329,7 @@ Legal: | |||
| <!-- <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"> | |||
| <include name="builtin-ant-roles.xml"/> | |||
| </zipfileset> | |||
| <zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-descriptor.xml"> | |||
| <include name="builtin-ant-descriptor.xml"/> | |||
| </zipfileset> | |||
| <zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-services.xml"> | |||
| <include name="core-services.xml"/> | |||
| </zipfileset> | |||
| </jar> | |||
| </antlib-jar> | |||
| <!-- | |||
| <jar jarfile="${build.lib}/myrmidon-framework.jar" | |||
| @@ -391,18 +392,14 @@ Legal: | |||
| </ant> | |||
| --> | |||
| <jar jarfile="${build.lib}/selftest.atl" | |||
| <antlib-jar jarfile="${build.lib}/selftest.atl" | |||
| basedir="${build.classes}" | |||
| manifest="${manifest.dir}/selftest.mf"> | |||
| manifest="${manifest.dir}/selftest.mf" | |||
| descriptor="${manifest.dir}/selftest-ant-descriptor.xml" | |||
| rolesDescriptor="${manifest.dir}/empty-roles.xml"> | |||
| <include name="org/apache/antlib/selftest/**" /> | |||
| <exclude name="org/apache/antlib/selftest/extension1/**" /> | |||
| <zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-descriptor.xml"> | |||
| <include name="selftest-ant-descriptor.xml"/> | |||
| </zipfileset> | |||
| <zipfileset dir="${manifest.dir}" fullpath="META-INF/ant-roles.xml"> | |||
| <include name="empty-roles.xml"/> | |||
| </zipfileset> | |||
| </jar> | |||
| </antlib-jar> | |||
| <jar jarfile="${build.lib}/selftest-extension1.jar" | |||
| basedir="${build.classes}" | |||
| @@ -0,0 +1,70 @@ | |||
| /* | |||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||
| * | |||
| * This software is published under the terms of the Apache Software License | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE.txt file. | |||
| */ | |||
| package org.apache.myrmidon.build; | |||
| import org.apache.tools.ant.taskdefs.Jar; | |||
| import org.apache.tools.ant.types.ZipFileSet; | |||
| import org.apache.tools.ant.BuildException; | |||
| import java.io.File; | |||
| /** | |||
| * An Ant 1.x task to assemble a Myrmidon Antlib. | |||
| * | |||
| * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||
| * @version $Revision$ $Date$ | |||
| */ | |||
| public class AntlibJarTask | |||
| extends Jar | |||
| { | |||
| private File m_roleDescriptor; | |||
| private File m_typeDescriptor; | |||
| private File m_serviceDescriptor; | |||
| public void setRolesDescriptor( final File roleDescriptor ) | |||
| { | |||
| m_roleDescriptor = roleDescriptor; | |||
| } | |||
| public void setDescriptor( final File typeDescriptor ) | |||
| { | |||
| m_typeDescriptor = typeDescriptor; | |||
| } | |||
| public void setServicesDescriptor( final File serviceDescriptor ) | |||
| { | |||
| m_serviceDescriptor = serviceDescriptor; | |||
| } | |||
| public void execute() throws BuildException | |||
| { | |||
| maybeAddFile( m_roleDescriptor, "META-INF/ant-roles.xml" ); | |||
| maybeAddFile( m_typeDescriptor, "META-INF/ant-descriptor.xml" ); | |||
| maybeAddFile( m_serviceDescriptor, "META-INF/ant-services.xml" ); | |||
| super.execute(); | |||
| } | |||
| private void maybeAddFile( final File file, final String path ) | |||
| { | |||
| if( file == null ) | |||
| { | |||
| return; | |||
| } | |||
| if( ! file.isFile() ) | |||
| { | |||
| throw new BuildException( "File \"" + file + "\" does not exist or is not a file." ); | |||
| } | |||
| // Create a ZipFileSet for this file, and pass it up. | |||
| final ZipFileSet fs = new ZipFileSet(); | |||
| fs.setDir( file.getParentFile() ); | |||
| fs.setIncludes( file.getName() ); | |||
| fs.setFullpath( path ); | |||
| addFileset( fs ); | |||
| } | |||
| } | |||