Permalink
Fetching contributors…
Cannot retrieve contributors at this time
336 lines (305 sloc) 15.3 KB
<?xml version="1.0"?>
<project name="RingoJS" default="usage" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="usage">
<echo message=""/>
<echo message="RingoJS build targets"/>
<echo message=""/>
<echo message=" update --> retrieve dependencies via Apache Ivy"/>
<echo message=" compile --> compiles the source code to ./build/classes"/>
<echo message=" jar --> generates the ./lib/ringo.jar file"/>
<echo message=" test --> run JUnit and RingoJS tests"/>
<echo message=" test-dates --> runs ringo/utils/dates test in different timezones"/>
<echo message=" javadoc --> generates the Javadoc for Ringo's core"/>
<echo message=" package --> creates RingoJS distribution"/>
<echo message=" dpkg --> creates RingoJS debian package"/>
<echo message=" clean --> clean up compiled resources"/>
</target>
<!-- =================================================================== -->
<!-- Initializes some variables -->
<!-- =================================================================== -->
<target name="init">
<property name="project" value="ringojs"/>
<property name="version" value="1.2.0"/>
<!-- pom.xml generation -->
<property name="ivy.pom.name" value="RingoJS" />
<property name="ivy.pom.description" value="RingoJS is a JavaScript platform built on the JVM and optimized for server-side applications." />
<property name="ivy.pom.url" value="https://ringojs.org/" />
<property name="ivy.pom.header" value="" />
<property name="ivy.pom.license" value="&lt;!-- RingoJS is licensed under Apache License Version 2.0 --&gt;" />
<property name="ivy.pom.groupId" value="org.ringojs" />
<property name="ivy.pom.artifactId" value="ringojs" />
<property name="ivy.pom.version" value="${version}" />
<!-- javac default targets for cross compilation on newer JDKs -->
<property name="ant.build.javac.source" value="7"/>
<property name="ant.build.javac.target" value="7"/>
<property name="home" value="."/>
<property name="src" value="${home}/src"/>
<property name="lib" value="${home}/lib"/>
<property name="build" value="${home}/build"/>
<property name="classes" value="${build}/classes"/>
<property name="javadoc" value="${home}/docs/java/"/>
<property name="pom.templatefile" value="${home}/tools/pom-template.xml" />
<property name="ringo-core.jar" value="${lib}/ringo-core.jar"/>
<property name="ringo-modules.jar" value="${lib}/ringo-modules.jar"/>
<property name="debug" value="on"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="on"/>
<property name="testclasses" value=""/>
<path id="classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="${ringo-core.jar}"/>
</fileset>
<pathelement location="${classes}"/>
</path>
</target>
<!-- =================================================================== -->
<!-- Fetches dependencies via Apache Ivy -->
<!-- =================================================================== -->
<target name="update">
<ivy:retrieve type="jar" sync="true" pattern="${ivy.lib.dir}/ivy/[originalname].[ext]"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${classes}"/>
<javac srcdir="${src}"
destdir="${classes}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"
includeAntRuntime="false">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="classpath"/>
<!-- fix for openjdk rhino bootclasspath bug -->
<compilerarg value="-Xbootclasspath/p:${lib}/js.jar"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- Runs the JUnit and RingoJS test cases -->
<!-- =================================================================== -->
<target name="test" depends="jar">
<java jar="run.jar" fork="true" failonerror="yes">
<arg value="test/all.js"/>
</java>
<junit haltonfailure="true">
<classpath refid="classpath"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${src}">
<include name="**/*Test*.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- =================================================================== -->
<!-- Runs the date test cases -->
<!-- =================================================================== -->
<target name="test-dates" depends="jar">
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=UTC"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+0"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<!-- GMT + Offset -->
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+1"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+2"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+3"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+4"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+5"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+6"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+7"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+8"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+9"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+10"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+11"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+12"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<!-- GMT - Offset -->
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-1"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-2"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-3"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-4"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-5"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-6"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-7"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-8"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-9"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-10"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-11"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-12"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
</target>
<!-- =================================================================== -->
<!-- Creates a jar file in the lib-directory -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<jar jarfile="${ringo-core.jar}">
<fileset dir="${home}" includes="pom.xml"/>
<fileset dir="${classes}"/>
<fileset dir="${src}" excludes="**/*.java,**/package.html"/>
</jar>
<jar jarfile="${ringo-modules.jar}">
<fileset dir="${home}" includes="modules/**"/>
</jar>
<jar jarfile="run.jar"
basedir="${classes}"
includes="**/tools/launcher/**"
manifest="${src}/org/ringojs/tools/launcher/manifest.txt"/>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadoc" depends="jar">
<mkdir dir="${javadoc}"/>
<javadoc packagenames="org.ringojs.*"
destdir="${javadoc}"
windowtitle="RingoJS Java API"
doctitle="RingoJS Java API">
<fileset dir="${src}" includes="**/*.java" />
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Checks if /packages is empty to prevent shipping its content -->
<!-- =================================================================== -->
<target name="packages-empty" depends="init">
<fail message="/packages is not empty, but needs to be for a packaged build!">
<condition>
<resourcecount when="greater" count="0">
<dirset dir="${home}/packages/" includes="*" />
</resourcecount>
</condition>
</fail>
</target>
<!-- =================================================================== -->
<!-- Create zipped files for distribution -->
<!-- =================================================================== -->
<target name="package" depends="packages-empty,jar,javadoc,test">
<!-- These files need chmod 755 -->
<property name="package-binaries" value="bin/ringo,bin/ringo-admin,bin/ringo-web"/>
<property name="package-excludes" value="bin/ringo,bin/ringo-admin,bin/ringo-web,bin/rp,build/**,*.zip,*.o,*.tar,*.tar.gz,.*/**,bin/rp" />
<zip zipfile="../${project}-${version}.zip">
<zipfileset dir="${home}" prefix="${project}-${version}" filemode="755" includes="${package-binaries}" />
<zipfileset dir="${home}" prefix="${project}-${version}" excludes="${package-excludes}" />
</zip>
<tar tarfile="../${project}-${version}.tar">
<tarfileset dir="${home}" prefix="${project}-${version}" filemode="755" includes="${package-binaries}" />
<tarfileset dir="${home}" prefix="${project}-${version}" excludes="${package-excludes}" />
</tar>
<gzip src="../${project}-${version}.tar" destfile="../${project}-${version}.tar.gz"/>
<delete file="../${project}-${version}.tar"/>
</target>
<!-- =================================================================== -->
<!-- Creates a POM -->
<!-- =================================================================== -->
<target name="pom" depends="init">
<ivy:makepom ivyfile="ivy.xml" pomfile="pom.xml" templatefile="${pom.templatefile}" conf="default">
<mapping conf="default" scope="compile"/>
</ivy:makepom>
</target>
<!-- =================================================================== -->
<!-- Create a debian package -->
<!-- =================================================================== -->
<target name="dpkg" depends="packages-empty,package">
<exec executable="dpkg-buildpackage">
<arg value="-rfakeroot"/>
<arg value="-b"/>
</exec>
<exec executable="dh_clean">
<arg value="debian/stamp-ant-build"/>
</exec>
</target>
<!-- =================================================================== -->
<!-- Clean up compiled resources -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<delete dir="${build}"/>
<delete file="${ringo-core.jar}"/>
<delete file="${ringo-modules.jar}"/>
<delete file="run.jar"/>
<!-- transitional: delete old ringo.jar file -->
<delete file="lib/ringo.jar"/>
</target>
<!-- =================================================================== -->
<!-- Clean up the ivy cache -->
<!-- =================================================================== -->
<target name="clean-cache" depends="init">
<ivy:cleancache />
</target>
</project>