gecko-dev/js/rhino/build.xml

204 lines
7.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Build file for Rhino using Ant (see http://jakarta.apache.org/ant/index.html)
Requires Ant version 1.2
-->
<project name="Rhino" default="package" basedir=".">
<target name="properties">
<property name="name" value="rhino"/>
<property name="Name" value="Rhino"/>
<property name="rhino.jar" value="js.jar"/>
<property name="build.compiler" value="classic"/>
<property name="debug" value="off"/>
<property name="src.dir" value="."/>
<property name="src.examples" value="${src.dir}/examples"/>
<property name="src.debugger"
value="${src.dir}/org/mozilla/javascript/tools/debugger"/>
<property name="build.dir" value="./build"/>
<property name="build.dest" value="${build.dir}/classes"/>
<property name="dist.name" value="rhino15R2pre"/>
<property name="dist.dir" value="${build.dir}/${dist.name}"/>
<property name="dist.src" value="${dist.dir}/src"/>
<property name="dist.examples" value="${dist.dir}/examples"/>
<property name="dist.docs" value="${dist.dir}/docs"/>
<property name="dist.apidocs" value="${dist.docs}/apidocs"/>
<property name="dist.file" value="rhinoTip.zip"/>
<property file="apiClasses.properties"/>
<property name="cvs.javasrc.dir" value="${src.dir}"/>
<property name="cvs.docsrc.dir" value="../../../mozilla-org/html/rhino/"/>
<property name="dist.javasrc.dir" value="${src.dir}/src"/>
<property name="dist.docsrc.dir" value="${src.dir}/docs"/>
<available file="${cvs.javasrc.dir}/org" property="in-cvs-tree"/>
<available file="${src.debugger}/AbstractCellEditor.java"
property="swing-ex-available"/>
<available classname="java.lang.reflect.Proxy"
property="jdk1.3"/>
</target>
<target name="init" depends="properties">
</target>
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dest}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.src}"/>
<mkdir dir="${dist.examples}"/>
<mkdir dir="${dist.docs}"/>
<mkdir dir="${dist.apidocs}"/>
</target>
<target name="get-swing-ex" unless="swing-ex-available">
<!-- Download source from Sun's site, unzip it, remove
the files we don't need, and change the package
-->
<get src="http://java.sun.com/products/jfc/tsc/articles/treetable2/downloads/src.zip" dest="${build.dir}/swingExSrc.zip"/>
<unzip src="${build.dir}/swingExSrc.zip" dest="${src.debugger}"/>
<delete file="${src.debugger}/FileSystemModel2.java" />
<delete file="${src.debugger}/MergeSort.java" />
<delete file="${src.debugger}/TreeTableExample2.java" />
<replace file="${src.debugger}/AbstractCellEditor.java">
<replacetoken>import java.awt.Component;</replacetoken>
<replacevalue>
package org.mozilla.javascript.tools.debugger;
import java.awt.Component;
</replacevalue>
</replace>
<replace file="${src.debugger}/AbstractTreeTableModel.java">
<replacetoken>import javax.swing.tree.*;</replacetoken>
<replacevalue>
package org.mozilla.javascript.tools.debugger;
import javax.swing.tree.*;
</replacevalue>
</replace>
<replace file="${src.debugger}/JTreeTable.java">
<replacetoken>import javax.swing.*;</replacetoken>
<replacevalue>
package org.mozilla.javascript.tools.debugger;
import javax.swing.*;
</replacevalue>
</replace>
<replace file="${src.debugger}/TreeTableModel.java">
<replacetoken>import javax.swing.tree.TreeModel;</replacetoken>
<replacevalue>
package org.mozilla.javascript.tools.debugger;
import javax.swing.tree.TreeModel;
</replacevalue>
</replace>
<replace file="${src.debugger}/TreeTableModelAdapter.java">
<replacetoken>import javax.swing.JTree;</replacetoken>
<replacevalue>
package org.mozilla.javascript.tools.debugger;
import javax.swing.JTree;
</replacevalue>
</replace>
</target>
<target name="compile-from-cvs"
if="in-cvs-tree"
depends="prepare,get-swing-ex">
<javac srcdir="${cvs.javasrc.dir}"
destdir="${build.dest}"
includes="org/**/*.java"
deprecation="on"
debug="${debug}">
<exclude name="**/debugger/*.java" unless="jdk1.3"/>
</javac>
</target>
<target name="compile-from-dist" unless="in-cvs-tree" depends="prepare">
<javac srcdir="${dist.javasrc.dir}"
destdir="${build.dest}"
includes="org/**/*.java"
deprecation="on"
debug="${debug}" />
</target>
<target name="compile" depends="compile-from-dist,compile-from-cvs"/>
<target name="copy-properties" depends="prepare">
<copy todir="${build.dest}">
<fileset dir="${src.dir}" includes="org/**/*.properties" />
</copy>
</target>
<target name="jar" depends="compile,copy-properties">
<jar jarfile="${dist.dir}/${rhino.jar}"
basedir="${build.dest}"
manifest="${src.dir}/manifest" />
</target>
<target name="copy-source" depends="prepare">
<copy todir="${dist.src}">
<fileset dir="${src.dir}"
includes="org/**/*.java,org/**/*.properties"
excludes="**/AbstractCellEditor.java,**/TreeTableModel.java,**/AbstractTreeTableModel.java,**/TreeTableModelAdapter.java,**/JTreeTable.java" />
</copy>
</target>
<target name="copy-examples" depends="prepare">
<copy todir="${dist.examples}">
<fileset dir="${src.examples}" includes="*.java,*.js,*.html" />
</copy>
</target>
<target name="copy-misc" depends="prepare">
<tstamp/>
<filter token="datestamp" value="${TODAY}"/>
<copy todir="${dist.dir}" filtering="yes">
<fileset dir="${src.dir}">
<patternset>
<include name="build.xml"/>
<include name="apiClasses.properties"/>
<include name="manifest"/>
<include name="built-on-date"/>
</patternset>
</fileset>
</copy>
</target>
<target name="copy-all" depends="copy-source,copy-examples,copy-misc">
</target>
<target name="copy-docs-cvs" if="in-cvs-tree" depends="prepare">
<echo message="copy from ${cvs.docsrc.dir}"/>
<copy todir="${dist.docs}">
<fileset dir="${cvs.docsrc.dir}"
includes="**/*.html,**/*.jpg,**/*.gif" />
</copy>
</target>
<target name="copy-docs-dist" unless="in-cvs-tree" depends="prepare">
<echo message="Docs and source not copied on build from dist."/>
</target>
<target name="copy-docs" depends="copy-docs-dist,copy-docs-cvs"/>
<target name="javadoc" if="in-cvs-tree" depends="copy-source,copy-docs">
<javadoc sourcefiles="${apiClasses}"
sourcepath="${dist.src}"
destdir="${dist.apidocs}"
overview="${dist.docs}/api.html"
version="true"
author="true"
public="true"
windowtitle="${Name}" />
</target>
<target name="package" depends="copy-all,jar,javadoc">
<delete file="${src.dir}/${dist.file}" />
<zip zipfile="${src.dir}/${dist.file}"
basedir="${build.dir}"
includes="**"
excludes="classes/**" />
</target>
</project>