blob: 2f6c425fd9cffb3b971869d266c8fdf5f72256b4 [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.
-->
<project name="JDK Tools Build" default="build" basedir=".">
<description>Build for JDK Tools component</description>
<property name="hy.component" value="jdktools" />
<property name="hy.module" value="jdktools" />
<property name="hy.target" location="${basedir}/../../target" />
<import file="${hy.target}/hdk/build/ant/properties.xml" />
<import file="${hy.hdk}/build/ant/depends.xml" />
<property file="../../make/depends.properties" />
<property file="${common.resources}/make/depends.properties" />
<target name="check-depends" unless="skip.java.build">
<check-one-file src="${jdt.jdi.jar.url}"
dest="${jdt.jdi.jar}" />
<check-one-file src="${jdt.jdimodel.jar.url}"
dest="${jdt.jdimodel.jar}" />
<check-one-file src="${icu.url}" dest="${icu.jar}" />
<check-one-file src="${ecj.jar.url}" dest="${ecj.jar}" />
<check-one-file src="${bcel.jar}" dest="${bcel.jar}" />
<mkdir dir="${hy.hdk}/jdk/jre/lib/boot/${bcel.base}" />
<copy todir="${hy.hdk}/jdk/jre/lib/boot/${bcel.base}">
<fileset file="${bcel.jar}" />
<fileset dir="depends/bcel" />
</copy>
<check-one-file dest="${junit.jar}" src="${junit.jar.url}"/>
<check-one-file dest="${hamcrest-library.jar}"
src="${hamcrest-library.jar.url}"/>
</target>
<target name="fetch-depends" unless="skip.java.build">
<fetch dep="jdt.jdi.jar"/>
<fetch dep="jdt.jdimodel.jar"/>
<fetch dep="icu"/>
<fetch dep="ecj.jar"/>
<mkdir dir="${bcel.dir}" />
<download-one-file dest="${bcel.jar}"
src="${bcel.url}" md5="${bcel.md5}"/>
<fetch dep="junit.jar"/>
<fetch dep="hamcrest-library.jar"/>
</target>
<target name="build" unless="skip.java.build"
depends="check-depends,-build-jar,-copy-jars,-test-jar" />
<target name="test" depends="-test-module">
<fail message="Some tests failed">
<condition>
<or>
<isset property="test.failures" />
<isset property="test.errors" />
</or>
</condition>
</fail>
</target>
<!-- internal target for local and global test run sequence -->
<target name="-test-module" depends="build,-run-tests" />
<target name="clean" depends="-clean-java,-clean-test" />
<target name="-clean-java" unless="skip.java.build">
<echo message="Cleaning ${hy.module} classes" />
<delete file="${hy.jdk}/lib/tools.jar" />
<delete file="${hy.jdk}/lib/tools-src.jar" />
<delete dir="${hy.build.mod}/java" includeemptydirs="true"
failonerror="false" />
</target>
<target name="-clean-test" unless="skip.test.build">
<delete dir="${tests.hdk.dir}" failonerror="false" />
<delete failonerror="false" dir="${hy.build.mod}/test"/>
</target>
<target name="-compile-java" unless="skip.java.build">
<echo message="Compiling ${hy.module} classes" />
<ensure-javac/>
<mkdir dir="${hy.build.mod}/java" />
<hy.javac sourcepath=""
srcdir="src/main/java"
destdir="${hy.build.mod}/java">
<compilerarg line="${build.compilerarg}" />
<bootclasspath>
<fileset dir="${hy.jdk}/jre/lib/boot">
<include name="**/*.jar" />
</fileset>
<fileset dir="${hy.hdk}/lib">
<include name="**/*.jar" />
</fileset>
</bootclasspath>
<classpath>
<pathelement path="${jdt.jdi.jar}"/>
<pathelement path="${jdt.jdimodel.jar}"/>
<pathelement path="${ecj.jar}" />
<pathelement path="${ant.library.dir}/ant.jar" />
<pathelement path="${ant.library.dir}/ant-launcher.jar" />
<pathelement path="${ant.library.dir}/ant-nodeps.jar" />
</classpath>
<exclude name="org/apache/harmony/tools/appletviewer/**"
if="is.select"/>
<exclude name="org/apache/harmony/tools/rmi*/**" if="is.select"/>
<exclude name="org/apache/harmony/tools/serialver/**"
if="is.select"/>
</hy.javac>
</target>
<target name="findbugs" depends="-build-jar">
<run-findBugs
jarFile="${hy.jdk}/lib/tools.jar"
excludeFilter="make/findbugs-exclude-filter.xml"
outputFile="${findBugs.report}/${hy.module}.xml"/>
</target>
<target name="-build-jar" unless="skip.java.build"
depends="-svn-info,-compile-java">
<mkdir dir="${hy.jdk}/lib" />
<hy.jar.bin destfile="${hy.jdk}/lib/tools.jar"
manifest="META-INF/MANIFEST.MF">
<fileset dir="${hy.build.mod}/java" />
<fileset dir="src/main/java">
<exclude name="**/*.java" />
</fileset>
<zipfileset src="${jdt.jdi.jar}">
<exclude name="com/sun/jdi/Bootstrap.class"/>
<exclude name="META-INF/*"/>
</zipfileset>
</hy.jar.bin>
<hy.jar.src destfile="${hy.jdk}/lib/tools-src.jar">
<fileset dir="src/main/java" />
</hy.jar.src>
</target>
<target name="-copy-jars" unless="skip.java.build">
<mkdir dir="${hy.jdk}/lib" />
<copy todir="${hy.jdk}/lib" flatten="true">
<fileset file="${ecj.jar}"/>
</copy>
</target>
<target name="-test-jar" unless="skip.test.build"
depends="-svn-info,-compile-tests">
<mkdir dir="${tests.hdk.dir}" />
<copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
<copy todir= "${tests.hdk.dir}/resources">
<fileset dir = "src/test/resources" />
</copy>
<hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
<fileset dir="${hy.build.mod}/test/api" />
</hy.jar.bin>
<mkdir dir="${tests.excludes.hdk.dir}"/>
<copy todir="${tests.excludes.hdk.dir}">
<fileset dir="make" includes="exclude*"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="\.java" replace="\.class" flags="g"/>
</tokenfilter>
</filterchain>
</copy>
</target>
<target name="-compile-tests" unless="skip.test.build">
<compile-tests description="${hy.module} tests">
<javac-elements>
<src>
<pathelement location="src/test/java/common" />
<pathelement location="src/test/java/${hy.os.family}" />
</src>
<exclude name="org/apache/harmony/tests/tools/serialver/**"
if="is.select"/>
<classpath>
<pathelement path="${hy.jdk}/lib/tools.jar"/>
</classpath>
<!-- temporarely exclude one test that breaks compilation -->
<exclude name="**/javah/Test02.java"/>
</javac-elements>
</compile-tests>
</target>
<target name="-run-tests" depends="-test-jar">
<ant dir="${tests.hdk.dir}" target="test-module" />
</target>
</project>