diff options
Diffstat (limited to 'build/android/ant')
-rw-r--r-- | build/android/ant/chromium-jars.xml | 64 | ||||
-rw-r--r-- | build/android/ant/common.xml | 78 | ||||
-rw-r--r-- | build/android/ant/sdk-targets.xml | 97 |
3 files changed, 239 insertions, 0 deletions
diff --git a/build/android/ant/chromium-jars.xml b/build/android/ant/chromium-jars.xml new file mode 100644 index 0000000..dbe01ea --- /dev/null +++ b/build/android/ant/chromium-jars.xml @@ -0,0 +1,64 @@ +<!-- + 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.gyp action. This action will set PACKAGE_NAME. + 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. + --> + + <import file="common.xml"/> + <property-location name="src" location="src"/> + <property-location name="lib.dir" location="${PRODUCT_DIR}/lib.java" + check-exists="false"/> + <property-location name="dest.dir" location="${PRODUCT_DIR}/java/${PACKAGE_NAME}" + check-exists="false"/> + + <target name="init"> + <!-- Create the time stamp --> + <tstamp/> + <!-- Create the build directory structure used by compile --> + <mkdir dir="${lib.dir}"/> + <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."> + <condition> + <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> + </target> + + <target name="dist" depends="compile" + description="Generate chromium_${PACKAGE_NAME}.jar."> + <!-- Create the distribution directory --> + <mkdir dir="${lib.dir}" /> + <jar jarfile="${lib.dir}/chromium_${PACKAGE_NAME}.jar" basedir="${dest.dir}"/> + </target> + + <target name="clean" description="clean up"> + <!-- Delete the appropriate directory trees --> + <delete dir="${dest.dir}" /> + </target> +</project> diff --git a/build/android/ant/common.xml b/build/android/ant/common.xml new file mode 100644 index 0000000..c7c730b --- /dev/null +++ b/build/android/ant/common.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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="chrome_common_defines"> + <!-- Common build properties for Chrome for android. --> + + <!-- + Macro for checking that a property is correctly set. Performs checks for: + 1. Property is set and not null. + 2. String value of property does not contains any '$' signs. + --> + <macrodef name="check-property-value"> + <attribute name="property"/> + <sequential> + <fail message ="Property @{property} is not set."> + <condition> + <or> + <not><isset property="@{property}"/></not> + <length string="${@{property}}" trim="true" when="less" length="1"/> + </or> + </condition> + </fail> + <!-- + Check for $ signs. This catches errors when properties are initialized from environment + variables. E.g. if we have <property name="foo" value="${env.bar}" /> but env.bar is + not set then foo will have the literal value of '${env.bar}'. + --> + <fail message="Value checked failed for property: @{property} : ${@{property}}. + Property value contains an uninitialized environment variable."> + <condition> + <contains string="${@{property}}" substring="$"/> + </condition> + </fail> + </sequential> + </macrodef> + + <!-- + A safe setter for location properties. Checks that a location is not + empty and actually exists. For specifying output directories, location + check can be disabled by specifying check-exists="false". + --> + <macrodef name="property-location"> + <attribute name="name"/> + <attribute name="location"/> + <attribute name="check-exists" default="true"/> + <sequential> + <property name="@{name}" location="@{location}"/> + <check-property-value property="@{name}"/> + <fail message="Location specified for @{name} : @{location} does not exist."> + <condition> + <and> + <equals arg1="@{check-exists}" arg2="true"/> + <not><available type="dir" file="@{location}"/></not> + </and> + </condition> + </fail> + </sequential> + </macrodef> + + <!-- A safe setter for property values --> + <macrodef name="property-value"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="@{value}"/> + <check-property-value property="@{name}"/> + </sequential> + </macrodef> + + <!-- Common environment properties. --> + <property-location name="sdk.dir" location="${ANDROID_SDK_ROOT}"/> + <property-value name="target" value="android-${ANDROID_SDK_VERSION}"/> + <property name="source.dir" location="src"/> + <property-location name="toolchain.dir" location="${ANDROID_TOOLCHAIN}"/> +</project> diff --git a/build/android/ant/sdk-targets.xml b/build/android/ant/sdk-targets.xml new file mode 100644 index 0000000..8f980b4 --- /dev/null +++ b/build/android/ant/sdk-targets.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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="chrome_sdk_overrides" > + <!-- + Redefinition of targets used by SDK tools. + Supported version: SDK tools revision 20. + + SDK tools do not allow easy way of extending classpaths + for aidl and javac. This file defines targets which can be used to + override targets used by tools. + --> + + <!-- + Override the -compile target. + This target requires 'javac.custom.classpath' to be set to reference + of classpath to be used for javac. Also accepts custom path for + sources: 'javac.custom.sourcepath'. + --> + <target + name="-compile" + depends="-build-setup, -pre-build, -code-gen, -pre-compile"> + <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..." > + <!-- If souce path is not set, then use the default value --> + <if> + <condition> + <not> + <isreference refid="javac.custom.sourcepath"/> + </not> + </condition> + <then> + <path id="javac.custom.sourcepath"> + <pathelement path="${source.absolute.dir}"/> + <pathelement path="${gen.absolute.dir}"/> + </path> + </then> + </if> + <javac + bootclasspathref="project.target.class.path" + classpathref="javac.custom.classpath" + debug="true" + destdir="${out.classes.absolute.dir}" + encoding="${java.encoding}" + extdirs="" + fork="${need.javac.fork}" + includeantruntime="false" + source="${java.source}" + target="${java.target}" + verbose="${verbose}"> + <src path="${source.absolute.dir}"/> + <src path="${gen.absolute.dir}"/> + <src> + <path refid="javac.custom.sourcepath"/> + </src> + <compilerarg line="${java.compilerargs}"/> + </javac> + <!-- + If the project is instrumented, then instrument the classes + TODO(shashishekhar): Add option to override emma filter. + --> + <if condition="${build.is.instrumented}"> + <then> + <echo level="info"> + Instrumenting classes from ${out.absolute.dir}/classes... + </echo> + <!-- build the default filter to remove R, Manifest, BuildConfig --> + <getemmafilter + appPackage="${project.app.package}" + filterOut="emma.default.filter" + libraryPackagesRefId="project.library.packages"/> + <!-- + Define where the .em file is output. + This may have been setup already if this is a library. + --> + <property name="emma.coverage.absolute.file" + location="${out.absolute.dir}/coverage.em"/> + <!-- It only instruments class files, not any external libs --> + + <emma enabled="true"> + <instr + instrpath="${out.absolute.dir}/classes" + metadatafile="${emma.coverage.absolute.file}" + mode="overwrite" + outdir="${out.absolute.dir}/classes" + verbosity="${verbosity}"> + <filter excludes="${emma.default.filter}"/> + <filter value="${emma.filter}"/> + </instr> + </emma> + </then> + </if> + </do-only-if-manifest-hasCode> + </target> +</project> |