blob: d13c9272e73a8b8e48ce3840b8b0608b80b6d53f [file] [log] [blame]
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<project name="chromium-jars" default="dist">
<!--
Common ant build file for for chromium_*.jars.
For creating a new chromium_*.jar :
1. Use build/java.gypi action.
The jar will be created as chromium_${PACKAGE_NAME} in
${PRODUCT_DIR}/lib.java.
-->
<description>
Building ${PROJECT_NAME}/ java source code with ant.
</description>
<import file="common.xml"/>
<path id="javac.custom.classpath">
<filelist files="${INPUT_JARS_PATHS}"/>
<pathelement location="${ANDROID_SDK}/android.jar"/>
</path>
<path id="javac.srcdirs.additional">
<filelist files="${ADDITIONAL_SRC_DIRS}"/>
<filelist files="${GENERATED_SRC_DIRS}"/>
</path>
<property-value
name="javac.srcdir"
value="src:${toString:javac.srcdirs.additional}"
/>
<property-location
name="dest.dir"
location="${PRODUCT_DIR}/java/${PACKAGE_NAME}"
check-exists="false"
/>
<condition property="javac_includes_message"
value=""
else="Include filter: ${JAVAC_INCLUDES}">
<equals arg1="${JAVAC_INCLUDES}" arg2=""/>
</condition>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${dest.dir}"/>
<!-- Remove all .class files from dest.dir. This prevents inclusion of
incorrect .class files in the final .jar. For example, if a .java file
was deleted, the .jar should not contain the .class files for that
.java from previous builds.
-->
<delete>
<fileset dir="${dest.dir}" includes="**/*.class"/>
</delete>
</target>
<target name="compile" depends="init" description="Compiles source.">
<fail message="Error: javac.custom.classpath is not set. Please set it to
classpath for javac.">
<condition>
<not><isreference refid="javac.custom.classpath"/></not>
</condition>
</fail>
<echo>
Compiling ${javac.srcdir}, classpath: ${toString:javac.custom.classpath}
${javac_includes_message}
</echo>
<!-- __LB_SHELL__
Android SDK build toolchain doesn't support Java 1.7 so we force
the source and target versions to 1.6. Failure to do will result
in .class files that can't be parsed by the dexer.
-->
<javac
source="1.6"
target="1.6"
srcdir="${javac.srcdir}"
destdir="${dest.dir}"
classpathref="javac.custom.classpath"
debug="true"
includeantruntime="false"
includes="${JAVAC_INCLUDES}">
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target name="dist" depends="compile"
description="Generate chromium_${PACKAGE_NAME}.jar.">
<!-- Create the distribution directory. We exclude R.class and R$*.class
files since new versions of these files with the correct resource -> ID
mapping will be provided when we build each individual apk. -->
<jar
jarfile="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"
excludes="**/R.class **/R$*.class"
basedir="${dest.dir}"
/>
<!-- If Gyp thinks this output is stale but Ant doesn't, the modification
time should still be updated. Otherwise, this target will continue to
be rebuilt in future builds.
-->
<touch file="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"/>
</target>
<target name="clean" description="clean up">
<!-- Delete the appropriate directory trees -->
<delete dir="${dest.dir}"/>
</target>
</project>