blob: 38bf3d4bacc8cdd5d78d0662c730e1ec25f58fce [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
Licensed 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="jill" default="all"
xmlns:if="ant:if">
<description>
This buildfile is used to build all Jill projects and run tests. It depends on Jack's build.xml.
</description>
<import file="../jack/build.xml"/>
<target name="all" description="build all Jill projects" depends="jill,
jill-api,
jill-api-src,
jillunittests"/>
<target name="clean" depends="jill-clean,
jill-api-lib-clean,
jill-api-src-clean,
jillunittests-clean,
asm4-clean,
dist-clean"/>
<dirname property="jill-project.dir" file="${ant.file.jill}"/>
<property name="jill.dir" value="${jill-project.dir}/jill" />
<property name="jill-api.dir" value="${jill-project.dir}/jill-api" />
<property name="asm4.dir" value="${jill-project.dir}/asm4" />
<!-- ******************* -->
<!-- Distributed files -->
<!-- ******************* -->
<property name="jill-top-dist.dir" value="${jill-project.dir}/dist" />
<target name="dist-clean">
<delete dir="${jill-top-dist.dir}"/>
</target>
<target name="dist" description="package a Jill distribution" depends="
dist-check,
jill,
jill-api,
jill-api-src">
<mkdir dir="${jill-top-dist.dir}"/>
<copy todir="${jill-top-dist.dir}" flatten="true">
<filelist dir="/" >
<file name="${jill.dist.dir}/${jill.execname}" />
<file name="${jill-api.dist.dir}/${jill-api.name}" />
<file name="${jill-api.dist.dir}/${jill-api-src.name}" />
</filelist>
</copy>
<mkdir dir="${jill-top-dist.dir}/tmp"/>
<copy file="${jill-project.dir}/version.properties" tofile="${jill-top-dist.dir}/tmp/version.properties"/>
<propertyfile file="${jill-top-dist.dir}/tmp/version.properties">
<entry if:set="dist.sha" key="version.sha" value="${dist.sha}"/>
<entry if:set="dist.build-id" key="version.buildid" value="${dist.build-id}"/>
</propertyfile>
<copy file="${jill-top-dist.dir}/tmp/version.properties" tofile="${jill-top-dist.dir}/tmp/jill-version.properties"/>
<jar destfile="${jill-top-dist.dir}/${jill.execname}" update="true"
basedir="${jill-top-dist.dir}/tmp"
includes="jill-version.properties"/>
<copy file="${jill-top-dist.dir}/tmp/version.properties" tofile="${jill-top-dist.dir}/tmp/jill-api-version.properties"/>
<jar destfile="${jill-top-dist.dir}/${jill-api.name}" update="true"
basedir="${jill-top-dist.dir}/tmp"
includes="jill-api-version.properties"/>
<delete dir="${jill-top-dist.dir}/tmp"/>
</target>
<!-- ******************* -->
<!-- jill -->
<!-- ******************* -->
<property name="jill.build.dir" value="${jill.dir}/build/jill" />
<property name="jill.libs.dir" value="${jill.dir}/libs" />
<property name="jill.build.outdir" value="${jill.build.dir}/classes" />
<property name="jill.dist.dir" value="${jill.dir}/dist" />
<property name="jill.execname" value="jill.jar" />
<target name="jill-clean">
<delete dir="${jill.build.dir}" />
<delete dir="${jill.dist.dir}" />
<delete dir="${jill.libs.dir}" />
</target>
<target name="jill-copy-libs" depends="jill-api-lib,sched-lib,guava-lib,asm4-lib,args4j-lib,jsr305-lib,
dexcomparator-lib">
<copy todir="${jill.libs.dir}" flatten="true">
<filelist id="jill.libs.filelist" dir="/" >
<file name="${jill-api.dist.dir}/${jill-api.lib.name}"/>
<file name="${schedlib.dist.dir}/${schedlib.libname}"/>
<file name="${guava.dist.dir}/${guava.libname}"/>
<file name="${args4j.dist.dir}/${args4j.libname}"/>
<file name="${jsr305.dist.dir}/${jsr305.libname}"/>
<file name="${asm4.dist.dir}/${asm4.libname}"/>
<file name="${dexcomparator.dist.dir}/${dexcomparator.libname}"/>
</filelist>
</copy>
</target>
<target name="jill-check">
<union id ="jill.uptodate.files">
<filelist refid="jill.libs.filelist" />
</union>
<uptodate property="jill.uptodate" targetfile="${jill.dist.dir}/${jill.execname}">
<srcfiles dir="${jill.dir}/src" />
<srcresources refid="jill.uptodate.files" />
<srcfiles dir="${jill.dir}/rsc"/>
</uptodate>
</target>
<target name="jill" depends="jill-copy-libs, jill-check" unless="jill.uptodate">
<!-- project layout -->
<delete dir="${jill.build.outdir}"/>
<mkdir dir="${jill.build.outdir}"/>
<mkdir dir="${jill.dist.dir}"/>
<!-- compile -->
<javac encoding="UTF-8" srcdir="${jill.dir}/src"
destdir="${jill.build.outdir}"
source="1.5" target="1.5"
debug="true" includeantruntime="false">
<classpath>
<filelist refid="jill.libs.filelist" />
</classpath>
</javac>
<!-- package -->
<copy todir="${jill.build.outdir}">
<fileset dir="${jill.dir}/rsc">
<include name="**/*" />
</fileset>
<fileset dir="${jill-api.lib.build.outdir}">
<include name="**/*" />
</fileset>
<fileset dir="${schedlib.build.outdir}">
<include name="**/*" />
</fileset>
<fileset dir="${args4j.build.outdir}">
<include name="**/*" />
</fileset>
<fileset dir="${jsr305.build.outdir}">
<include name="**/*" />
</fileset>
<fileset dir="${asm4.build.outdir}">
<include name="**/*" />
</fileset>
</copy>
<unzip dest="${jill.build.outdir}" src="${guava.dist.dir}/${guava.libname}">
<patternset excludes="META-INF/**"/>
</unzip>
<copy file="${jill-project.dir}/version.properties"
tofile="${jill.build.outdir}/jill-version.properties"/>
<jar destfile="${jill.dist.dir}/${jill.execname}"
manifest="${jill.dir}/etc/manifest.txt"
basedir="${jill.build.outdir}"
includes="**"/>
</target>
<!-- ******************* -->
<!-- jill-api-lib -->
<!-- ******************* -->
<property name="jill-api.lib.build.dir" value="${jill-api.dir}/build/lib" />
<property name="jill-api.lib.build.outdir" value="${jill-api.lib.build.dir}/classes" />
<property name="jill-api.libs.dir" value="${jill-api.dir}/libs" />
<property name="jill-api.dist.dir" value="${jill-api.dir}/dist" />
<property name="jill-api.lib.name" value="jill-api-lib.jar" />
<target name="jill-api-lib-clean">
<delete dir="${jill-api.lib.build.dir}"/>
<delete dir="${jill-api.dist.dir}"/>
<delete dir="${jill-api.libs.dir}"/>
</target>
<target name="jill-api-lib-copy-libs" depends="jsr305-lib">
<copy todir="${jill-api.libs.dir}" flatten="true">
<filelist dir="/" >
<file name="${jsr305.dist.dir}/${jsr305.libname}"/>
</filelist>
</copy>
</target>
<target name="jill-api-check">
<uptodate property="jill-api.uptodate" targetfile="${jill-api.dist.dir}/${jill-api.lib.name}">
<srcfiles dir="${jill-api.dir}/src" />
<srcfiles file="${jsr305.dist.dir}/${jsr305.libname}" />
</uptodate>
</target>
<target name="jill-api-lib" depends="jill-api-lib-copy-libs, jill-api-check" unless="jill-api.uptodate">
<delete dir="${jill-api.lib.build.outdir}"/>
<mkdir dir="${jill-api.lib.build.outdir}"/>
<javac encoding="UTF-8" srcdir="${jill-api.dir}/src" destdir="${jill-api.lib.build.outdir}"
source="1.6" target="1.6" debug="true"
includeantruntime="false" includeDestClasses="false" nowarn="true">
<classpath>
<filelist dir="/" files="${jsr305.dist.dir}/${jsr305.libname}" />
</classpath>
<exclude name="com/android/jack/api/example/**"/>
</javac>
<jar destfile="${jill-api.dist.dir}/${jill-api.lib.name}">
<fileset dir="${jill-api.lib.build.outdir}"/>
</jar>
</target>
<!-- ******************* -->
<!-- jill-api -->
<!-- ******************* -->
<property name="jill-api.build.dir" value="${jill-api.dir}/build/exec" />
<property name="jill-api.build.outdir" value="${jill-api.build.dir}/classes" />
<property name="jill-api.name" value="jill-api.jar" />
<target name="jill-api" depends="jill-api-lib">
<copy file="${jill-project.dir}/version.properties"
tofile="${jill-api.lib.build.outdir}/jill-api-version.properties"/>
<jar destfile="${jill-api.dist.dir}/${jill-api.name}">
<fileset dir="${jsr305.build.outdir}"/>
<fileset dir="${jill-api.lib.build.outdir}"/>
</jar>
</target>
<!-- ******************* -->
<!-- jill-api-src -->
<!-- ******************* -->
<property name="jill-api-src.name" value="jill-api-src.zip" />
<target name="jill-api-src-clean">
<delete dir="${jill-api.dist.dir}/${jill-api-src.name}"/>
</target>
<target name="jill-api-src">
<zip destfile="${jill-api.dist.dir}/${jill-api-src.name}"
basedir="${jill-api.dir}/src" />
</target>
<!-- ******************* -->
<!-- jillunittests -->
<!-- ******************* -->
<property name="jillunittests.build.dir" value="${jill.dir}/build/jillunittests" />
<property name="jillunittests.build.outdir" value="${jillunittests.build.dir}/classes" />
<property name="jillunittests.execname" value="jillunittests.jar" />
<target name="jillunittests-clean">
<delete dir="${jillunittests.build.dir}" />
<delete dir="${jill.dist.dir}/${jillunittests.execname}" />
</target>
<target name="jillunittests-check">
<uptodate property="jillunittests.uptodate" targetfile="${jill.dist.dir}/${jillunittests.execname}">
<srcfiles dir="${jill.dir}/tests" />
<srcfiles file="${jill.dist.dir}/${jill.execname}" />
<srcfiles file="${jill-api.dist.dir}/${jill-api.name}" />
<srcfiles file="${jackunittests.dist.dir}/${jackunittests.execname}" />
<srcfiles file="${jack-tests.dist.dir}/${jack-tests.execname}" />
</uptodate>
</target>
<target name="jillunittests" depends="jill, jill-api, jackunittests, jack-tests, jillunittests-check" unless="jillunittests.uptodate">
<!-- project layout -->
<delete dir="${jillunittests.build.outdir}"/>
<mkdir dir="${jillunittests.build.outdir}"/>
<!-- compile -->
<javac encoding="UTF-8" srcdir="${jill.dir}/tests"
destdir="${jillunittests.build.outdir}"
source="1.5" target="1.5"
debug="true" includeantruntime="false">
<classpath>
<filelist dir="/">
<file name="${jill.dist.dir}/${jill.execname}" />
<file name="${jill-api.dist.dir}/${jill-api.name}" />
<file name="${jackunittests.dist.dir}/${jackunittests.execname}" />
<file name="${jack-tests.dist.dir}/${jack-tests.execname}" />
</filelist>
</classpath>
</javac>
<!-- package -->
<copy todir="${jillunittests.build.outdir}">
<fileset dir="${jill.build.outdir}">
<include name="**/*" />
</fileset>
<fileset dir="${jackunittests.build.outdir}">
<include name="**/*" />
</fileset>
</copy>
<jar destfile="${jill.dist.dir}/${jillunittests.execname}"
basedir="${jillunittests.build.outdir}"
includes="**"/>
</target>
<!-- ******************* -->
<!-- asm4 -->
<!-- ******************* -->
<property name="asm4.build.dir" value="${asm4.dir}/build" />
<property name="asm4.build.outdir" value="${asm4.build.dir}/classes" />
<property name="asm4.dist.dir" value="${asm4.dir}/dist" />
<property name="asm4.libname" value="asm4-lib.jar" />
<target name="asm4-clean">
<delete dir="${asm4.build.dir}" />
<delete dir="${asm4.dist.dir}" />
</target>
<target name="asm4-lib">
<!-- project layout -->
<mkdir dir="${asm4.build.outdir}"/>
<mkdir dir="${asm4.dist.dir}"/>
<!-- compile -->
<dependset>
<sources>
<fileset dir="${asm4.dir}/src" />
</sources>
<targets>
<fileset file="${asm4.dist.dir}/${asm4.libname}"/>
</targets>
</dependset>
<javac encoding="UTF-8" srcdir="${asm4.dir}/src"
destdir="${asm4.build.outdir}"
source="1.5" target="1.5"
debug="true" includeantruntime="false"/>
<!-- package -->
<jar destfile="${asm4.dist.dir}/${asm4.libname}"
basedir="${asm4.build.outdir}"
includes="**"/>
</target>
<!-- ******************* -->
<!-- tests -->
<!-- ******************* -->
<property name="jill.tests.output" value="${jill-project.dir}/tests-results"/>
<filelist id="jill.junit.tests.classpath" dir="/">
<file name="${jack-tests.dist.dir}/${jack-tests.execname}" />
<file name="${jill.dist.dir}/${jillunittests.execname}" />
<file name="${jill-api.dist.dir}/${jill-api.lib.name}" />
</filelist>
<target name="test-jill-clean" >
<delete dir="${jill.tests.output}"/>
</target>
<target name="test-jill" description="run Jill tests that must pass before submitting a change"
depends="tests-check-config, jillunittests">
<mkdir dir="${jill.tests.output}/test-jill/html"/>
<junit fork="yes" failureproperty="test-jill.failure">
<formatter type="xml"/>
<jvmarg value="-Dtests.config=${tests.config}"/>
<jvmarg value="-ea"/>
<classpath>
<filelist refid="jill.junit.tests.classpath" />
</classpath>
<test name="com.android.jill.PreSubmitTests"
todir="${jill.tests.output}/test-jill/"
outfile="test-jill" />
</junit>
<junitreport todir="${jill.tests.output}/test-jill">
<fileset dir="${jill.tests.output}/test-jill">
<include name="test-jill.xml"/>
</fileset>
<report format="frames" todir="${jill.tests.output}/test-jill/html"/>
</junitreport>
<fail message="TESTS FAILED" if="test-jill.failure" />
</target>
<target name="test-jill-long" description="run long lasting Jill tests"
depends="tests-check-config, jillunittests">
<mkdir dir="${jill.tests.output}/test-jill-long/html"/>
<junit fork="yes" failureproperty="test-jill.failure">
<formatter type="xml"/>
<jvmarg value="-Dtests.config=${tests.config}"/>
<jvmarg value="-ea"/>
<classpath>
<filelist refid="jill.junit.tests.classpath" />
</classpath>
<test name="com.android.jill.LongLastingTests"
todir="${jill.tests.output}/test-jill-long/"
outfile="test-jill-long" />
</junit>
<junitreport todir="${jill.tests.output}/test-jill-long">
<fileset dir="${jill.tests.output}/test-jill-long">
<include name="test-jill-long.xml"/>
</fileset>
<report format="frames" todir="${jill.tests.output}/test-jill-long/html"/>
</junitreport>
<fail message="TESTS FAILED" if="test-jill.failure" />
</target>
<target name="test-jill-all" description="runs all Jill tests"
depends="tests-check-config, jillunittests">
<mkdir dir="${jill.tests.output}/test-jill-all/html"/>
<junit fork="yes" failureproperty="test-jill.failure">
<formatter type="xml"/>
<jvmarg value="-Dtests.config=${tests.config}"/>
<jvmarg value="-ea"/>
<classpath>
<filelist refid="jill.junit.tests.classpath" />
</classpath>
<test name="com.android.jill.AllTests"
todir="${jill.tests.output}/test-jill-all/"
outfile="test-jill-all" />
</junit>
<junitreport todir="${jill.tests.output}/test-jill-all">
<fileset dir="${jill.tests.output}/test-jill-all">
<include name="test-jill-all.xml"/>
</fileset>
<report format="frames" todir="${jill.tests.output}/test-jill-all/html"/>
</junitreport>
<fail message="TESTS FAILED" if="test-jill.failure" />
</target>
</project>