Browse Source

* Renamed the template files.

* 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-ffa450edef68
master
adammurdoch 23 years ago
parent
commit
60551b04f2
5 changed files with 100 additions and 36 deletions
  1. +7
    -10
      proposal/myrmidon/antlib.xml
  2. +23
    -26
      proposal/myrmidon/build.xml
  3. +70
    -0
      proposal/myrmidon/src/make/org/apache/myrmidon/build/AntlibJarTask.java
  4. +0
    -0
      proposal/myrmidon/src/manifest/ant-descriptor.template
  5. +0
    -0
      proposal/myrmidon/src/manifest/ant-roles.template

+ 7
- 10
proposal/myrmidon/antlib.xml View File

@@ -56,24 +56,21 @@ Legal:
<fileset dir="${java.dir}"> <fileset dir="${java.dir}">
<include name="${antlib.include}/*.java" /> <include name="${antlib.include}/*.java" />
</fileset> </fileset>
<template templateFile="${manifest.dir}/core-ant-descriptor.template"
<template templateFile="${manifest.dir}/ant-descriptor.template"
destinationfile="${antlib.descriptor}"/> destinationfile="${antlib.descriptor}"/>
<template templateFile="${manifest.dir}/builtin-ant-roles.template"
<template templateFile="${manifest.dir}/ant-roles.template"
destinationfile="${antlib.role.descriptor}"/> destinationfile="${antlib.role.descriptor}"/>
</xdoclet> </xdoclet>
</target> </target>


<!-- Creates the jars file --> <!-- Creates the jars file -->
<target name="jar" depends="xdoclet"> <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}" /> <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> </target>


</project> </project>

+ 23
- 26
proposal/myrmidon/build.xml View File

@@ -182,6 +182,16 @@ Legal:


</target> </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 --> <!-- Compiles the source code -->
<target name="compile" depends="check_for_optional_packages"> <target name="compile" depends="check_for_optional_packages">
@@ -292,7 +302,7 @@ Legal:
</target> </target>


<!-- Creates the jars file --> <!-- Creates the jars file -->
<target name="jars" depends="compile">
<target name="jars" depends="custom-tasks, compile">


<mkdir dir="${build.lib}"/> <mkdir dir="${build.lib}"/>


@@ -302,9 +312,12 @@ Legal:
<include name="org/apache/myrmidon/launcher/*" /> <include name="org/apache/myrmidon/launcher/*" />
</jar> </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/api/*" />
<include name="org/apache/myrmidon/aspects/*" /> <include name="org/apache/myrmidon/aspects/*" />
<include name="org/apache/myrmidon/converter/*" /> <include name="org/apache/myrmidon/converter/*" />
@@ -316,19 +329,7 @@ Legal:
<!-- <include name="org/apache/myrmidon/*" /> <!-- <include name="org/apache/myrmidon/*" />
<include name="org/apache/myrmidon/components/**"/> <include name="org/apache/myrmidon/components/**"/>
<include name="org/apache/myrmidon/frontends/*" /> --> <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" <jar jarfile="${build.lib}/myrmidon-framework.jar"
@@ -391,18 +392,14 @@ Legal:
</ant> </ant>
--> -->


<jar jarfile="${build.lib}/selftest.atl"
<antlib-jar jarfile="${build.lib}/selftest.atl"
basedir="${build.classes}" 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/**" /> <include name="org/apache/antlib/selftest/**" />
<exclude name="org/apache/antlib/selftest/extension1/**" /> <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" <jar jarfile="${build.lib}/selftest-extension1.jar"
basedir="${build.classes}" basedir="${build.classes}"


+ 70
- 0
proposal/myrmidon/src/make/org/apache/myrmidon/build/AntlibJarTask.java View File

@@ -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 );
}
}

proposal/myrmidon/src/manifest/core-ant-descriptor.template → proposal/myrmidon/src/manifest/ant-descriptor.template View File


proposal/myrmidon/src/manifest/builtin-ant-roles.template → proposal/myrmidon/src/manifest/ant-roles.template View File


Loading…
Cancel
Save