conor 02/02/18 04:36:05
Modified: proposal/mutant build.xml
proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib
AntLibHandler.java AntLibManager.java
ClassNameHandler.java ComponentLibrary.java
DefinitionHandler.java DynamicLibrary.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/config
AntConfigHandler.java LibPathHandler.java
LoadLibHandler.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution
ComponentManager.java CoreDataService.java
CoreEventService.java CoreFileService.java
ExecutionContext.java Frame.java TaskContext.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser
IncludeHandler.java ProjectHandler.java
RefHandler.java TargetHandler.java
proposal/mutant/src/java/antlibs/ant1compat antlib.xml
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant
Project.java
proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system
Import.java
proposal/mutant/src/java/cli/org/apache/ant/cli
Commandline.java DefaultLogger.java
proposal/mutant/src/java/common/org/apache/ant/common/event
BuildEvent.java MessageLevel.java
proposal/mutant/src/java/common/org/apache/ant/common/model
Project.java
proposal/mutant/src/java/common/org/apache/ant/common/service
ComponentService.java MagicProperties.java
proposal/mutant/src/java/common/org/apache/ant/common/util
Location.java StringUtils.java
proposal/mutant/src/java/init/org/apache/ant/init
ClassLocator.java LoaderUtils.java
proposal/mutant/src/java/start/org/apache/ant/start
Main.java
Added: proposal/mutant .cvsignore bootstrap.sh build.sh
proposal/mutant/build ant1compat.xml bootstrap.xml
bootstrap.xsl docs.xml script.xml
proposal/mutant/src/java/bootstrap/org/apache/ant/bootstrap
Bootstrap.java
proposal/mutant/src/java/bootstrap/org/apache/ant/builder
Ant1CompatBuilder.java BuildHelper.java
Builder.java MutantBuilder.java
Removed: proposal/mutant ant1compat.xml script.xml
Log:
Mutant can now bootstrap itself
Upgraded to checkstyle 2.1
Revision Changes Path
1.13 +5 -3 jakarta-ant/proposal/mutant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/build.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -u -r1.12 -r1.13
--- build.xml 11 Feb 2002 15:42:17 -0000 1.12
+++ build.xml 18 Feb 2002 12:36:03 -0000 1.13
@@ -1,4 +1,4 @@
-<project default="main" name="mutant">
+<project default="main" name="Mutant">
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib"/>
@@ -103,7 +103,7 @@
</target>
<target name="ant1compat" depends="common">
- <ant antfile="ant1compat.xml"/>
+ <ant antfile="build/ant1compat.xml" />
</target>
<target name="remote" depends="init">
@@ -130,7 +130,7 @@
<antcall target="build-lib" inheritall="false">
<param name="libset" value="system"/>
</antcall>
- <ant antfile="script.xml" inheritAll="false"/>
+ <ant antfile="build/script.xml" inheritAll="false"/>
</target>
<target name="build-lib">
@@ -174,6 +174,8 @@
<exclude name="**/org/apache/tools/ant/Task.java"/>
<exclude name="**/org/apache/tools/ant/ProjectComponent.java"/>
<exclude name="**/org/apache/tools/ant/types/DataType.java"/>
+ <exclude name="**/builder/MutantBuilder.java"/>
+ <exclude name="**/builder/Ant1CompatBuilder.java"/>
</fileset>
</checkstyle>
<checkstyle maxlinelen="80"
1.1 jakarta-ant/proposal/mutant/.cvsignore
Index: .cvsignore
===================================================================
bin
dist
bootstrap
1.1 jakarta-ant/proposal/mutant/bootstrap.sh
Index: bootstrap.sh
===================================================================
#!/bin/sh
# Copyright (c) 2000-2001 The Apache Software Foundation. All rights
# reserved.
# cleanup curretn boot area
rm -rf bin bootstrap
# compile init jar
mkdir -p bin/init
javac -d bin/init src/java/init/org/apache/ant/init/*.java
# compile bootstrap classes
mkdir bin/bootstrap
javac -classpath bin/init -d bin/bootstrap
src/java/bootstrap/org/apache/ant/bootstrap/*.java
# compiler builder classes
mkdir bin/builder
javac -classpath bin/init:bin/bootstrap -d bin/builder
src/java/bootstrap/org/apache/ant/builder/*.java
# run bootstrap
java -classpath bin/init:bin/bootstrap org.apache.ant.bootstrap.Bootstrap
# run full build using bootstrapped version
java -classpath bootstrap/lib/start.jar:bootstrap/lib/init.jar
org.apache.ant.start.Main $*
# Use the full build as the build used by the build script
cp -r dist/* bootstrap
1.1 jakarta-ant/proposal/mutant/build.sh
Index: build.sh
===================================================================
#!/bin/sh
# Copyright (c) 2000-2001 The Apache Software Foundation. All rights
# reserved.
java -classpath bootstrap/lib/start.jar:bootstrap/lib/init.jar
org.apache.ant.start.Main $*
1.1 jakarta-ant/proposal/mutant/build/ant1compat.xml
Index: ant1compat.xml
===================================================================
<project default="ant1compat" name="Ant1Compat" basedir="..">
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="java.dir" value="${src.dir}/java"/>
<property name="bin.dir" value="bin"/>
<property name="dist.dir" value="dist"/>
<property name="javadocs.dir" value="${dist.dir}/javadocs"/>
<property name="distlib.dir" value="${dist.dir}/lib"/>
<property name="debug" value="true"/>
<property name="ant.package" value="org/apache/tools/ant"/>
<property name="optional.package" value="${ant.package}/taskdefs/optional"/>
<property name="optional.type.package"
value="${ant.package}/types/optional"/>
<property name="util.package" value="${ant.package}/util"/>
<property name="regexp.package" value="${util.package}/regexp"/>
<patternset id="deprecated">
<exclude name="org/apache/tools/ant/taskdefs/Copydir.java"/>
<exclude name="org/apache/tools/ant/taskdefs/Copyfile.java"/>
</patternset>
<patternset id="toohard">
<exclude name="org/apache/tools/ant/taskdefs/AntStructure.java"/>
<exclude name="org/apache/tools/ant/taskdefs/Recorder.java"/>
<exclude name="org/apache/tools/ant/taskdefs/RecorderEntry.java"/>
<exclude name="org/apache/tools/ant/taskdefs/optional/Native2Ascii.java"/>
<exclude name="org/apache/tools/ant/taskdefs/optional/Javah.java"/>
<exclude name="org/apache/tools/ant/taskdefs/Parallel.java"/>
<exclude name="org/apache/tools/ant/taskdefs/Sequential.java"/>
<exclude name="org/apache/tools/ant/taskdefs/optional/jdepend/*.java"/>
</patternset>
<patternset id="converted">
<exclude name="org/apache/tools/ant/taskdefs/Ant.java"/>
<exclude name="org/apache/tools/ant/taskdefs/CallTarget.java"/>
</patternset>
<fileset id="ant1src" dir="../../src/main">
<include name="**/*.properties"/>
<include name="**/*.mf"/>
<include name="org/apache/tools/ant/taskdefs/**/*.java"/>
<include name="org/apache/tools/ant/types/**/*.java"/>
<exclude name="org/apache/tools/ant/types/DataType.java"/>
<include name="org/apache/tools/ant/util/**/*.java"/>
<include name="org/apache/tools/zip/**/*.java"/>
<include name="org/apache/tools/bzip2/**/*.java"/>
<include name="org/apache/tools/mail/**/*.java"/>
<include name="org/apache/tools/tar/**/*.java"/>
<include name="org/apache/tools/ant/BuildException.java"/>
<include name="org/apache/tools/ant/ExitException.java"/>
<include name="org/apache/tools/ant/DirectoryScanner.java"/>
<include name="org/apache/tools/ant/PathTokenizer.java"/>
<include name="org/apache/tools/ant/FileScanner.java"/>
<include name="org/apache/tools/ant/TaskAdapter.java"/>
<include name="org/apache/tools/ant/Location.java"/>
<include name="org/apache/tools/ant/AntClassLoader.java"/>
<include name="org/apache/tools/ant/BuildEvent.java"/>
<include name="org/apache/tools/ant/BuildListener.java"/>
<!-- <patternset refid="deprecated"/> -->
<patternset refid="toohard"/>
<patternset refid="converted"/>
</fileset>
<path id="classpath">
<pathelement location="${distlib.dir}/init.jar"/>
<fileset dir="${lib.dir}/parser" includes="*.jar"/>
<fileset dir="${lib.dir}/ant1compat" includes="*.jar"/>
<pathelement location="${distlib.dir}/common/common.jar"/>
</path>
<target name="check_for_optional_packages">
<available property="jdk1.2+" classname="java.lang.ThreadLocal" />
<available property="jdk1.3+" classname="java.lang.StrictMath" />
<available property="jdk1.4+" classname="java.lang.CharSequence" />
<available property="bsf.present"
classname="com.ibm.bsf.BSFManager"
classpathref="classpath" />
<available property="netrexx.present"
classname="netrexx.lang.Rexx"
classpathref="classpath" />
<available property="trax.present"
classname="javax.xml.transform.Transformer"
classpathref="classpath" />
<available property="xslp.present"
classname="com.kvisco.xsl.XSLProcessor"
classpathref="classpath" />
<available property="xalan.present"
classname="org.apache.xalan.xslt.XSLTProcessorFactory"
classpathref="classpath" />
<available property="xalan2.present"
classname="org.apache.xalan.transformer.TransformerImpl"
classpathref="classpath" />
<available property="ejb.ejbc.present"
classname="weblogic.ejbc"
classpathref="classpath" />
<available property="ejb.DDCreator.present"
classname="weblogic.ejb.utils.DDCreator"
classpathref="classpath" />
<available property="ejb.wls.present"
classname="weblogic.Server"
classpathref="classpath" />
<available property="junit.present"
classname="junit.framework.TestCase"
classpathref="classpath" />
<available property="netcomp.present"
classname="com.oroinc.net.ftp.FTPClient"
classpathref="classpath" />
<available property="starteam.present"
classname="com.starbase.util.Platform"
classpathref="classpath" />
<available property="antlr.present"
classname="antlr.Tool"
classpathref="classpath"/>
<available property="vaj.present"
classname="com.ibm.ivj.util.base.Workspace"
classpathref="classpath"/>
<available property="stylebook.present"
classname="org.apache.stylebook.Engine"
classpathref="classpath"/>
<available property="jakarta.regexp.present"
classname="org.apache.regexp.RE"
classpathref="classpath"/>
<available property="jakarta.oro.present"
classname="org.apache.oro.text.regex.Perl5Matcher"
classpathref="classpath" />
<available property="jmf.present"
classname="javax.sound.sampled.Clip"
classpathref="classpath"/>
<available property="icontract.present"
classname="com.reliablesystems.iContract.IContracted"
classpathref="classpath"/>
<available property="jdepend.present"
classname="jdepend.framework.JDepend"
classpathref="classpath"/>
<available property="log4j.present"
classname="org.apache.log4j.Category"
classpathref="classpath"/>
<!-- this is just a way to check for a TraX implementation -->
<available property="trax.impl.present"
resource="META-INF/services/javax.xml.transform.TransformerFactory"
classpathref="classpath"/>
<available property="xalan.envcheck"
classname="org.apache.xalan.xslt.EnvironmentCheck"
classpathref="classpath" />
<available property="which.present"
classname="org.apache.env.Which"
classpathref="classpath" />
<available property="servlet.present"
classname="javax.servlet.Servlet"
classpathref="classpath"/>
<available property="xerces.present"
classname="org.apache.xerces.parsers.SAXParser"
classpathref="classpath" />
<available property="bcel.present"
classname="org.apache.bcel.Constants"
classpathref="classpath" />
<available property="sunuue.present"
classname="sun.misc.UUEncoder"
classpathref="classpath" />
<condition property="javamail.complete">
<and>
<available classname="javax.activation.DataHandler"
classpathref="classpath"/>
<available classname="javax.mail.Transport"
classpathref="classpath"/>
</and>
</condition>
<condition property="some.regexp.support">
<or>
<isset property="jdk1.4+" />
<isset property="jakarta.regexp.present" />
<isset property="jakarta.oro.present" />
</or>
</condition>
<condition property="ejbjar.support">
<and>
<isset property="bcel.present" />
<isset property="jdk1.2+" />
</and>
</condition>
</target>
<target name="ant1compat" depends="check_for_optional_packages">
<mkdir dir="${bin.dir}/ant1src"/>
<mkdir dir="${bin.dir}/ant1compat"/>
<copy todir="${bin.dir}/ant1src">
<fileset refid="ant1src"/>
</copy>
<depend destdir="${bin.dir}/ant1compat"
srcdir="${bin.dir}/ant1src;${java.dir}/antlibs/ant1compat">
<classpath refid="classpath"/>
</depend>
<javac destdir="${bin.dir}/ant1compat"
srcdir="${bin.dir}/ant1src:${java.dir}/antlibs/ant1compat"
debug="${debug}">
<classpath refid="classpath"/>
<exclude name="${regexp.package}/JakartaRegexp*.java"
unless="jakarta.regexp.present" />
<exclude name="${regexp.package}/JakartaOro*.java"
unless="jakarta.oro.present" />
<exclude name="${regexp.package}/Jdk14Regexp*.java"
unless="jdk1.4+" />
<exclude name="${ant.package}/AntSecurityManager.java"
unless="jdk1.2+" />
<exclude name="${ant.package}/util/optional/NoExitSecurityManager.java"
unless="jdk1.2+" />
<exclude name="${ant.package}/listener/Log4jListener.java"
unless="log4j.present" />
<exclude name="${ant.package}/taskdefs/email/UUMailer.java"
unless="sunuue.present" />
<exclude name="${ant.package}/taskdefs/email/MimeMailer.java"
unless="javamail.complete" />
<exclude name="${optional.package}/IContract.java"
unless="icontract.present" />
<exclude name="${optional.package}/Script.java" unless="bsf.present" />
<exclude name="${optional.package}/StyleBook.java"
unless="stylebook.present" />
<exclude name="${optional.package}/NetRexxC.java"
unless="netrexx.present" />
<exclude name="${optional.package}/TraXLiaison.java"
unless="trax.present" />
<exclude name="${optional.package}/XslpLiaison.java"
unless="xslp.present" />
<exclude name="${optional.package}/XalanLiaison.java"
unless="xalan.present" />
<exclude name="${optional.package}/ejb/Ejbc*.java"
unless="ejb.ejbc.present" />
<exclude name="${optional.package}/ejb/DDCreator*.java"
unless="ejb.DDCreator.present" />
<exclude name="${optional.package}/ejb/WLRun.java"
unless="ejb.wls.present" />
<exclude name="${optional.package}/ejb/WLStop.java"
unless="ejb.wls.present" />
<exclude name="${optional.package}/ejb/EjbJar.java"
unless="ejbjar.support" />
<exclude name="${optional.package}/ejb/*DeploymentTool.java"
unless="ejbjar.support" />
<exclude name="${optional.package}/ejb/IPlanet*.java"
unless="ejbjar.support" />
<exclude name="${optional.package}/Javah.java" unless="jdk1.2+" />
<exclude name="${optional.package}/junit/*" unless="junit.present" />
<exclude name="${optional.package}/net/FTP.java"
unless="netcomp.present" />
<exclude name="${optional.package}/net/TelnetTask.java"
unless="netcomp.present" />
<exclude name="${optional.package}/scm/AntStarTeam*.java"
unless="starteam.present" />
<exclude name="${optional.package}/starteam/*.java"
unless="starteam.present" />
<exclude name="${optional.package}/ANTLR.java" unless="antlr.present" />
<exclude name="${optional.package}/ide/VAJ*.java" unless="vaj.present"
/>
<exclude name="${optional.package}/ide/VAJ*Servlet.java"
unless="servlet.present" />
<exclude name="${optional.package}/perforce/*.java"
unless="jakarta.oro.present" />
<exclude name="${optional.package}/sound/*.java" unless="jmf.present" />
<exclude name="${optional.package}/junit/XMLResultAggregator.java"
unless="trax.present" />
<exclude name="${optional.package}/junit/AggregateTransformer.java"
unless="trax.present" />
<exclude name="${optional.package}/junit/XMLResultAggregator.java"
unless="xalan2.present" />
<exclude name="${optional.package}/junit/AggregateTransformer.java"
unless="xalan2.present" />
<exclude name="${optional.package}/junit/XalanExecutor.java"
unless="xalan2.present" />
<exclude name="${optional.package}/junit/Xalan2Executor.java"
unless="xalan2.present" />
<exclude name="${optional.package}/junit/Xalan1Executor.java"
unless="xalan.present" />
<exclude name="${optional.package}/jdepend/*" unless="jdepend.present"
/>
<exclude name="${optional.package}/sitraka/**"
unless="some.regexp.support"/>
<exclude name="${optional.package}/metamata/MAudit*"
unless="jakarta.oro.present"/>
<exclude name="${optional.package}/metamata/MMetrics*"
unless="trax.present"/>
<exclude name="${optional.package}/metamata/**" unless="jdk1.2+" />
<exclude name="${optional.type.package}/depend/*.java"
unless="bcel.present" />
<exclude name="${util.package}/depend/*.java"
unless="bcel.present" />
<exclude name="${optional.type.package}/depend/*.java"
unless="jdk1.2+" />
<exclude name="${util.package}/depend/*.java"
unless="jdk1.2+" />
</javac>
<copy todir="${bin.dir}/ant1compat">
<fileset dir="${bin.dir}/ant1src" excludes="**/*.java"/>
</copy>
<jar basedir="${bin.dir}/ant1compat"
jarfile="${distlib.dir}/antlibs/ant1compat.jar">
<metainf dir="${java.dir}/antlibs/ant1compat"
includes="antlib.xml"/>
</jar>
</target>
<target name="clean">
<delete dir="${bin.dir}/ant1src"/>
<delete dir="${bin.dir}/ant1compat"/>
</target>
</project>
1.1 jakarta-ant/proposal/mutant/build/bootstrap.xml
Index: bootstrap.xml
===================================================================
<project name="mutant-bootstrap" default="main" basedir="..">
<target name="main">
<style in="build.xml"
out="src/java/bootstrap/org/apache/ant/builder/MutantBuilder.java"
style="build/bootstrap.xsl"/>
<style in="build/ant1compat.xml"
out="src/java/bootstrap/org/apache/ant/builder/Ant1CompatBuilder.java"
style="build/bootstrap.xsl"/>
</target>
</project>
1.1 jakarta-ant/proposal/mutant/build/bootstrap.xsl
Index: bootstrap.xsl
===================================================================
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="project">
<xsl:text>package org.apache.ant.builder; </xsl:text>
<xsl:text>public class </xsl:text>
<xsl:value-of select="attribute::name"/>
<xsl:text>Builder { </xsl:text>
<xsl:text> protected void _init(BuildHelper helper) { </xsl:text>
<xsl:apply-templates select="property"/>
<xsl:apply-templates select="path"/>
<xsl:text> } </xsl:text>
<xsl:apply-templates select="target"/>
<xsl:text>} </xsl:text>
</xsl:template>
<xsl:template match="property">
<xsl:text> helper.setProperty("</xsl:text>
<xsl:value-of select="attribute::name"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="attribute::value"/>
<xsl:text>"); </xsl:text>
</xsl:template>
<xsl:template match="path">
<xsl:text> helper.createPath("</xsl:text>
<xsl:variable name="pathName" select="attribute::id"/>
<xsl:value-of select="$pathName"/>
<xsl:text>"); </xsl:text>
<xsl:for-each select="fileset">
<xsl:text> </xsl:text>
<xsl:text>helper.addFileSetToPath("</xsl:text>
<xsl:value-of select="$pathName"/>
<xsl:text>", </xsl:text>
<xsl:text> "</xsl:text>
<xsl:value-of select="attribute::dir"/>
<xsl:text>", </xsl:text>
<xsl:choose>
<xsl:when test="attribute::includes">
<xsl:text>"</xsl:text>
<xsl:value-of select="attribute::includes"/>
<xsl:text>"</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>null</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>); </xsl:text>
</xsl:for-each>
<xsl:for-each select="pathelement">
<xsl:text> </xsl:text>
<xsl:text>helper.addPathElementToPath("</xsl:text>
<xsl:value-of select="$pathName"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="attribute::location"/>
<xsl:text>"); </xsl:text>
</xsl:for-each>
<xsl:for-each select="path">
<xsl:text> </xsl:text>
<xsl:text>helper.addPathToPath("</xsl:text>
<xsl:value-of select="$pathName"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="attribute::refid"/>
<xsl:text>"); </xsl:text>
</xsl:for-each>
</xsl:template>
<xsl:template match="target">
<xsl:text> protected void </xsl:text>
<xsl:value-of select="translate(attribute::name, '-', '_')"/>
<xsl:text>(BuildHelper helper) { </xsl:text>
<xsl:apply-templates/>
<xsl:text> } </xsl:text>
</xsl:template>
<xsl:template match="mkdir">
<xsl:text> helper.mkdir("</xsl:text>
<xsl:value-of select="attribute::dir"/>
<xsl:text>"); </xsl:text>
</xsl:template>
<xsl:template match="javac">
<xsl:text> helper.javac("</xsl:text>
<xsl:value-of select="attribute::srcdir"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="attribute::destdir"/>
<xsl:text>", </xsl:text>
<xsl:choose>
<xsl:when test="classpath">
<xsl:text>"</xsl:text>
<xsl:value-of select="classpath/attribute::refid"/>
<xsl:text>"</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>null</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>); </xsl:text>
</xsl:template>
<xsl:template match="jar">
<xsl:text> helper.jar("</xsl:text>
<xsl:value-of select="attribute::basedir"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="attribute::jarfile"/>
<xsl:text>", </xsl:text>
<xsl:choose>
<xsl:when test="metainf">
<xsl:text>"</xsl:text>
<xsl:value-of select="metainf/attribute::dir"/>
<xsl:text>", </xsl:text>
<xsl:choose>
<xsl:when test="metainf/attribute::includes">
<xsl:text>"</xsl:text>
<xsl:value-of select="metainf/attribute::includes"/>
<xsl:text>"</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>null</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>null, null</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>); </xsl:text>
</xsl:template>
<xsl:template match="copy/fileset">
<xsl:choose>
<xsl:when test="attribute::refid">
<xsl:text> helper.copyFilesetRef("</xsl:text>
<xsl:value-of select="attribute::refid"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="../attribute::todir"/>
<xsl:text>"); </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> helper.copyFileset("</xsl:text>
<xsl:value-of select="attribute::dir"/>
<xsl:text>", "</xsl:text>
<xsl:value-of select="../attribute::todir"/>
<xsl:text>"); </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
1.1 jakarta-ant/proposal/mutant/build/docs.xml
Index: docs.xml
===================================================================
<project name="build-site" default="docs" basedir=".">
<!-- Initialization properties -->
<property name="project.name" value="mutant"/>
<property name="docs.src" location="xdocs"/>
<property name="docs.dest" location="docs"/>
<property name="project.file" value="stylesheets/project.xml" />
<property name="site.dir" location="../../../jakarta-site2" />
<property name="templ.path" location="xdocs/stylesheets" />
<property name="velocity.props"
location="${docs.src}/velocity.properties" />
<path id="anakia.classpath">
<fileset dir="${site.dir}/lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="prepare">
<available classname="org.apache.velocity.anakia.AnakiaTask"
property="AnakiaTask.present">
<classpath refid="anakia.classpath"/>
</available>
</target>
<target depends="prepare" name="prepare-error"
unless="AnakiaTask.present">
<echo>
AnakiaTask is not present! Please check to make sure that
velocity.jar is in your classpath.
</echo>
</target>
<target name="docs" depends="prepare-error" if="AnakiaTask.present">
<taskdef name="anakia"
classname="org.apache.velocity.anakia.AnakiaTask">
<classpath refid="anakia.classpath"/>
</taskdef>
<anakia basedir="${docs.src}" destdir="${docs.dest}/"
extension=".html" style="./site.vsl"
projectFile="${project.file}"
excludes="**/stylesheets/** faq.xml"
includes="**/*.xml"
lastModifiedCheck="true"
templatePath="${templ.path}"
velocityPropertiesFile="${velocity.props}">
</anakia>
</target>
<target name="all" depends="docs"/>
</project>
1.1 jakarta-ant/proposal/mutant/build/script.xml
Index: script.xml
===================================================================
<project default="build" name="Ant2 script tasks" basedir="..">
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="java.dir" value="${src.dir}/java"/>
<property name="bin.dir" value="bin"/>
<property name="dist.dir" value="dist"/>
<property name="javadocs.dir" value="${dist.dir}/javadocs"/>
<property name="distlib.dir" value="${dist.dir}/lib"/>
<property name="debug" value="true"/>
<property name="ant.package" value="org/apache/tools/ant"/>
<property name="optional.package" value="${ant.package}/taskdefs/optional"/>
<property name="optional.type.package"
value="${ant.package}/types/optional"/>
<property name="util.package" value="${ant.package}/util"/>
<property name="regexp.package" value="${util.package}/regexp"/>
<path id="classpath.script">
<pathelement location="${distlib.dir}/init.jar"/>
<fileset dir="${lib.dir}/antlib/script" includes="*.jar"/>
<pathelement location="${distlib.dir}/common/common.jar"/>
</path>
<target name="check_bsf">
<available property="bsf.present"
classname="com.ibm.bsf.BSFManager"
classpathref="classpath.script" />
</target>
<target name="nobsf" unless="bsf.present">
<echo message="You must provide the bsf.jar library in the
${lib.dir}/antlib/script directory"/>
</target>
<target name="build" depends="check_bsf, nobsf" if="bsf.present">
<mkdir dir="${bin.dir}/antlibs/script"/>
<mkdir dir="${distlib.dir}/antlibs"/>
<depend destdir="${bin.dir}/antlibs/script"
srcdir="${java.dir}/antlibs/script">
<classpath refid="classpath.script"/>
</depend>
<javac destdir="${bin.dir}/antlibs/script"
srcdir="${java.dir}/antlibs/script" debug="${debug}">
<classpath refid="classpath.script"/>
</javac>
<jar basedir="${bin.dir}/antlibs/script"
jarfile="${distlib.dir}/antlibs/script.tsk">
<metainf dir="${java.dir}/antlibs/script"
includes="antlib.xml"/>
</jar>
</target>
</project>
1.5 +7 -7
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibHandler.java
Index: AntLibHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- AntLibHandler.java 5 Feb 2002 11:49:04 -0000 1.4
+++ AntLibHandler.java 18 Feb 2002 12:36:03 -0000 1.5
@@ -65,24 +65,24 @@
*/
public class AntLibHandler extends ElementHandler {
/** The library identifier attribute name */
- public final static String LIBID_ATTR = "libid";
+ public static final String LIBID_ATTR = "libid";
/** The home attribute name */
- public final static String HOME_ATTR = "home";
+ public static final String HOME_ATTR = "home";
/**
* The name of the attribute which indicates if Ant's XML parser is to
* be made available
*/
- public final static String REQXML_ATTR = "reqxml";
+ public static final String REQXML_ATTR = "reqxml";
/** The extends attribute name */
- public final static String EXTENDS_ATTR = "extends";
+ public static final String EXTENDS_ATTR = "extends";
/** The name of the attribute which indicates tools jar is required */
- public final static String REQTOOLS_ATTR = "reqtools";
+ public static final String REQTOOLS_ATTR = "reqtools";
/** The extends attribute name */
- public final static String ISOLATED_ATTR = "isolated";
+ public static final String ISOLATED_ATTR = "isolated";
/** The list of allowed Attributes */
- public final static String[] ALLOWED_ATTRIBUTES
+ public static final String[] ALLOWED_ATTRIBUTES
= {LIBID_ATTR, HOME_ATTR, REQXML_ATTR, REQTOOLS_ATTR,
EXTENDS_ATTR, ISOLATED_ATTR};
1.4 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java
Index: AntLibManager.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- AntLibManager.java 11 Feb 2002 15:42:17 -0000 1.3
+++ AntLibManager.java 18 Feb 2002 12:36:03 -0000 1.4
@@ -78,7 +78,7 @@
public class AntLibManager {
/** The list of extensions which are examined for ant libraries */
- public final static String[] ANTLIB_EXTENSIONS
+ public static final String[] ANTLIB_EXTENSIONS
= new String[]{".tsk", ".jar", ".zip"};
/** Flag which indicates whether non-file URLS are used */
1.2 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/ClassNameHandler.java
Index: ClassNameHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/ClassNameHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- ClassNameHandler.java 2 Feb 2002 14:50:30 -0000 1.1
+++ ClassNameHandler.java 18 Feb 2002 12:36:03 -0000 1.2
@@ -63,7 +63,7 @@
*/
public class ClassNameHandler extends ElementHandler {
/** The classname attribute name */
- public final static String CLASSNAME_ATTR = "classname";
+ public static final String CLASSNAME_ATTR = "classname";
/**
* Gets the className of the Converter
1.2 +2 -2
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/ComponentLibrary.java
Index: ComponentLibrary.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/ComponentLibrary.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- ComponentLibrary.java 8 Feb 2002 13:04:45 -0000 1.1
+++ ComponentLibrary.java 18 Feb 2002 12:36:03 -0000 1.2
@@ -64,9 +64,9 @@
*/
public interface ComponentLibrary {
/** constant indicating a taskdef definition */
- final static int TASKDEF = 1;
+ public static final int TASKDEF = 1;
/** constant indicating a typedef definition */
- final static int TYPEDEF = 2;
+ public static final int TYPEDEF = 2;
/**
* Gets the ClassLoader of the AntLibrary
1.3 +2 -2
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/DefinitionHandler.java
Index: DefinitionHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/DefinitionHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- DefinitionHandler.java 22 Jan 2002 23:03:11 -0000 1.2
+++ DefinitionHandler.java 18 Feb 2002 12:36:03 -0000 1.3
@@ -64,10 +64,10 @@
*/
public class DefinitionHandler extends ElementHandler {
/** The name attribute name */
- public final static String NAME_ATTR = "name";
+ public static final String NAME_ATTR = "name";
/** The classname attribute name */
- public final static String CLASSNAME_ATTR = "classname";
+ public static final String CLASSNAME_ATTR = "classname";
/** the type of the definition */
private String definitionType;
1.3 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/DynamicLibrary.java
Index: DynamicLibrary.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/DynamicLibrary.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- DynamicLibrary.java 11 Feb 2002 15:42:17 -0000 1.2
+++ DynamicLibrary.java 18 Feb 2002 12:36:03 -0000 1.3
@@ -65,7 +65,7 @@
*/
public class DynamicLibrary implements ComponentLibrary {
/** The name profix for naming dynamic libraries */
- public final static String DYNAMIC_LIB_PREFIX = "_internal";
+ public static final String DYNAMIC_LIB_PREFIX = "_internal";
/** A static field used to uniquely name dynamic libraries */
private static int dynamicIdCounter = 0;
1.6 +4 -4
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfigHandler.java
Index: AntConfigHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfigHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- AntConfigHandler.java 6 Feb 2002 12:52:57 -0000 1.5
+++ AntConfigHandler.java 18 Feb 2002 12:36:04 -0000 1.6
@@ -65,16 +65,16 @@
*/
public class AntConfigHandler extends ElementHandler {
/** The allowRemoteProject attribute name */
- public final static String REMOTE_PROJECT_ATTR = "allow-remote-project";
+ public static final String REMOTE_PROJECT_ATTR = "allow-remote-project";
/** The allowRemoteLibrary attribute name */
- public final static String REMOTE_LIBRARY_ATTR = "allow-remote-library";
+ public static final String REMOTE_LIBRARY_ATTR = "allow-remote-library";
/** The allowReportProject attribute name */
- public final static String UNSET_PROPS_ATTR = "allow-unset-properties";
+ public static final String UNSET_PROPS_ATTR = "allow-unset-properties";
/** The list of allowed Attributes */
- public final static String[] ALLOWED_ATTRIBUTES
+ public static final String[] ALLOWED_ATTRIBUTES
= {REMOTE_PROJECT_ATTR, REMOTE_LIBRARY_ATTR, UNSET_PROPS_ATTR};
/**
* The config object which is contructed from the XML representation of
1.3 +3 -3
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/LibPathHandler.java
Index: LibPathHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/LibPathHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- LibPathHandler.java 22 Jan 2002 23:03:11 -0000 1.2
+++ LibPathHandler.java 18 Feb 2002 12:36:04 -0000 1.3
@@ -64,11 +64,11 @@
*/
public class LibPathHandler extends ElementHandler {
/** The library identifier attribute name */
- public final static String LIBID_ATTR = "libid";
+ public static final String LIBID_ATTR = "libid";
/** The path attribute name */
- public final static String PATH_ATTR = "path";
+ public static final String PATH_ATTR = "path";
/** The path attribute name */
- public final static String URL_ATTR = "url";
+ public static final String URL_ATTR = "url";
/**
* Get the libraryId for which the additional path is being defined
1.2 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/LoadLibHandler.java
Index: LoadLibHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/LoadLibHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- LoadLibHandler.java 2 Feb 2002 14:50:31 -0000 1.1
+++ LoadLibHandler.java 18 Feb 2002 12:36:04 -0000 1.2
@@ -64,7 +64,7 @@
*/
public class LoadLibHandler extends ElementHandler {
/** The location attribute name */
- public final static String LOCATION_ATTR = "location";
+ public static final String LOCATION_ATTR = "location";
/**
* Get the location of the additional search directory
1.5 +34 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java
Index: ComponentManager.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- ComponentManager.java 11 Feb 2002 15:42:18 -0000 1.4
+++ ComponentManager.java 18 Feb 2002 12:36:04 -0000 1.5
@@ -82,7 +82,7 @@
*/
public class ComponentManager implements ComponentService {
/** The prefix for library ids that are automatically imported */
- public final static String ANT_LIB_PREFIX = "ant.";
+ public static final String ANT_LIB_PREFIX = "ant.";
/**
* Type converters for this frame. Converters are used when configuring
@@ -268,6 +268,38 @@
}
/**
+ * Imports a component defined in a nother frame.
+ *
+ * @param relativeName the qualified name of the component relative to
+ * this execution frame
+ * @param alias the name under which this component will be used in the
+ * build scripts. If this is null, the components default name is
+ * used.
+ * @exception ExecutionException if the component cannot be imported
+ */
+ public void importFrameComponent(String relativeName, String alias)
+ throws ExecutionException {
+ ImportInfo definition
+ = frame.getReferencedDefinition(relativeName);
+
+ if (definition == null) {
+ throw new ExecutionException("The reference \"relativeName\"
does"
+ + " not refer to a defined component");
+ }
+
+ String label = alias;
+ if (label == null) {
+ label = frame.getNameInFrame(relativeName);
+ }
+
+ frame.log("Adding referenced component <" +
definition.getLocalName()
+ + "> as <" + label + "> from library \""
+ + definition.getComponentLibrary().getLibraryId() + "\", class:
"
+ + definition.getClassName(), MessageLevel.MSG_DEBUG);
+ definitions.put(label, definition);
+ }
+
+ /**
* Set the standard libraries (i.e. those which are independent of the
* build files) to be used in this component manager
*
@@ -443,5 +475,6 @@
+ className, e);
}
}
+
}
1.2 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreDataService.java
Index: CoreDataService.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreDataService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- CoreDataService.java 8 Feb 2002 13:04:45 -0000 1.1
+++ CoreDataService.java 18 Feb 2002 12:36:04 -0000 1.2
@@ -82,7 +82,7 @@
* @param allowUnsetProperties true if the reference to an unset
* property should not throw an exception
*/
- public CoreDataService(Frame frame,
+ protected CoreDataService(Frame frame,
boolean allowUnsetProperties) {
this.frame = frame;
this.allowUnsetProperties = allowUnsetProperties;
1.3 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreEventService.java
Index: CoreEventService.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreEventService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- CoreEventService.java 8 Feb 2002 13:04:45 -0000 1.2
+++ CoreEventService.java 18 Feb 2002 12:36:04 -0000 1.3
@@ -71,7 +71,7 @@
*
* @param frame the frame for which this instance is providing service
*/
- public CoreEventService(Frame frame) {
+ protected CoreEventService(Frame frame) {
this.frame = frame;
}
1.2 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreFileService.java
Index: CoreFileService.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreFileService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- CoreFileService.java 8 Feb 2002 13:04:45 -0000 1.1
+++ CoreFileService.java 18 Feb 2002 12:36:04 -0000 1.2
@@ -76,7 +76,7 @@
*
* @param frame the frame containing this context
*/
- public CoreFileService(Frame frame) {
+ protected CoreFileService(Frame frame) {
this.frame = frame;
}
1.7 +2 -2
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java
Index: ExecutionContext.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- ExecutionContext.java 11 Feb 2002 15:42:18 -0000 1.6
+++ ExecutionContext.java 18 Feb 2002 12:36:04 -0000 1.7
@@ -79,7 +79,7 @@
*
* @param frame the frame containing this context
*/
- public ExecutionContext(Frame frame) {
+ protected ExecutionContext(Frame frame) {
this.frame = frame;
this.eventSupport = frame.getEventSupport();
}
@@ -89,7 +89,7 @@
*
* @param modelElement the model element associated with this context
*/
- public void setModelElement(ModelElement modelElement) {
+ protected void setModelElement(ModelElement modelElement) {
this.modelElement = modelElement;
}
1.5 +67 -42
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java
Index: Frame.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- Frame.java 12 Feb 2002 23:52:23 -0000 1.4
+++ Frame.java 18 Feb 2002 12:36:04 -0000 1.5
@@ -94,7 +94,7 @@
*/
public class Frame {
/** The Ant aspect used to identify Ant metadata */
- public final static String ANT_ASPECT = "ant";
+ public static final String ANT_ASPECT = "ant";
/** the base dir of the project */
private File baseDir;
@@ -266,6 +266,31 @@
}
/**
+ * Get a definition from a referenced frame
+ *
+ * @param definitionName the name of the definition relative to this
+ * frame
+ * @return the appropriate import info object from the referenced
+ * frame's imports
+ * @exception ExecutionException if the referenced definition cannot be
+ * found
+ */
+ protected ImportInfo getReferencedDefinition(String definitionName)
+ throws ExecutionException {
+ Frame containingFrame = getContainingFrame(definitionName);
+ String localName = getNameInFrame(definitionName);
+ if (containingFrame == null) {
+ throw new ExecutionException("There is no project corresponding "
+ + "to the name \"" + definitionName + "\"");
+ }
+ if (containingFrame == this) {
+ return componentManager.getDefinition(localName);
+ } else {
+ return containingFrame.getReferencedDefinition(localName);
+ }
+ }
+
+ /**
* Gets the project model this frame is working with
*
* @return the project model
@@ -436,6 +461,36 @@
}
}
+
+ /**
+ * Get the execution frame which contains, directly, the named element
+ * where the name is relative to this frame
+ *
+ * @param elementName The name of the element
+ * @return the execution frame for the project that contains the given
+ * target
+ */
+ protected Frame getContainingFrame(String elementName) {
+ int index = elementName.lastIndexOf(Project.REF_DELIMITER);
+ if (index == -1) {
+ return this;
+ }
+
+ Frame currentFrame = this;
+ String relativeName = elementName.substring(0, index);
+ StringTokenizer tokenizer
+ = new StringTokenizer(relativeName, Project.REF_DELIMITER);
+ while (tokenizer.hasMoreTokens()) {
+ String refName = tokenizer.nextToken();
+ currentFrame = currentFrame.getReferencedFrame(refName);
+ if (currentFrame == null) {
+ return null;
+ }
+ }
+
+ return currentFrame;
+ }
+
/**
* Add a collection of properties to this frame
*
@@ -706,36 +761,6 @@
return setter;
}
-
- /**
- * Get the execution frame which contains, directly, the named target
- * where the name is relative to this frame
- *
- * @param targetName The name of the target
- * @return the execution frame for the project that contains the given
- * target
- */
- private Frame getContainingFrame(String targetName) {
- int index = targetName.lastIndexOf(Project.REF_DELIMITER);
- if (index == -1) {
- return this;
- }
-
- Frame currentFrame = this;
- String relativeName = targetName.substring(0, index);
- StringTokenizer tokenizer
- = new StringTokenizer(relativeName, Project.REF_DELIMITER);
- while (tokenizer.hasMoreTokens()) {
- String refName = tokenizer.nextToken();
- currentFrame = currentFrame.getReferencedFrame(refName);
- if (currentFrame == null) {
- return null;
- }
- }
-
- return currentFrame;
- }
-
/**
* Determine the base directory for each frame in the frame hierarchy
*
1.5 +6 -6
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/TaskContext.java
Index: TaskContext.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/TaskContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- TaskContext.java 8 Feb 2002 13:04:45 -0000 1.4
+++ TaskContext.java 18 Feb 2002 12:36:04 -0000 1.5
@@ -87,7 +87,7 @@
*
* @return the task instance
*/
- public Task getTask() {
+ protected Task getTask() {
return task;
}
@@ -96,7 +96,7 @@
*
* @return the task's loader
*/
- public ClassLoader getLoader() {
+ protected ClassLoader getLoader() {
return loader;
}
@@ -108,8 +108,8 @@
* @param modelElement the model element associated with this context
* @exception ExecutionException if the task cannot be initialized
*/
- public void init(ClassLoader loader, Task task, ModelElement
modelElement)
- throws ExecutionException {
+ protected void init(ClassLoader loader, Task task,
+ ModelElement modelElement) throws ExecutionException
{
this.task = task;
this.loader = loader;
setModelElement(modelElement);
@@ -122,7 +122,7 @@
* @exception ExecutionException if there is a problem executing the
* task
*/
- public void execute() throws ExecutionException {
+ protected void execute() throws ExecutionException {
task.execute();
}
@@ -130,7 +130,7 @@
* Destroy this context. The context can be reused for another task
* after this one
*/
- public void destroy() {
+ protected void destroy() {
task.destroy();
task = null;
loader = null;
1.2 +1 -1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/IncludeHandler.java
Index: IncludeHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/IncludeHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- IncludeHandler.java 5 Feb 2002 11:49:05 -0000 1.1
+++ IncludeHandler.java 18 Feb 2002 12:36:04 -0000 1.2
@@ -69,7 +69,7 @@
*/
public class IncludeHandler extends ElementHandler {
/** The attribute name which identifies the fragment to be included */
- public final static String SYSTEMID_ATTR = "fragment";
+ public static final String SYSTEMID_ATTR = "fragment";
/** The including project */
private Project project;
1.2 +3 -3
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/ProjectHandler.java
Index: ProjectHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/ProjectHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- ProjectHandler.java 5 Feb 2002 11:49:05 -0000 1.1
+++ ProjectHandler.java 18 Feb 2002 12:36:04 -0000 1.2
@@ -68,13 +68,13 @@
*/
public class ProjectHandler extends ElementHandler {
/** The basedir attribute tag */
- public final static String BASEDIR_ATTR = "basedir";
+ public static final String BASEDIR_ATTR = "basedir";
/** The name attribute */
- public final static String NAME_ATTR = "name";
+ public static final String NAME_ATTR = "name";
/** The default attribute name */
- public final static String DEFAULT_ATTR = "default";
+ public static final String DEFAULT_ATTR = "default";
/** The project being parsed. */
private Project project;
1.2 +2 -2
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/RefHandler.java
Index: RefHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/RefHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- RefHandler.java 5 Feb 2002 11:49:05 -0000 1.1
+++ RefHandler.java 18 Feb 2002 12:36:04 -0000 1.2
@@ -70,10 +70,10 @@
*/
public class RefHandler extends ElementHandler {
/** The attribute used to name the ref. */
- public final static String NAME_ATTR = "name";
+ public static final String NAME_ATTR = "name";
/** The attribute name used to locate the project to be referenced. */
- public final static String SYSTEMID_ATTR = "project";
+ public static final String SYSTEMID_ATTR = "project";
/** The project that has been referenced. */
private Project referencedProject;
1.3 +5 -5
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java
Index: TargetHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- TargetHandler.java 6 Feb 2002 10:15:04 -0000 1.2
+++ TargetHandler.java 18 Feb 2002 12:36:04 -0000 1.3
@@ -67,19 +67,19 @@
*/
public class TargetHandler extends ElementHandler {
/** The name attribute */
- public final static String NAME_ATTR = "name";
+ public static final String NAME_ATTR = "name";
/** The depends attribute name */
- public final static String DEPENDS_ATTR = "depends";
+ public static final String DEPENDS_ATTR = "depends";
/** The depends attribute name */
- public final static String DESC_ATTR = "description";
+ public static final String DESC_ATTR = "description";
/** The if attribute name */
- public final static String IF_ATTR = "if";
+ public static final String IF_ATTR = "if";
/** The unless attribute name */
- public final static String UNLESS_ATTR = "unless";
+ public static final String UNLESS_ATTR = "unless";
/** The target being configured. */
private Target target;
1.4 +8 -0
jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/antlib.xml
Index: antlib.xml
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/antlib.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- antlib.xml 5 Feb 2002 14:13:57 -0000 1.3
+++ antlib.xml 18 Feb 2002 12:36:04 -0000 1.4
@@ -6,6 +6,7 @@
<converter classname="org.apache.tools.ant.Ant1Converter"/>
+ <!-- typedefs -->
<taskdef name="ant" classname="org.apache.tools.ant.taskdefs.Ant"/>
<taskdef name="antcall"
classname="org.apache.tools.ant.taskdefs.CallTarget"/>
<taskdef name="antlr"
classname="org.apache.tools.ant.taskdefs.optional.ANTLR"/>
@@ -145,6 +146,13 @@
<taskdef name="xmlvalidate"
classname="org.apache.tools.ant.taskdefs.optional.XMLValidateTask"/>
<taskdef name="zip" classname="org.apache.tools.ant.taskdefs.Zip"/>
+ <!-- Deprecated tasks -->
+ <taskdef name="copydir" classname="org.apache.tools.ant.taskdefs.Copydir"/>
+ <taskdef name="copyfile"
classname="org.apache.tools.ant.taskdefs.Copyfile"/>
+ <taskdef name="deltree" classname="org.apache.tools.ant.taskdefs.Deltree"/>
+ <taskdef name="rename" classname="org.apache.tools.ant.taskdefs.Rename"/>
+
+ <!-- typedefs -->
<typedef name="path" classname="org.apache.tools.ant.types.Path"/>
<typedef name="fileset" classname="org.apache.tools.ant.types.FileSet"/>
<typedef name="filelist" classname="org.apache.tools.ant.types.FileList"/>
1.8 +10 -10
jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- Project.java 11 Feb 2002 15:42:18 -0000 1.7
+++ Project.java 18 Feb 2002 12:36:04 -0000 1.8
@@ -83,36 +83,36 @@
public class Project implements org.apache.ant.common.event.BuildListener {
/** String which indicates Java version 1.0 */
- public final static String JAVA_1_0 = "1.0";
+ public static final String JAVA_1_0 = "1.0";
/** String which indicates Java version 1.1 */
- public final static String JAVA_1_1 = "1.1";
+ public static final String JAVA_1_1 = "1.1";
/** String which indicates Java version 1.2 */
- public final static String JAVA_1_2 = "1.2";
+ public static final String JAVA_1_2 = "1.2";
/** String which indicates Java version 1.3 */
- public final static String JAVA_1_3 = "1.3";
+ public static final String JAVA_1_3 = "1.3";
/** String which indicates Java version 1.4 */
- public final static String JAVA_1_4 = "1.4";
+ public static final String JAVA_1_4 = "1.4";
/**
* @see MessageLevel.MSG_ERR
*/
- public final static int MSG_ERR = MessageLevel.MSG_ERR;
+ public static final int MSG_ERR = MessageLevel.MSG_ERR;
/**
* @see MessageLevel.MSG_WARN
*/
- public final static int MSG_WARN = MessageLevel.MSG_WARN;
+ public static final int MSG_WARN = MessageLevel.MSG_WARN;
/**
* @see MessageLevel.MSG_INFO
*/
- public final static int MSG_INFO = MessageLevel.MSG_INFO;
+ public static final int MSG_INFO = MessageLevel.MSG_INFO;
/**
* @see MessageLevel.MSG_VERBOSE
*/
- public final static int MSG_VERBOSE = MessageLevel.MSG_VERBOSE;
+ public static final int MSG_VERBOSE = MessageLevel.MSG_VERBOSE;
/**
* @see MessageLevel.MSG_DEBUG
*/
- public final static int MSG_DEBUG = MessageLevel.MSG_DEBUG;
+ public static final int MSG_DEBUG = MessageLevel.MSG_DEBUG;
/** The java version detected that Ant is running on */
private static String javaVersion;
1.2 +34 -11
jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Import.java
Index: Import.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/Import.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- Import.java 11 Feb 2002 15:42:18 -0000 1.1
+++ Import.java 18 Feb 2002 12:36:04 -0000 1.2
@@ -69,7 +69,11 @@
private String libraryId = null;
/** The name of the component to be imported */
private String name = null;
-
+ /**
+ * A ref is used to import a task which has been declared in another
+ * project
+ */
+ private String ref = null;
/** The alias that is to be used for the name */
private String alias = null;
@@ -92,6 +96,15 @@
}
/**
+ * Set the reference name of a task defined in a referenced frame
+ *
+ * @param ref the new ref value
+ */
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
+ /**
* Sets the alias of the Import
*
* @param alias the new alias value
@@ -106,13 +119,21 @@
* @exception ExecutionException if the task is not configured correctly
*/
public void validateComponent() throws ExecutionException {
+ if (ref != null) {
+ if (libraryId != null || name != null) {
+ throw new ExecutionException("The \"ref\" attribute can only
"
+ + "be used when \"libraryId\" and \"name\" attributes
are "
+ + "not present");
+ }
+ } else {
if (libraryId == null) {
- throw new ExecutionException("You must specify a library
identifier"
- + " with the \"libraryid\" attribute");
+ throw new ExecutionException("You must specify a library "
+ + "identifier with the \"libraryid\" attribute");
}
if (alias != null && name == null) {
throw new ExecutionException("You may only specify an alias"
- + " when you specify the component name");
+ + " when you specify the \"name\" or \"ref\"
attributes");
+ }
}
}
@@ -125,7 +146,9 @@
AntContext context = getContext();
ComponentService componentService = (ComponentService)
context.getCoreService(ComponentService.class);
- if (name == null) {
+ if (ref != null) {
+ componentService.importFrameComponent(ref, alias);
+ } else if (name == null) {
componentService.importLibrary(libraryId);
} else {
componentService.importComponent(libraryId, name, alias);
1.1
jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/bootstrap/Bootstrap.java
Index: Bootstrap.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.ant.bootstrap;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import org.apache.ant.init.ClassLocator;
/**
* The Bootstrap class initailses the boot strap build, then loads the
* Builder class to perform the bootstrap build.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Conor MacNeill</a>
* @created 18 February 2002
*/
public class Bootstrap {
/**
* The main program - adds tools.jar and runs build
*
* @param args The command line arguments
* @exception Exception if there is a bootstrap problem
*/
public static void main(String[] args) throws Exception {
System.out.println("Bootstrapping mutant");
URL bootstrapURL = ClassLocator.getClassLocationURL(Bootstrap.class);
URL builderURL = new URL(bootstrapURL, "../builder/");
URL toolsJarURL = ClassLocator.getToolsJarURL();
URL[] urls = new URL[]{builderURL, toolsJarURL};
ClassLoader builderLoader = new URLClassLoader(urls);
// org.apache.ant.init.LoaderUtils.dumpLoader(System.out,
// builderLoader);
Class builderClass = Class.forName("org.apache.ant.builder.Builder",
true, builderLoader);
final Class[] param = {Class.forName("[Ljava.lang.String;")};
final Method main = builderClass.getMethod("main", param);
final Object[] argument = {args};
main.invoke(null, argument);
}
}
1.1
jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Ant1CompatBuilder.java
Index: Ant1CompatBuilder.java
===================================================================
package org.apache.ant.builder;
public class Ant1CompatBuilder {
protected void _init(BuildHelper helper) {
helper.setProperty("src.dir", "src");
helper.setProperty("lib.dir", "lib");
helper.setProperty("java.dir", "${src.dir}/java");
helper.setProperty("bin.dir", "bin");
helper.setProperty("dist.dir", "dist");
helper.setProperty("javadocs.dir", "${dist.dir}/javadocs");
helper.setProperty("distlib.dir", "${dist.dir}/lib");
helper.setProperty("debug", "true");
helper.setProperty("ant.package", "org/apache/tools/ant");
helper.setProperty("optional.package",
"${ant.package}/taskdefs/optional");
helper.setProperty("optional.type.package",
"${ant.package}/types/optional");
helper.setProperty("util.package", "${ant.package}/util");
helper.setProperty("regexp.package", "${util.package}/regexp");
helper.createPath("classpath");
helper.addFileSetToPath("classpath", "${lib.dir}/parser", "*.jar");
helper.addFileSetToPath("classpath", "${lib.dir}/ant1compat",
"*.jar");
helper.addPathElementToPath("classpath", "${distlib.dir}/init.jar");
helper.addPathElementToPath("classpath",
"${distlib.dir}/common/common.jar");
}
protected void check_for_optional_packages(BuildHelper helper) {
}
protected void ant1compat(BuildHelper helper) {
helper.mkdir("${bin.dir}/ant1src");
helper.mkdir("${bin.dir}/ant1compat");
helper.copyFilesetRef("ant1src", "${bin.dir}/ant1src");
helper.javac("${bin.dir}/ant1src:${java.dir}/antlibs/ant1compat",
"${bin.dir}/ant1compat", "classpath");
helper.copyFileset("${bin.dir}/ant1src", "${bin.dir}/ant1compat");
helper.jar("${bin.dir}/ant1compat",
"${distlib.dir}/antlibs/ant1compat.jar",
"${java.dir}/antlibs/ant1compat", "antlib.xml");
}
protected void clean(BuildHelper helper) {
}
}
1.1
jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/BuildHelper.java
Index: BuildHelper.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.ant.builder;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;
/**
* A helper class which allows the build files which have been converted to
* code to be built.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Conor MacNeill</a>
* @created 16 February 2002
*/
public class BuildHelper {
/**
* Simple data class for storing info about a fileset.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Conor MacNeill</a>
* @created 18 February 2002
*/
private static class FileSetInfo {
/** The root directory of this fileset */
private File root;
/** the list of files in the file set */
private File[] files;
}
/** The properties which have been defined in the build */
private Map properties = new HashMap();
/** Path objects created in the build */
private Map paths = new HashMap();
/** Filesets created in the build */
private Map filesets = new HashMap();
/**
* Set a property for the build
*
* @param propertyName the name of the property
* @param propertyValue the value of the property
*/
protected void setProperty(String propertyName, String propertyValue) {
if (!properties.containsKey(propertyName)) {
String value = resolve(propertyValue);
properties.put(propertyName, value);
}
}
/**
* Create a Jar
*
* @param basedir the base directpory from which files are added to the
* jar
* @param metaInfDir the directory containing the META-INF for the jar
* @param metaInfIncludes the files to be included in the META-INF area
* of the jar
* @param jarFile the file in which the Jar is created
*/
protected void jar(String basedir, String jarFile, String metaInfDir,
String metaInfIncludes) {
try {
File base = new File(resolve(basedir));
File jar = new File(resolve(jarFile));
JarOutputStream jos
= new JarOutputStream(new FileOutputStream(jar));
addToJar(jos, base, null);
if (metaInfDir != null) {
File[] metaFileSet = buildFileSet(metaInfDir,
metaInfIncludes);
addFilesToJar(jos, new File(resolve(metaInfDir)),
metaFileSet, "META-INF");
}
jos.close();
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Unable to Jar file");
}
}
/**
* Compile a set of files
*
* @param srcDir the source directory
* @param destDir where the compiled classes will go
* @param classpathRef the id of a path object with the classpath for
* the build
*/
protected void javac(String srcDir, String destDir, String classpathRef) {
List javaFiles = new ArrayList();
String src = resolve(srcDir);
StringTokenizer tokenizer = new StringTokenizer(src, ":");
while (tokenizer.hasMoreTokens()) {
File srcLocation = new File(tokenizer.nextToken());
getJavaFiles(srcLocation, javaFiles);
}
File dest = new File(resolve(destDir));
int numArgs = javaFiles.size() + 2;
if (classpathRef != null) {
numArgs += 2;
}
String[] args = new String[numArgs];
int index = 0;
args[index++] = "-d";
args[index++] = dest.getPath();
if (classpathRef != null) {
String path = (String)paths.get(resolve(classpathRef));
args[index++] = "-classpath";
args[index++] = path;
}
for (Iterator i = javaFiles.iterator(); i.hasNext(); ) {
args[index++] = ((File)i.next()).getPath();
}
try {
Class c = Class.forName("com.sun.tools.javac.Main");
Object compiler = c.newInstance();
Method compile = c.getMethod("compile",
new Class[]{(new String[]{}).getClass()});
compile.invoke(compiler, new Object[]{args});
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Compile failed");
}
}
/**
* Copy a directory
*
* @param fromDir the source directory name
* @param toDir the destination directory name
*/
protected void copyFileset(String fromDir, String toDir) {
File from = new File(resolve(fromDir));
File to = new File(resolve(toDir));
copyDir(from, to);
}
/**
* Add a fileset to this build helper
*
* @param name the name of the fileset (its id)
* @param root the root directory of the fileset
* @param files the files in the fileset
*/
protected void addFileSet(String name, File root, File[] files) {
FileSetInfo info = new FileSetInfo();
info.root = root;
info.files = files;
filesets.put(name, info);
}
/**
* Copy a fileset given a reference to the source fileset
*
* @param toDir the name of the destination directory
* @param fileSetRef the fileset to be copied
*/
protected void copyFilesetRef(String fileSetRef, String toDir) {
FileSetInfo fileset = (FileSetInfo)filesets.get(resolve(fileSetRef));
if (fileset != null) {
File to = new File(resolve(toDir));
copyFileList(fileset.root, fileset.files, to);
}
}
/**
* Make a directory
*
* @param dirName the name of the directory path to be created.
*/
protected void mkdir(String dirName) {
File dir = new File(resolve(dirName));
dir.mkdirs();
}
/**
* Create a path object
*
* @param pathName the name of the path object in the build
*/
protected void createPath(String pathName) {
String path = "";
paths.put(pathName, path);
}
/**
* Add a fileset to a path
*
* @param pathName the name of the path
* @param filesetDir the base directory of the fileset
* @param filesetIncludes the files to be included in the fileset
*/
protected void addFileSetToPath(String pathName, String filesetDir,
String filesetIncludes) {
File[] files = buildFileSet(filesetDir, filesetIncludes);
String currentPath = (String)paths.get(pathName);
for (int i = 0; i < files.length; ++i) {
if (currentPath == null || currentPath.length() == 0) {
currentPath = files[i].getPath();
} else {
currentPath = currentPath + File.pathSeparator
+ files[i].getPath();
}
}
paths.put(pathName, currentPath);
}
/**
* Add a new element to a path
*
* @param pathName the name of the path object to be updated
* @param location the location to be added to the path
*/
protected void addPathElementToPath(String pathName, String location) {
String pathElement = resolve(location).replace('/',
File.separatorChar);
String currentPath = (String)paths.get(pathName);
if (currentPath == null || currentPath.length() == 0) {
currentPath = pathElement;
} else {
currentPath = currentPath + File.pathSeparator + pathElement;
}
paths.put(pathName, currentPath);
}
/**
* Add an existing path to another path
*
* @param pathName the name of the path to which the path is to be added
* @param pathNameToAdd the name of the path to be added.
*/
protected void addPathToPath(String pathName, String pathNameToAdd) {
String pathToAdd = (String)paths.get(pathNameToAdd);
if (pathToAdd == null || pathToAdd.length() == 0) {
return;
}
String currentPath = (String)paths.get(pathName);
if (currentPath == null || currentPath.length() == 0) {
currentPath = pathToAdd;
} else {
currentPath = currentPath + File.pathSeparator + pathToAdd;
}
paths.put(pathName, currentPath);
}
/**
* Get the set of Java files to be compiled
*
* @param srcDir the directory to search (recursively searched)
* @param javaFiles the list of files to which Java files are added
*/
private void getJavaFiles(File srcDir, List javaFiles) {
File[] files = srcDir.listFiles();
for (int i = 0; i < files.length; ++i) {
if (files[i].isDirectory()) {
getJavaFiles(files[i], javaFiles);
} else if (files[i].getPath().endsWith(".java")) {
javaFiles.add(files[i]);
}
}
}
/**
* Copy a file
*
* @param from the source location
* @param dest the destination location
*/
private void copyFile(File from, File dest) {
if (from.exists()) {
dest.getParentFile().mkdirs();
try {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(dest);
byte[] buf = new byte[1024 * 16];
int count = 0;
count = in.read(buf, 0, buf.length);
while (count != -1) {
out.write(buf, 0, count);
count = in.read(buf, 0, buf.length);
}
in.close();
out.close();
} catch (IOException ioe) {
ioe.printStackTrace();
throw new RuntimeException("Unable to copy files");
}
}
}
/**
* Copy a list of files from one directory to another, preserving the
* relative paths
*
* @param root the root of the source directory
* @param files the files to be copied
* @param to the destination directory
*/
private void copyFileList(File root, File[] files, File to) {
for (int i = 0; i < files.length; ++i) {
if (files[i].getName().equals("CVS")) {
continue;
}
String name
= files[i].getPath().substring(root.getPath().length() + 1);
File dest = new File(to, name);
if (files[i].isDirectory()) {
copyDir(files[i], dest);
} else {
copyFile(files[i], dest);
}
}
}
/**
* Copy a directory
*
* @param from the source directory
* @param to the destination directory
*/
private void copyDir(File from, File to) {
to.mkdirs();
File[] files = from.listFiles();
copyFileList(from, files, to);
}
/**
* Add a directory to a Jar
*
* @param jos the JarOutputStream representing the Jar being created
* @param dir the directory to be added to the jar
* @param prefix the prefix in the jar at which the directory is to be
* added
* @exception IOException if the files cannot be added to the jar
*/
private void addToJar(JarOutputStream jos, File dir, String prefix)
throws IOException {
File[] files = dir.listFiles();
addFilesToJar(jos, dir, files, prefix);
}
/**
* Add a set of files to a jar
*
* @param jos the JarOutputStream representing the Jar being created
* @param dir the directory fro which the files are taken
* @param prefix the prefix in the jar at which the directory is to be
* added
* @param files the list of files to be added to the jar
* @exception IOException if the files cannot be added to the jar
*/
private void addFilesToJar(JarOutputStream jos, File dir,
File[] files, String prefix) throws
IOException {
for (int i = 0; i < files.length; i++) {
String name = files[i].getPath().replace('\\', '/');
name = name.substring(dir.getPath().length() + 1);
if (prefix != null) {
name = prefix + "/" + name;
}
ZipEntry ze = new ZipEntry(name);
jos.putNextEntry(ze);
if (files[i].isDirectory()) {
addToJar(jos, files[i], name);
} else {
FileInputStream fis = new FileInputStream(files[i]);
int count = 0;
byte[] buf = new byte[8 * 1024];
count = fis.read(buf, 0, buf.length);
while (count != -1) {
jos.write(buf, 0, count);
count = fis.read(buf, 0, buf.length);
}
fis.close();
}
}
}
/**
* Build a simple fileset. Only simple inclusion filtering is supported
* - no complicated patterns.
*
* @param filesetDir the base directory of the fileset
* @param filesetIncludes the simple includes spec for the fileset
* @return the fileset expressed as an array of File instances.
*/
private File[] buildFileSet(String filesetDir, String filesetIncludes) {
if (filesetDir == null) {
return new File[0];
}
final String includes = resolve(filesetIncludes);
if (includes.indexOf("**") != -1) {
throw new RuntimeException("Simple fileset cannot handle ** "
+ "style includes");
}
int index = 0;
if (includes.charAt(0) == '*') {
index = 1;
}
if (includes.indexOf("*", index) != -1) {
throw new RuntimeException("Simple fileset cannot handle * "
+ "style includes except at start");
}
File base = new File(resolve(filesetDir));
return base.listFiles(
new FilenameFilter() {
public boolean accept(File dir, String name) {
if (includes.startsWith("*")) {
return name.endsWith(includes.substring(1));
} else {
return name.equals(includes);
}
}
});
}
/**
* Resolve the property references in a string
*
* @param propertyValue the string to be resolved
* @return the string with property references replaced by their current
* value.
*/
private String resolve(String propertyValue) {
String newValue = propertyValue;
while (newValue.indexOf("${") != -1) {
int index = newValue.indexOf("${");
int endIndex = newValue.indexOf("}", index);
String propertyName = newValue.substring(index + 2, endIndex);
String repValue = (String)properties.get(propertyName);
newValue = newValue.substring(0, index) +
repValue + newValue.substring(endIndex + 1);
}
return newValue;
}
}
1.1
jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java
Index: Builder.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.ant.builder;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* The Builder object builds the code for bootstrap purposes. It invokes the
* mathods of the required targets in the converted build files.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Conor MacNeill</a>
* @created 18 February 2002
*/
public class Builder {
/** The root of the Ant1 source tree */
private static final File ANT1_SRC_ROOT = new File("../../src/main");
/** the root of the Ant package in the Ant1 source tree */
private static final File PACKAGE_ROOT
= new File(ANT1_SRC_ROOT, "org/apache/tools/ant");
/** The zip utilities root */
private static final File ZIP_ROOT
= new File(ANT1_SRC_ROOT, "org/apache/tools/zip");
/** the taskdefs root */
private static final File TASKDEFS_ROOT
= new File(PACKAGE_ROOT, "taskdefs");
/** the root forthe depend task's support classes */
private static final File DEPEND_ROOT
= new File(TASKDEFS_ROOT, "optional/depend");
/**
* The main program - create a builder and run the build
*
* @param args the command line arguments - not currently used
*/
public static void main(String[] args) {
Builder builder = new Builder();
builder.runBuild(args);
}
/**
* Get the Ant1 files currently required to build a bootstrap build.
*
* @return an array of files which need to be copied into the bootstrap
* build.
*/
private File[] getAnt1Files() {
List files = new ArrayList();
files.add(new File(PACKAGE_ROOT, "types/EnumeratedAttribute.java"));
files.add(new File(PACKAGE_ROOT, "types/Path.java"));
files.add(new File(PACKAGE_ROOT, "types/FileSet.java"));
files.add(new File(PACKAGE_ROOT, "types/PatternSet.java"));
files.add(new File(PACKAGE_ROOT, "types/Reference.java"));
files.add(new File(PACKAGE_ROOT, "types/FilterSet.java"));
files.add(new File(PACKAGE_ROOT, "types/FilterSetCollection.java"));
files.add(new File(PACKAGE_ROOT, "types/Mapper.java"));
files.add(new File(PACKAGE_ROOT, "types/ZipFileSet.java"));
files.add(new File(PACKAGE_ROOT, "types/ZipScanner.java"));
files.add(new File(PACKAGE_ROOT, "util/FileNameMapper.java"));
files.add(new File(PACKAGE_ROOT, "util/FlatFileNameMapper.java"));
files.add(new File(PACKAGE_ROOT, "util/SourceFileScanner.java"));
files.add(new File(PACKAGE_ROOT, "util/IdentityMapper.java"));
files.add(new File(PACKAGE_ROOT, "util/MergingMapper.java"));
files.add(new File(PACKAGE_ROOT, "util/GlobPatternMapper.java"));
files.add(new File(PACKAGE_ROOT, "types/Commandline.java"));
files.add(new File(PACKAGE_ROOT, "BuildException.java"));
files.add(new File(PACKAGE_ROOT, "Location.java"));
files.add(new File(PACKAGE_ROOT, "AntClassLoader.java"));
files.add(new File(PACKAGE_ROOT, "BuildListener.java"));
files.add(new File(PACKAGE_ROOT, "BuildEvent.java"));
files.add(new File(PACKAGE_ROOT, "DirectoryScanner.java"));
files.add(new File(PACKAGE_ROOT, "FileScanner.java"));
files.add(new File(PACKAGE_ROOT, "PathTokenizer.java"));
files.add(new File(PACKAGE_ROOT, "util/FileUtils.java"));
files.add(new File(PACKAGE_ROOT, "defaultManifest.mf"));
files.add(new File(TASKDEFS_ROOT, "defaults.properties"));
files.add(new File(PACKAGE_ROOT, "types/defaults.properties"));
files.add(new File(TASKDEFS_ROOT, "Property.java"));
files.add(new File(TASKDEFS_ROOT, "Execute.java"));
files.add(new File(TASKDEFS_ROOT, "ExecuteStreamHandler.java"));
files.add(new File(TASKDEFS_ROOT, "ExecuteWatchdog.java"));
files.add(new File(TASKDEFS_ROOT, "ProcessDestroyer.java"));
files.add(new File(TASKDEFS_ROOT, "PumpStreamHandler.java"));
files.add(new File(TASKDEFS_ROOT, "StreamPumper.java"));
files.add(new File(TASKDEFS_ROOT, "LogStreamHandler.java"));
files.add(new File(TASKDEFS_ROOT, "LogOutputStream.java"));
files.add(new File(TASKDEFS_ROOT, "condition/Os.java"));
files.add(new File(TASKDEFS_ROOT, "condition/Condition.java"));
files.add(new File(TASKDEFS_ROOT, "Available.java"));
files.add(new File(TASKDEFS_ROOT, "Mkdir.java"));
files.add(new File(TASKDEFS_ROOT, "Copy.java"));
files.add(new File(TASKDEFS_ROOT, "MatchingTask.java"));
files.add(new File(DEPEND_ROOT, "Depend.java"));
files.add(new File(DEPEND_ROOT, "ClassFile.java"));
files.add(new File(DEPEND_ROOT, "ClassFileUtils.java"));
files.add(new File(DEPEND_ROOT, "constantpool/ClassCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/ConstantPool.java"));
files.add(new File(DEPEND_ROOT,
"constantpool/ConstantPoolEntry.java"));
files.add(new File(DEPEND_ROOT, "constantpool/Utf8CPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/ConstantCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/MethodRefCPInfo.java"));
files.add(new File(DEPEND_ROOT,
"constantpool/InterfaceMethodRefCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/FieldRefCPInfo.java"));
files.add(new File(DEPEND_ROOT,
"constantpool/NameAndTypeCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/IntegerCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/FloatCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/LongCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/StringCPInfo.java"));
files.add(new File(DEPEND_ROOT, "constantpool/DoubleCPInfo.java"));
files.add(new File(TASKDEFS_ROOT, "Javac.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/CompilerAdapter.java"));
files.add(new File(TASKDEFS_ROOT,
"compilers/DefaultCompilerAdapter.java"));
files.add(new File(TASKDEFS_ROOT,
"compilers/CompilerAdapterFactory.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/Jikes.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/JavacExternal.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/Javac12.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/Javac13.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/Kjc.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/Gcj.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/Jvc.java"));
files.add(new File(TASKDEFS_ROOT, "compilers/Sj.java"));
files.add(new File(TASKDEFS_ROOT, "Jar.java"));
files.add(new File(TASKDEFS_ROOT, "Zip.java"));
files.add(new File(TASKDEFS_ROOT, "Manifest.java"));
files.add(new File(TASKDEFS_ROOT, "ManifestException.java"));
files.add(new File(ZIP_ROOT, "ZipOutputStream.java"));
files.add(new File(ZIP_ROOT, "ZipOutputStream.java"));
files.add(new File(ZIP_ROOT, "ZipEntry.java"));
files.add(new File(ZIP_ROOT, "ZipLong.java"));
files.add(new File(ZIP_ROOT, "ZipShort.java"));
files.add(new File(ZIP_ROOT, "ZipExtraField.java"));
files.add(new File(ZIP_ROOT, "ExtraFieldUtils.java"));
files.add(new File(ZIP_ROOT, "AsiExtraField.java"));
files.add(new File(ZIP_ROOT, "UnrecognizedExtraField.java"));
files.add(new File(ZIP_ROOT, "UnixStat.java"));
files.add(new File(TASKDEFS_ROOT, "ConditionTask.java"));
files.add(new File(TASKDEFS_ROOT, "condition/ConditionBase.java"));
files.add(new File(TASKDEFS_ROOT, "Checksum.java"));
files.add(new File(TASKDEFS_ROOT, "UpToDate.java"));
files.add(new File(TASKDEFS_ROOT, "condition/Not.java"));
files.add(new File(TASKDEFS_ROOT, "condition/And.java"));
files.add(new File(TASKDEFS_ROOT, "condition/Equals.java"));
files.add(new File(TASKDEFS_ROOT, "condition/Or.java"));
files.add(new File(TASKDEFS_ROOT, "condition/IsSet.java"));
files.add(new File(TASKDEFS_ROOT, "condition/Http.java"));
files.add(new File(TASKDEFS_ROOT, "condition/Socket.java"));
files.add(new File(TASKDEFS_ROOT, "condition/FilesMatch.java"));
files.add(new File(TASKDEFS_ROOT, "Taskdef.java"));
files.add(new File(TASKDEFS_ROOT, "Definer.java"));
return (File[])files.toArray(new File[0]);
}
/**
* Run the build
*
* @param args the command line arguments for the build - currently not
* used.
*/
private void runBuild(String[] args) {
BuildHelper mainBuild = new BuildHelper();
mainBuild.setProperty("dist.dir", "bootstrap");
MutantBuilder mutantBuilder = new MutantBuilder();
mutantBuilder._init(mainBuild);
mutantBuilder.buildsetup(mainBuild);
mutantBuilder.init(mainBuild);
mutantBuilder.common(mainBuild);
mutantBuilder.antcore(mainBuild);
mutantBuilder.start(mainBuild);
mutantBuilder.cli(mainBuild);
BuildHelper systemBuild = new BuildHelper();
systemBuild.setProperty("libset", "system");
systemBuild.setProperty("dist.dir", "bootstrap");
mutantBuilder._init(systemBuild);
mutantBuilder.build_lib(systemBuild);
Ant1CompatBuilder ant1Builder = new Ant1CompatBuilder();
BuildHelper ant1Build = new BuildHelper();
ant1Build.setProperty("dist.dir", "bootstrap");
ant1Build.addFileSet("ant1src", ANT1_SRC_ROOT, getAnt1Files());
ant1Builder._init(ant1Build);
ant1Builder.ant1compat(ant1Build);
}
}
1.1
jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/MutantBuilder.java
Index: MutantBuilder.java
===================================================================
package org.apache.ant.builder;
public class MutantBuilder {
protected void _init(BuildHelper helper) {
helper.setProperty("src.dir", "src");
helper.setProperty("lib.dir", "lib");
helper.setProperty("java.dir", "${src.dir}/java");
helper.setProperty("bin.dir", "bin");
helper.setProperty("dist.dir", "dist");
helper.setProperty("javadocs.dir", "${dist.dir}/javadocs");
helper.setProperty("distlib.dir", "${dist.dir}/lib");
helper.setProperty("debug", "true");
helper.createPath("classpath.parser");
helper.addFileSetToPath("classpath.parser", "${lib.dir}/parser",
"*.jar");
helper.createPath("classpath.common");
helper.addPathElementToPath("classpath.common",
"${distlib.dir}/init.jar");
helper.createPath("classpath.antcore");
helper.addPathElementToPath("classpath.antcore",
"${distlib.dir}/common/common.jar");
helper.addPathToPath("classpath.antcore", "classpath.common");
helper.addPathToPath("classpath.antcore", "classpath.parser");
helper.createPath("classpath.cli");
helper.addPathElementToPath("classpath.cli",
"${distlib.dir}/antcore/antcore.jar");
helper.addPathToPath("classpath.cli", "classpath.antcore");
helper.createPath("classpath.start");
helper.addPathElementToPath("classpath.start",
"${distlib.dir}/init.jar");
}
protected void buildsetup(BuildHelper helper) {
helper.mkdir("${bin.dir}");
helper.mkdir("${distlib.dir}");
helper.copyFileset("${lib.dir}/parser", "${distlib.dir}/parser");
}
protected void init(BuildHelper helper) {
helper.mkdir("${bin.dir}/init");
helper.javac("${java.dir}/init", "${bin.dir}/init", null);
helper.jar("${bin.dir}/init", "${distlib.dir}/init.jar",
null, null);
}
protected void common(BuildHelper helper) {
helper.mkdir("${bin.dir}/common");
helper.mkdir("${distlib.dir}/common");
helper.javac("${java.dir}/common", "${bin.dir}/common",
"classpath.common");
helper.jar("${bin.dir}/common", "${distlib.dir}/common/common.jar",
null, null);
}
protected void antcore(BuildHelper helper) {
helper.mkdir("${bin.dir}/antcore");
helper.mkdir("${distlib.dir}/antcore");
helper.javac("${java.dir}/antcore", "${bin.dir}/antcore",
"classpath.antcore");
helper.jar("${bin.dir}/antcore", "${distlib.dir}/antcore/antcore.jar",
null, null);
}
protected void cli(BuildHelper helper) {
helper.mkdir("${bin.dir}/cli");
helper.mkdir("${distlib.dir}/cli");
helper.javac("${java.dir}/cli", "${bin.dir}/cli", "classpath.cli");
helper.jar("${bin.dir}/cli", "${distlib.dir}/cli/cli.jar",
null, null);
}
protected void start(BuildHelper helper) {
helper.mkdir("${bin.dir}/start");
helper.javac("${java.dir}/start", "${bin.dir}/start",
"classpath.start");
helper.jar("${bin.dir}/start", "${distlib.dir}/start.jar",
null, null);
}
protected void ant1compat(BuildHelper helper) {
}
protected void remote(BuildHelper helper) {
helper.mkdir("${bin.dir}/remote");
helper.javac("${java.dir}/remote", "${bin.dir}/remote",
"classpath.start");
helper.jar("${bin.dir}/remote", "${distlib.dir}/remote.jar",
null, null);
}
protected void clean(BuildHelper helper) {
}
protected void antlibs(BuildHelper helper) {
}
protected void build_lib(BuildHelper helper) {
helper.mkdir("${bin.dir}/antlibs/${libset}");
helper.mkdir("${distlib.dir}/antlibs");
helper.createPath("classpath.antlibs");
helper.addPathElementToPath("classpath.antlibs",
"${distlib.dir}/common/common.jar");
helper.addPathToPath("classpath.antlibs", "classpath.common");
helper.javac("${java.dir}/antlibs/${libset}",
"${bin.dir}/antlibs/${libset}", "classpath.antlibs");
helper.jar("${bin.dir}/antlibs/${libset}",
"${distlib.dir}/antlibs/${libset}.tsk",
"${java.dir}/antlibs/${libset}", "antlib.xml");
}
protected void main(BuildHelper helper) {
}
protected void checkstyle(BuildHelper helper) {
helper.setProperty("checkstyle.bin", "../checkstyle");
helper.createPath("checkstyle.path");
helper.addFileSetToPath("checkstyle.path", "${checkstyle.bin}", null);
helper.mkdir("${bin.dir}/check");
}
protected void javadocs(BuildHelper helper) {
helper.mkdir("${javadocs.dir}");
}
}
1.9 +26 -12
jakarta-ant/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java
Index: Commandline.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- Commandline.java 12 Feb 2002 23:52:24 -0000 1.8
+++ Commandline.java 18 Feb 2002 12:36:05 -0000 1.9
@@ -70,10 +70,11 @@
import org.apache.ant.antcore.modelparser.XMLProjectParser;
import org.apache.ant.antcore.xml.ParseContext;
import org.apache.ant.antcore.xml.XMLParseException;
+import org.apache.ant.common.event.BuildEvent;
import org.apache.ant.common.event.BuildListener;
+import org.apache.ant.common.event.MessageLevel;
import org.apache.ant.common.model.Project;
import org.apache.ant.common.util.ConfigException;
-import org.apache.ant.common.event.MessageLevel;
import org.apache.ant.init.InitConfig;
import org.apache.ant.init.InitUtils;
@@ -85,10 +86,10 @@
*/
public class Commandline {
/** The default build file name */
- public final static String DEFAULT_BUILD_FILENAME = "build.ant";
+ public static final String DEFAULT_BUILD_FILENAME = "build.ant";
/** The default build file name */
- public final static String DEFAULT_ANT1_FILENAME = "build.xml";
+ public static final String DEFAULT_ANT1_FILENAME = "build.xml";
/** The initialisation configuration for Ant */
private InitConfig initConfig;
@@ -127,6 +128,9 @@
/** Our current message output status. Follows MessageLevel values */
private int messageOutputLevel = MessageLevel.MSG_INFO;
+ /** The logger that will be used for the build */
+ private BuildLogger logger = null;
+
/**
* Start the command line front end for mutant.
*
@@ -152,7 +156,7 @@
throws ConfigException {
// Add the default listener
- execManager.addBuildListener(createLogger());
+ execManager.addBuildListener(logger);
for (Iterator i = listeners.iterator(); i.hasNext(); ) {
String className = (String)i.next();
@@ -259,8 +263,11 @@
*/
private void process(String[] args, InitConfig initConfig) {
this.initConfig = initConfig;
+ ExecutionManager executionManager = null;
+ Project project = null;
try {
parseArguments(args);
+ createLogger();
determineBuildFile();
AntConfig config = new AntConfig();
@@ -287,12 +294,23 @@
+ buildFileURL);
}
- Project project = parseProject();
+ project = parseProject();
// create the execution manager to execute the build
- ExecutionManager executionManager
- = new ExecutionManager(initConfig, config);
+ executionManager = new ExecutionManager(initConfig, config);
addBuildListeners(executionManager);
+ } catch (Throwable e) {
+ if (logger != null) {
+ BuildEvent finishedEvent
+ = new BuildEvent(this, BuildEvent.BUILD_FINISHED, e);
+ logger.buildFinished(finishedEvent);
+ } else {
+ e.printStackTrace();
+ }
+ System.exit(1);
+ }
+
+ try {
executionManager.init();
executionManager.runBuild(project, targets, definedProperties);
System.exit(0);
@@ -448,11 +466,9 @@
* Creates the default build logger for sending build events to the ant
* log.
*
- * @return the logger instance to be used for the build
* @exception ConfigException if the logger cannot be instantiatd
*/
- private BuildLogger createLogger() throws ConfigException {
- BuildLogger logger = null;
+ private void createLogger() throws ConfigException {
if (loggerClassname != null) {
try {
Class loggerClass = Class.forName(loggerClassname);
@@ -477,8 +493,6 @@
logger.setMessageOutputLevel(messageOutputLevel);
logger.setOutputPrintStream(out);
logger.setErrorPrintStream(err);
-
- return logger;
}
}
1.6 +1 -1
jakarta-ant/proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java
Index: DefaultLogger.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- DefaultLogger.java 11 Feb 2002 15:42:19 -0000 1.5
+++ DefaultLogger.java 18 Feb 2002 12:36:05 -0000 1.6
@@ -85,7 +85,7 @@
/** Standard field separator */
private static String lSep = System.getProperty("line.separator");
/** spacing to allow for task tags */
- private final static int LEFT_COLUMN_SIZE = 12;
+ private static final int LEFT_COLUMN_SIZE = 12;
/**
* Set the messageOutputLevel this logger is to respond to. Only
1.5 +9 -9
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/event/BuildEvent.java
Index: BuildEvent.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/event/BuildEvent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- BuildEvent.java 11 Feb 2002 15:42:19 -0000 1.4
+++ BuildEvent.java 18 Feb 2002 12:36:05 -0000 1.5
@@ -68,19 +68,19 @@
public class BuildEvent extends EventObject {
/** Build Started Event type */
- public final static int BUILD_STARTED = 1;
+ public static final int BUILD_STARTED = 1;
/** Build Finished Event Type */
- public final static int BUILD_FINISHED = 2;
+ public static final int BUILD_FINISHED = 2;
/** Start of target event type */
- public final static int TARGET_STARTED = 3;
+ public static final int TARGET_STARTED = 3;
/** Target finished event type */
- public final static int TARGET_FINISHED = 4;
+ public static final int TARGET_FINISHED = 4;
/** Start of task event type */
- public final static int TASK_STARTED = 5;
+ public static final int TASK_STARTED = 5;
/** end of task event type */
- public final static int TASK_FINISHED = 6;
+ public static final int TASK_FINISHED = 6;
/** message event type */
- public final static int MESSAGE = 7;
+ public static final int MESSAGE = 7;
/** The type of this event */
private int eventType;
@@ -97,7 +97,7 @@
* @param eventType the type of the buildEvent.
* @param source the element with which this event is associated
*/
- public BuildEvent(ModelElement source, int eventType) {
+ public BuildEvent(Object source, int eventType) {
super(source);
this.eventType = eventType;
}
@@ -109,7 +109,7 @@
* @param cause An exception if associated with the event
* @param source the object with which this event is associated
*/
- public BuildEvent(ModelElement source, int eventType,
+ public BuildEvent(Object source, int eventType,
Throwable cause) {
this(source, eventType);
this.cause = cause;
1.2 +5 -5
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/event/MessageLevel.java
Index: MessageLevel.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/event/MessageLevel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- MessageLevel.java 11 Feb 2002 15:42:19 -0000 1.1
+++ MessageLevel.java 18 Feb 2002 12:36:05 -0000 1.2
@@ -61,14 +61,14 @@
*/
public class MessageLevel {
/** Error message level */
- public final static int MSG_ERR = 0;
+ public static final int MSG_ERR = 0;
/** Warnign message level */
- public final static int MSG_WARN = 1;
+ public static final int MSG_WARN = 1;
/** Informational message level */
- public final static int MSG_INFO = 2;
+ public static final int MSG_INFO = 2;
/** Verbose message level */
- public final static int MSG_VERBOSE = 3;
+ public static final int MSG_VERBOSE = 3;
/** Debug Message level */
- public final static int MSG_DEBUG = 4;
+ public static final int MSG_DEBUG = 4;
}
1.2 +1 -1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/model/Project.java
Index: Project.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/model/Project.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- Project.java 5 Feb 2002 11:49:06 -0000 1.1
+++ Project.java 18 Feb 2002 12:36:05 -0000 1.2
@@ -79,7 +79,7 @@
* The delimiter used to separate reference names in target names, data
* values, etc
*/
- public final static String REF_DELIMITER = ":";
+ public static final String REF_DELIMITER = ":";
/** The default target in this project. */
private String defaultTarget = null;
1.7 +13 -0
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ComponentService.java
Index: ComponentService.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ComponentService.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- ComponentService.java 12 Feb 2002 13:23:20 -0000 1.6
+++ ComponentService.java 18 Feb 2002 12:36:05 -0000 1.7
@@ -145,5 +145,18 @@
* @exception ExecutionException if the library cannot be imported
*/
void importLibrary(String libraryId) throws ExecutionException;
+
+ /**
+ * Imports a component defined in a nother frame.
+ *
+ * @param relativeName the qualified name of the component relative to
+ * this execution frame
+ * @param alias the name under which this component will be used in the
+ * build scripts. If this is null, the components default name is
+ * used.
+ * @exception ExecutionException if the component cannot be imported
+ */
+ void importFrameComponent(String relativeName, String alias)
+ throws ExecutionException;
}
1.2 +2 -2
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/MagicProperties.java
Index: MagicProperties.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/MagicProperties.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- MagicProperties.java 7 Feb 2002 09:43:17 -0000 1.1
+++ MagicProperties.java 18 Feb 2002 12:36:05 -0000 1.2
@@ -64,9 +64,9 @@
* This property describes the basedir which is being used for an Ant
* run.
*/
- public final static String BASEDIR = "basedir";
+ public static final String BASEDIR = "basedir";
/** This property provides the location of Ant's home directory */
- public final static String ANT_HOME = "ant.home";
+ public static final String ANT_HOME = "ant.home";
}
1.4 +1 -1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/Location.java
Index: Location.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/Location.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Location.java 2 Feb 2002 14:50:33 -0000 1.3
+++ Location.java 18 Feb 2002 12:36:05 -0000 1.4
@@ -62,7 +62,7 @@
public class Location {
/** Standard unknown location constant; */
- public final static Location UNKNOWN_LOCATION = new Location();
+ public static final Location UNKNOWN_LOCATION = new Location();
/** The source URL to which this location relates. */
private String source;
1.2 +1 -1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/StringUtils.java
Index: StringUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/StringUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- StringUtils.java 5 Feb 2002 11:49:06 -0000 1.1
+++ StringUtils.java 18 Feb 2002 12:36:05 -0000 1.2
@@ -66,7 +66,7 @@
public final class StringUtils {
/** the line separator for this OS */
- public final static String LINE_SEP =
System.getProperty("line.separator");
+ public static final String LINE_SEP =
System.getProperty("line.separator");
/**
* Convenient method to retrieve the full stacktrace from a given
1.3 +38 -0
jakarta-ant/proposal/mutant/src/java/init/org/apache/ant/init/ClassLocator.java
Index: ClassLocator.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/init/org/apache/ant/init/ClassLocator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- ClassLocator.java 22 Jan 2002 23:03:14 -0000 1.2
+++ ClassLocator.java 18 Feb 2002 12:36:05 -0000 1.3
@@ -55,6 +55,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+import java.io.File;
/**
* The ClassLocator is a utility class which is used to determine the URL
@@ -101,6 +102,43 @@
// its running out of something besides a jar.
// We just return the Raw URL as a best guess
return classRawURL;
+ }
+ }
+
+ /**
+ * Get the URLs necessary to load the Sun compiler tools. In some JVMs
+ * this is available in the VM's system loader, in others we have to
+ * find it ourselves
+ *
+ * @return the URL to the tools jar if available, null otherwise
+ * @throws InitException if the URL to the tools jar cannot be formed.
+ */
+ public static URL getToolsJarURL()
+ throws InitException {
+ try {
+ // just check whether this throws an exception
+ Class.forName("sun.tools.javac.Main");
+ // tools jar is on system classpath - no need for URL
+ return null;
+ } catch (ClassNotFoundException cnfe) {
+ try {
+ // couldn't find compiler - try to find tools.jar
+ // based on java.home setting
+ String javaHome = System.getProperty("java.home");
+ if (javaHome.endsWith("jre")) {
+ javaHome = javaHome.substring(0, javaHome.length() - 4);
+ }
+ File toolsjar = new File(javaHome + "/lib/tools.jar");
+ if (!toolsjar.exists()) {
+ System.out.println("Unable to locate tools.jar. "
+ + "Expected to find it in " + toolsjar.getPath());
+ return null;
+ }
+ URL toolsJarURL = InitUtils.getFileURL(toolsjar);
+ return toolsJarURL;
+ } catch (MalformedURLException e) {
+ throw new InitException(e);
+ }
}
}
}
1.5 +1 -1
jakarta-ant/proposal/mutant/src/java/init/org/apache/ant/init/LoaderUtils.java
Index: LoaderUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/init/org/apache/ant/init/LoaderUtils.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- LoaderUtils.java 7 Feb 2002 09:43:17 -0000 1.4
+++ LoaderUtils.java 18 Feb 2002 12:36:05 -0000 1.5
@@ -77,7 +77,7 @@
* This is the file that is consulted on remote systems to specify
* available jars
*/
- public final static String LIST_FILE = "file.list";
+ public static final String LIST_FILE = "file.list";
/**
1.6 +2 -39
jakarta-ant/proposal/mutant/src/java/start/org/apache/ant/start/Main.java
Index: Main.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/start/org/apache/ant/start/Main.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- Main.java 6 Feb 2002 12:52:58 -0000 1.5
+++ Main.java 18 Feb 2002 12:36:05 -0000 1.6
@@ -73,7 +73,7 @@
*/
public class Main {
/** The actual class that implements the command line front end. */
- public final static String COMMANDLINE_CLASS
+ public static final String COMMANDLINE_CLASS
= "org.apache.ant.cli.Commandline";
@@ -127,43 +127,6 @@
}
- /**
- * Get the URLs necessary to load the Sun compiler tools. In some JVMs
- * this is available in the VM's system loader, in others we have to
- * find it ourselves
- *
- * @return the URL to the tools jar if available, null otherwise
- * @throws InitException if the URL to the tools jar cannot be formed.
- */
- private URL getToolsJarURL()
- throws InitException {
- try {
- // just check whether this throws an exception
- Class.forName("sun.tools.javac.Main");
- // tools jar is on system classpath - no need for URL
- return null;
- } catch (ClassNotFoundException cnfe) {
- try {
- // couldn't find compiler - try to find tools.jar
- // based on java.home setting
- String javaHome = System.getProperty("java.home");
- if (javaHome.endsWith("jre")) {
- javaHome = javaHome.substring(0, javaHome.length() - 4);
- }
- File toolsjar = new File(javaHome + "/lib/tools.jar");
- if (!toolsjar.exists()) {
- System.out.println("Unable to locate tools.jar. "
- + "Expected to find it in " + toolsjar.getPath());
- return null;
- }
- URL toolsJarURL = InitUtils.getFileURL(toolsjar);
- return toolsJarURL;
- } catch (MalformedURLException e) {
- throw new InitException(e);
- }
- }
- }
-
/**
* Get the location of AntHome
@@ -211,7 +174,7 @@
// set up the class loaders that will be used when running Ant
ClassLoader systemLoader = getClass().getClassLoader();
config.setSystemLoader(systemLoader);
- URL toolsJarURL = getToolsJarURL();
+ URL toolsJarURL = ClassLocator.getToolsJarURL();
config.setToolsJarURL(toolsJarURL);
URL commonJarLib = new URL(libraryURL, "common/");
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>