blob: 96a0cf259a6e9eb3fea025933ca1aef7d6678e8f [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(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.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<!-- ======================================================================
Build source and lay out results in the required format
====================================================================== -->
<project name="build-contribution" default="build" basedir=".">
<description>
Build contributed source and lay out results in the required format
</description>
<target name="help">
<echo>
Apache Harmony Classlibrary Build
Usage:
ant build
Compiles the java and native code to produce a jdk in
"deploy/jdk".
ant clean
Removes all the files generated by a build.
ant rebuild
Performs a full build - that is 'clean' then 'build'.
ant test
Runs all the tests.
ant doc
Generates the javadoc.
ant snapshot
Produces a archive (tar/zip) of a build.
ant fetch-depends
Fetches dependencies. Note: Some of Harmony's dependencies are
licensed under terms other than the Apache License v2.
ant properties
Display the common properties that are use in the ant build files.
The 'build' and 'test' targets can be configured to only build/test a single
module by setting the 'build.module' property. For example, to run the tests for
the "luni" module:
ant test -Dbuild.module=luni
The 'test' target can further be configured to run a single test by setting
the 'test.case' property. For example, to run a specific test in the "luni"
module:
ant test -Dbuild.module=luni -Dtest.case=org.apache.harmony.luni.tests.java.lang.MathTest
</echo>
</target>
<property file="${user.home}/.harmony-classlib.properties" />
<property name="hy.hdk" location="deploy" />
<!-- import properties for snapshot targets -->
<import file="${basedir}/make/properties.xml" />
<!-- ================================
target : rebuild
builds with a clean first
================================= -->
<target name="rebuild" depends="clean,build"
description="Performs a full build - that is 'clean' then 'build'" />
<target name="build" depends="build-java,build-native,build-test"
description="Compiles the java and native code to produce a jdk" />
<target name="support-jar" depends="build-java" >
<ant antfile="make/build-test.xml" inheritall="false"
target="support-jar"/>
</target>
<target name="clean"
depends="clean-java,clean-native,clean-test,-clean-hdk"
description="Removes all the files generated by a build" />
<!-- ================================
target : rebuild-java
builds java source with a clean first
================================= -->
<target name="rebuild-java" depends="clean-java,build-java"
description="Like 'rebuild' but for java code only" />
<!-- =================================
target: build-java
runs the build target in build-java.xml
================================= -->
<target name="build-java" depends="-init-hdk"
description="Compiles the java code only" >
<echo>
========================================
Building Java component archives...
========================================
</echo>
<ant antfile="make/build-java.xml" inheritall="false" target="build"/>
</target>
<!-- =================================
target: clean-java
runs the clean target in build-java.xml
================================= -->
<target name="clean-java" depends="-init-hdk-for-clean"
description="Removes the compiled java code" >
<ant antfile="make/build-java.xml" inheritall="false" target="clean" >
<property name="keep.working" value="${keep.working}" />
</ant>
</target>
<!-- ================================
target : rebuild-native
builds native source with a clean first
================================= -->
<target name="rebuild-native" depends="clean-native,build-native"
description="Like 'rebuild' but for native code only" />
<!-- =================================
target: build-native
runs the build target in build-native.xml
================================= -->
<target name="build-native" depends="-init-hdk"
description="Compiles the native code only" >
<echo>
========================================
Building native libs and executables...
========================================
</echo>
<ant antfile="make/build-native.xml" inheritall="false" target="build"/>
</target>
<!-- =================================
target: clean-native
runs the clean target in build-native.xml
================================= -->
<target name="clean-native" depends="-init-hdk-for-clean"
description="Removes the compiled native code" >
<ant antfile="make/build-native.xml" inheritall="false" target="clean" />
</target>
<target name="clean-test" depends="-init-hdk-for-clean"
description="Removes the generated tests" >
<ant antfile="make/build-test.xml" inheritall="false" target="clean" />
</target>
<target name="test" depends="-init-hdk"
description="Runs all tests">
<echo>
========================================
Testing class libraries...
========================================
</echo>
<ant antfile="make/build-test.xml" inheritall="false" target="test-all"/>
</target>
<target name="build-test" depends="-init-hdk,support-jar"
description="Compile and archive all tests">
<echo>
========================================
Compiling and archiving test classes ...
========================================
</echo>
<ant antfile="make/build-test.xml" inheritall="false" target="test-jar-modules"/>
</target>
<target name="findbugs" depends="-init-hdk"
description="Runs FindBugs on all modules">
<echo>
========================================
Finding bugs in all class libraries...
========================================
</echo>
<ant antfile="make/build-test.xml" inheritall="false" target="findbugs"/>
</target>
<!-- =================================
target: doc
================================= -->
<target name="doc"
description="Generates the javadoc">
<echo>
========================================
Generating HTML using Doxygen...
========================================
</echo>
<ant antfile="doc/build.xml" inheritall="false" />
</target>
<target name="clean-doc" if="${really.clean.doc}">
<!-- We really shouldn't do this, since svn diff complains
with svn: Working copy 'doc/kernel_doc' is missing or not
locked if we run it. We shouldn't really clean things
that are in the repository. -->
<ant antfile="doc/build.xml" inheritall="false" target="clean" />
</target>
<!-- =================================
target: -properties
================================= -->
<target name="-properties" depends="svn-prop">
<property name="deploy.file.prefix"
value="harmony-classlib-r${svn.revision}" />
<property name="deploy.tar"
value="${deploy.file.prefix}-${hy.os}-${hy.arch}-snapshot.tar.gz" />
<property name="deploy.zip"
value="${deploy.file.prefix}-${hy.os}-${hy.arch}-snapshot.zip" />
</target>
<!-- =================================
target: snapshot
================================= -->
<target name="snapshot" depends="-snapshot-tar,-snapshot-zip"
description="Produce a classlib snapshot tar/zip" />
<!-- =================================
target: snapshot-tar
================================= -->
<target name="-snapshot-tar" depends="build, -properties" if="is.unix">
<echo>
========================================
Generating snapshot tar
========================================
</echo>
<tar destfile="${deploy.tar}" compression="gzip">
<tarfileset dir="${basedir}" prefix="Harmony">
<include name="LICENSE" />
<include name="NOTICE" />
<include name="deploy/build/**" />
<include name="deploy/include/**" />
<include name="deploy/jdk/**" />
<exclude name="deploy/jdk/jre/bin/default/**" />
<exclude name="deploy/jdk/jre/bin/java" />
<include name="deploy/lib/**" />
</tarfileset>
<tarfileset dir="${basedir}" prefix="Harmony" mode="755">
<include name="deploy/jdk/jre/bin/java" />
</tarfileset>
<tarfileset dir="${basedir}/make/resources"
includes="README-snapshot.txt"
fullpath="Harmony/README"/>
</tar>
<chksum file="${deploy.tar}" />
<chksum file="${deploy.tar}" type="sha" />
</target>
<!-- =================================
target: snapshot-zip
================================= -->
<target name="-snapshot-zip" depends="build,-properties" if="is.windows">
<echo>
========================================
Generating snapshot zip
========================================
</echo>
<zip destfile="${deploy.zip}">
<zipfileset dir="${basedir}" prefix="Harmony">
<include name="LICENSE" />
<include name="NOTICE" />
<include name="deploy/build/**" />
<include name="deploy/include/**" />
<include name="deploy/jdk/**" />
<exclude name="deploy/jdk/jre/bin/default/**" />
<exclude name="deploy/jdk/jre/bin/java" />
<include name="deploy/lib/**" />
</zipfileset>
<zipfileset dir="${basedir}/make/resources"
includes="README-snapshot.txt"
fullpath="Harmony/README.txt"/>
</zip>
<chksum file="${deploy.zip}" />
<chksum file="${deploy.zip}" type="sha" />
</target>
<target name="check-depends" depends="-init-hdk"
description="Report on whether the dependencies are met">
<ant antfile="make/depends.xml" inheritall="false" target="check" />
<poll-modules target="check-depends" />
</target>
<target name="fetch-depends" depends="-init-hdk"
description="Fetches dependencies. Note: Some of Harmony's dependencies are licensed under terms other than the Apache License v2.">
<ant antfile="make/depends.xml" inheritall="false" target="download" />
<poll-modules target="fetch-depends" />
</target>
<target name="properties" depends="echo"
description="Display the properties that are use in the ant build files"
/>
<target name="-init-hdk">
<init-hdk />
</target>
<target name="-init-hdk-for-clean">
<!-- This is currently the same as "-init-hdk" but has
a different name since otherwise it would only
get called once - before the clean - during a rebuild
and not called a second time - before the build.
-->
<init-hdk />
</target>
<target name="-clean-hdk">
<delete dir="${hy.hdk}/build/ant" />
<delete dir="${hy.hdk}/build/make" />
</target>
<macrodef name="chksum">
<attribute name="file" />
<attribute name="type" default="md5" />
<sequential>
<checksum property="@{file}.@{type}" file="@{file}"
algorithm="@{type}" />
<echo file="@{file}.@{type}"
message="${@{file}.@{type}} @{file}${line.separator}" />
</sequential>
</macrodef>
<macrodef name="init-hdk">
<sequential>
<mkdir dir="${hy.hdk}/build/ant" />
<copy file="make/properties.xml"
tofile="${hy.hdk}/build/ant/properties.xml"
outputencoding="UTF-8" >
<filterchain>
<tokenfilter>
<replacestring from="Top-Level property definitions"
to="Classlib property definitions" />
</tokenfilter>
</filterchain>
</copy>
<copy file="make/make.xml"
tofile="${hy.hdk}/build/ant/make.xml"
outputencoding="UTF-8" >
</copy>
<copy file="make/depends-common.xml"
tofile="${hy.hdk}/build/ant/depends.xml"
outputencoding="UTF-8" >
<filterchain>
<tokenfilter>
<replacestring from="Common dependency definitions"
to="Classlib dependency definitions" />
</tokenfilter>
</filterchain>
</copy>
<copy file="make/depends.properties"
tofile="${hy.hdk}/build/ant/depends.properties"
outputencoding="UTF-8" >
</copy>
<mkdir dir="${hy.hdk}/build/make" />
<copy todir="${hy.hdk}/build/make" overwrite="yes">
<fileset dir="depends/build">
<include name="**" />
</fileset>
</copy>
</sequential>
</macrodef>
</project>