rhino ant build script : Big Project Ant Script « Ant « Java






rhino ant build script


<?xml version="1.0" encoding="utf-8"?>
<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1/GPL 2.0
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (the "License"); you may not use this file except in compliance with
   - the License. You may obtain a copy of the License at
   - http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is Rhino code, released May 6, 1999.
   -
   - The Initial Developer of the Original Code is
   - Netscape Communications Corporation.
   - Portions created by the Initial Developer are Copyright (C) 1997-1999
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -
   - Alternatively, the contents of this file may be used under the terms of
   - the GNU General Public License Version 2 or later (the "GPL"), in which
   - case the provisions of the GPL are applicable instead of those above. If
   - you wish to allow use of your version of this file only under the terms of
   - the GPL and not to allow others to use your version of this file under the
   - MPL, indicate your decision by deleting the provisions above and replacing
   - them with the notice and other provisions required by the GPL. If you do
   - not delete the provisions above, a recipient may use your version of this
   - file under either the MPL or the GPL.
   -
   - ***** END LICENSE BLOCK ***** -->


<!--
    Build file for Rhino using Ant (see http://jakarta.apache.org/ant/index.html)
    Requires Ant version 1.2 or later

    Compilation currently requires JDK 1.5 or later. Can cross-compile to
    support JDK 1.4.
-->

<project name="Rhino" default="help" basedir=".">

  <target name="properties">
    <!-- Allow user to override default settings from build.properties -->
    <property file="build.local.properties" />
    <tstamp>
      <!-- Specify date part of Context#getImplementationVersion() -->
      <format property="implementation.date" pattern="yyyy MM dd"/>
    </tstamp>
    <property file="build.properties"/>

    <property name="dist.file" value="rhino${version}.zip"/>
    <property name="dist.source-only-zip" value="rhino${version}-sources.zip"/>

    <property file="apiClasses.properties"/>
    <property name="xmlimplsrc-build-file"
              location="xmlimplsrc/build.xml"/>

    <available property="xmlimplsrc-present?"
               file="${xmlimplsrc-build-file}" />

  </target>

  <target name="init" depends="properties">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${classes}"/>
    <mkdir dir="${dist.dir}"/>
  </target>

  <target name="compile" depends="init">
    <ant antfile="src/build.xml" target="compile"/>
    <ant antfile="toolsrc/build.xml" target="compile"/>
    <antcall target="xmlimplsrc-compile" />
  </target>

  <target name="compile-all" depends="compile">
    <ant antfile="deprecatedsrc/build.xml" target="compile"/>
  </target>

  <target name="copy-source" depends="init">
    <ant antfile="src/build.xml" target="copy-source"/>
    <ant antfile="toolsrc/build.xml" target="copy-source"/>
    <ant antfile="testsrc/build.xml" target="copy-source"/>
    <antcall target="xmlimplsrc-copy-source" />
    <ant antfile="deprecatedsrc/build.xml" target="copy-source"/>
    <copy todir="${dist.dir}" file="build.xml"/>
    <copy todir="${dist.dir}" file="build.properties"/>
    <copy todir="${dist.dir}" file="apiClasses.properties"/>
    <copy todir="${dist.dir}" file="LICENSE.txt"/>
  </target>

  <target name="xmlimplsrc-compile" if="xmlimplsrc-present?">
    <echo>Calling ${xmlimplsrc-build-file}</echo>
    <!-- Ignore compilation errors under JDK less then 1.4 -->
    <property name="xmlimpl.compile.failonerror" value="no"/>
    <ant antfile="${xmlimplsrc-build-file}" target="compile"/>
  </target>

  <target name="xmlimplsrc-copy-source" if="xmlimplsrc-present?">
    <echo>Calling ${xmlimplsrc-build-file}</echo>
    <ant antfile="${xmlimplsrc-build-file}" target="copy-source"/>
  </target>

  <target name="jar" depends="compile-all">
    <property name="jarfile" location="${dist.dir}/${rhino.jar}"/>
    <jar jarfile="${jarfile}"
         basedir="${classes}"
         manifest="src/manifest"
     compress="${jar-compression}"
     />
  </target>

  <target name="retrotranslator" depends="retrotranslator-check,retrotranslator-download">
    <taskdef name="retrotranslator" classpath="build/download/Retrotranslator-1.2.3-bin/retrotranslator-transformer-1.2.3.jar"
      classname="net.sf.retrotranslator.transformer.RetrotranslatorTask"/>
  </target>


  <target name="retrotranslator-check">
    <condition property="retrotranslator.available">
      <and>
        <available file="build/download/Retrotranslator-1.2.3-bin/retrotranslator-transformer-1.2.3.jar"/>
        <available file="build/download/Retrotranslator-1.2.3-bin/retrotranslator-runtime-1.2.3.jar"/>
        <available file="build/download/Retrotranslator-1.2.3-bin/backport-util-concurrent-3.1.jar"/>
      </and>
    </condition>
  </target>

  <target name="retrotranslator-download" unless="retrotranslator.available">
    <mkdir dir="build/download"/>
    <get src="http://downloads.sourceforge.net/retrotranslator/Retrotranslator-1.2.3-bin.zip" dest="build/download/Retrotranslator-1.2.3-bin.zip" usetimestamp="true"/>
    <unzip src="build/download/Retrotranslator-1.2.3-bin.zip" dest="build/download"/>
  </target>

  <target name="retrojar" depends="jar,retrotranslator">
    <retrotranslator
      srcjar="${jarfile}"
      destjar="${dist.dir}/${rhino-14.jar}"
      embed="org.mozilla.javascript"
    />
  </target>

  <target name="smalljar" depends="compile">
    <property name="smalljarfile" location="${dist.dir}/${small-rhino.jar}"/>
    <jar basedir="${classes}" destfile="${smalljarfile}"
         compress="${jar-compression}">
      <include name="org/mozilla/javascript/*.class"/>

      <include name="org/mozilla/javascript/debug/*.class"/>
      <include name="org/mozilla/javascript/resources/*.properties"/>
      <include name="org/mozilla/javascript/xml/*.class"/>
      <include name="org/mozilla/javascript/continuations/*.class"/>
      <include name="org/mozilla/javascript/jdk13/*.class"/>

      <!-- exclude classes that defines only int constants -->
      <exclude name="org/mozilla/javascript/Token.class"/>

      <!-- exclude classes that uses class generation library -->
      <exclude name="org/mozilla/javascript/JavaAdapter*.class"/>

      <include name="org/mozilla/javascript/regexp/*.class"
               unless="no-regexp"/>
    </jar>

  </target>

  <target name="retrosmalljar" depends="smalljar,retrotranslator">
    <retrotranslator
      srcjar="${smalljarfile}"
      destjar="${dist.dir}/${small-rhino-14.jar}"
      embed="org.mozilla.javascript"
    />
  </target>

  <target name="copy-examples" depends="init">
    <mkdir dir="${dist.dir}/examples"/>
    <copy todir="${dist.dir}/examples">
      <fileset dir="examples" includes="**/*.java,**/*.js,**/*.html" />
    </copy>
  </target>

  <target name="copy-misc" depends="init">
    <filter token="datestamp" value="${TODAY}"/>
    <copy todir="${dist.dir}" filtering="yes">
      <fileset dir=".">
        <patternset>
          <include name="build-date"/>
        </patternset>
      </fileset>
    </copy>
  </target>

  <target name="copy-all" depends="copy-source,copy-examples,copy-misc">
  </target>

  <target name="javadoc" depends="init">
    <mkdir dir="${dist.dir}/javadoc"/>
    <javadoc sourcefiles="${apiClasses}"
             sourcepath="src"
             destdir="${dist.dir}/javadoc"
             version="true"
             author="true"
             windowtitle="${Name}" />
  </target>

  <target name="dev-javadoc" depends="init">
    <mkdir dir="${dist.dir}/javadoc"/>
    <javadoc sourcepath="src"
             destdir="${dist.dir}/javadoc"
             version="true"
             package="true"
             author="true"
             windowtitle="${Name}">
       <fileset
         dir="."
         includes="**/*.java"
         excludes="**/deprecatedsrc/**/*.java,**/testsrc/**/*.java"
       />
    </javadoc>
  </target>

  <target name="dist" depends="deepclean,jar,retrojar,copy-all,javadoc">
    <delete file="${dist.file}" />
    <zip destfile="${dist.file}">
      <fileset dir="${build.dir}" includes="${dist.name}/**"/>
    </zip>
  </target>

  <target name="source-zip" depends="copy-source,copy-examples,javadoc">
    <delete file="${dist.source-only-zip}" />
    <zip destfile="${dist.source-only-zip}">
      <zipfileset prefix="${dist.name}" dir="${dist.dir}">
        <include name="*src/**"/>
        <include name="build.xml"/>
        <include name="*.properties"/>
        <include name="examples/**"/>
      </zipfileset>
    </zip>
  </target>

  <target name="compile-debugger">
    <ant antfile="toolsrc/build.xml" target="compile-debugger"/>
  </target>

  <target name="clean" depends="properties">
    <delete quiet="true" file="${dist.dir}/${rhino.jar}"/>
    <delete quiet="true" file="${dist.dir}/${small-rhino.jar}"/>
    <delete quiet="true" dir="${build.dir}"/>
  </target>

  <target name="deepclean" depends="properties">
    <delete quiet="true" dir="${build.dir}"/>
    <delete quiet="true" file="${dist.file}"/>
    <delete quiet="true" file="${dist.source-only-zip}"/>
  </target>

  <!--
    The next two targets run the JavaScript Test Library tests.  Note that these tests are quite extensive and take a long time
    to run.  They are not documented in the 'help' target for now.
  -->

  <!--
    Run the tests using JUnit.  Beware that if you are using Ant from the command-line, there are some difficulties you may
    encounter setting this up correctly; see http://ant.apache.org/faq.html#delegating-classloader

    IDEs that use Ant as the build system probably handle this fine.
  -->
  <target name="junit-all" depends="compile">
    <ant antfile="testsrc/build.xml" target="junit-coveragereport"/>
  </target>

  <!--
  Run the tests using the Java port of jsdriver.pl.  Note that running this port
  from the command-line may be more useful running this Ant target, as running
  from the command line allows configuration options, such as running with a
  non-default optimization level, or running only a subset of the tests.
  -->
  <target name="jsdriver-run" depends="compile">
      <ant antfile="testsrc/build.xml" target="jsdriver" />
  </target>

  <!--
    Compile the JsDriver test driver.
  -->
  <target name="jsdriver" depends="compile">
      <ant antfile="testsrc/build.xml" target="clean" />
      <ant antfile="testsrc/build.xml" target="compile" />
  </target>

  <target name="help" depends="properties">
<echo>The following targets are available with this build file:

 clean       remove all compiled classes and copied property files

 compile     compile classes and copy all property files
             into ${classes} directory
             excluding deprecated code

 compile-all compile all classes and copy all property files
             into ${classes} directory
             including deprecated code

 deepclean   remove all generated files and directories

 dist        create ${dist.file} with full Rhino distribution

 help        print this help

 jar         create ${rhino.jar} in ${dist.dir}

 smalljar    create ${small-rhino.jar} in ${dist.dir} with
             minimalist set of Rhino classes. See footprint.html
             from the doc directory for details.

 javadoc     generate Rhino API documentation
             in ${dist.dir}/javadoc

 source-zip  create ${dist.source-only-zip} with all Rhino
             source files necessary to recreate ${dist.file}
</echo>
  </target>

</project>


File: build.properties

# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Rhino code, released
# May 6, 1999.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1997-1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#   Igor Bukanov
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 2 or later (the "GPL"), in which
# case the provisions of the GPL are applicable instead of those above. If
# you wish to allow use of your version of this file only under the terms of
# the GPL and not to allow others to use your version of this file under the
# MPL, indicate your decision by deleting the provisions above and replacing
# them with the notice and other provisions required by the GPL. If you do
# not delete the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# ***** END LICENSE BLOCK *****

name: rhino
Name: Rhino
version: 1_7R2
# See Context#getImplementationVersion() for format of this!
implementation.version: Rhino 1.7 release 2 ${implementation.date}

build.dir: build
rhino.jar: js.jar
small-rhino.jar: smalljs.jar
rhino-14.jar: js-14.jar
small-rhino-14.jar: smalljs-14.jar
dist.name: rhino${version}
dist.dir: ${build.dir}/${dist.name}

# compilation destionation
classes: ${build.dir}/classes

# compilation settings
debug: on
target-jvm: 1.5
source-level: 1.5

# jar generation settings
jar-compression: true

# optional external packages
xmlbeans: .
xbean.jar: ${xmlbeans}/lib/xbean.jar
jsr173.jar: ${xmlbeans}/lib/jsr173_1.0_api.jar


File: apiClasses.properties

# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Rhino code, released May 6, 1999.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1997-1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# the GNU General Public License Version 2 or later (the "GPL"), in which
# case the provisions of the GPL are applicable instead of those above. If
# you wish to allow use of your version of this file only under the terms of
# the GPL and not to allow others to use your version of this file under the
# MPL, indicate your decision by deleting the provisions above and replacing
# them with the notice and other provisions required by the GPL. If you do
# not delete the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# ***** END LICENSE BLOCK *****

apiClasses=\
  src/org/mozilla/javascript/Callable.java,\
  src/org/mozilla/javascript/ClassCache.java,\
  src/org/mozilla/javascript/ClassShutter.java,\
  src/org/mozilla/javascript/CompilerEnvirons.java,\
  src/org/mozilla/javascript/ContinuationPending.java,\
  src/org/mozilla/javascript/Context.java,\
  src/org/mozilla/javascript/ContextAction.java,\
  src/org/mozilla/javascript/ContextFactory.java,\
  src/org/mozilla/javascript/GeneratedClassLoader.java,\
  src/org/mozilla/javascript/EcmaError.java,\
  src/org/mozilla/javascript/ErrorReporter.java,\
  src/org/mozilla/javascript/EvaluatorException.java,\
  src/org/mozilla/javascript/Function.java,\
  src/org/mozilla/javascript/FunctionObject.java,\
  src/org/mozilla/javascript/GeneratedClassLoader.java,\
  src/org/mozilla/javascript/ImporterTopLevel.java,\
  src/org/mozilla/javascript/JavaScriptException.java,\
  src/org/mozilla/javascript/RefCallable.java,\
  src/org/mozilla/javascript/RhinoException.java,\
  src/org/mozilla/javascript/Script.java,\
  src/org/mozilla/javascript/Scriptable.java,\
  src/org/mozilla/javascript/ScriptableObject.java,\
  src/org/mozilla/javascript/SecurityController.java,\
  src/org/mozilla/javascript/WrapFactory.java,\
  src/org/mozilla/javascript/WrappedException.java,\
  src/org/mozilla/javascript/Wrapper.java,\
  src/org/mozilla/javascript/Synchronizer.java,\
  src/org/mozilla/javascript/optimizer/ClassCompiler.java,\
  src/org/mozilla/javascript/debug/DebuggableScript.java,\
  src/org/mozilla/javascript/serialize/ScriptableInputStream.java,\
  src/org/mozilla/javascript/serialize/ScriptableOutputStream.java

 








Related examples in the same category

1.Ant script for xmlgraphics-commons
2.nutch ant script
3.apache solr ant script
4.Tomcat ant build script
5.OFBiz ant build script
6.Apache Lenya Build System
7.Apache pivot ant build script
8.XmlSchema ant script
9.xml security
10.velocity tools ant script
11.weka build script
12.xml bean ant script
13.xml graphics common ant script
14.uPortal ant script
15.SmartGWT ant script
16.Build file to fetch maven2 tasks; extracted from (Ant's) fetch.xml
17.Build file to fetch optional libraries for Apache Ant
18.Ant build script
19.Build script for apache-cassandra-0.5.1-src
20.apache-log4j-site\build.xml
21.apache-roller-src-4.0.1
22.Build script from apache dbutils
23.Fop build script
24.Google guice ant script
25.GWT ant script
26.hadoop ant build script
27.jakarta jmeter ant script
28.jakarta oro ant script
29.jakarta regexp ant script
30.jedit build script
31.jibx ant build script
32.lucene ant build script