Make jars build from a single ant .xml template

The ant build files for each of the jars that we create consisted of
only fairly straightforward boilerplate. With the recent changes to
java.gypi and java_aidl.gypi we can now build these correctly from a
single .xml with GYP passing in defines for the minor differences.

BUG=136756


Review URL: https://chromiumcodereview.appspot.com/10831227

git-svn-id: http://src.chromium.org/svn/trunk/src/build@151334 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
cjhopman@chromium.org 2012-08-13 20:17:24 +00:00
Родитель a0442c14f1
Коммит bfee8ceb05
2 изменённых файлов: 28 добавлений и 17 удалений

Просмотреть файл

@ -7,15 +7,27 @@
<!--
Common ant build file for for chromium_*.jars.
For creating a new chromium_*.jar :
1. Use build/java.gyp action. This action will set PACKAGE_NAME.
1. Use build/java.gypi action.
The jar will be created as chromium_${PACKAGE_NAME} in
${PRODUCT_DIR}/lib.java.
2. Set javac.custom.classpath to classpath to use for javac.
3. Override javac.srcdir for providing custom source directory for javac.
-->
<description>
Building ${PROJECT_NAME}/ java source code with ant.
</description>
<import file="common.xml"/>
<property-location name="src" location="src"/>
<path id="javac.custom.classpath">
<filelist dir="/" files="${INPUT_JARS_PATHS}"/>
<pathelement location="${ANDROID_SDK}/android.jar" />
</path>
<path id="javac.srcdirs.additional">
<filelist dir="/" files="${ADDITIONAL_SRC_DIRS}" />
</path>
<property-value name="javac.srcdir" value="src:${toString:javac.srcdirs.additional}"/>
<property-location name="lib.dir" location="${PRODUCT_DIR}/lib.java"
check-exists="false"/>
<property-location name="dest.dir" location="${PRODUCT_DIR}/java/${PACKAGE_NAME}"
@ -29,11 +41,6 @@
<mkdir dir="${dest.dir}"/>
</target>
<!--
Compile target for jars. Requires javac.custom.classpath to be set.
Optionally javac.srcdir can be overridden to custom path for src
directories.
-->
<target name="compile" depends="init" description="Compiles source." >
<fail message="Error: javac.custom.classpath is not set. Please set it to
classpath for javac.">
@ -41,13 +48,16 @@
<not><isreference refid="javac.custom.classpath"/></not>
</condition>
</fail>
<property-value name="javac.srcdir" value ="${src}"/>
<echo>Compiling ${javac.srcdir}, classpath: ${toString:javac.custom.classpath}</echo>
<javac srcdir="${javac.srcdir}" destdir="${dest.dir}" debug="true" includeantruntime="false">
<classpath>
<path refid="javac.custom.classpath" />
</classpath>
</javac>
<javac
srcdir="${javac.srcdir}"
destdir="${dest.dir}"
classpathref="javac.custom.classpath"
debug="true"
includeantruntime="false"
/>
</target>
<target name="dist" depends="compile"

Просмотреть файл

@ -44,7 +44,6 @@
'inputs': [
'android/ant/common.xml',
'android/ant/chromium-jars.xml',
'<(java_in_dir)/<(package_name).xml',
'<!@(find <(java_in_dir) -name "*.java")',
'>@(input_jars_paths)',
],
@ -55,14 +54,16 @@
'ant',
'-DPRODUCT_DIR=<(ant_build_out)',
'-DPACKAGE_NAME=<(package_name)',
'-DINPUT_JARS_PATHS=>(input_jars_paths)',
'-DADDITIONAL_SRC_DIRS=>(additional_src_dirs)',
'-DANDROID_SDK=<(android_sdk)',
'-DANDROID_SDK_ROOT=<(android_sdk_root)',
'-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
'-DANDROID_SDK_VERSION=<(android_sdk_version)',
'-DANDROID_TOOLCHAIN=<(android_toolchain)',
'-Dbasedir=<(java_in_dir)',
'-buildfile',
'<(java_in_dir)/<(package_name).xml',
'<(DEPTH)/build/android/ant/chromium-jars.xml'
]
},
],