[Android] Add chrome_java target for building Java code in the chromium layer.

Also includes a refactoring of the Ant xml scripts to use a common template (contributed by shashishekhar@chromium.org). As part of this, I also continued Torne's effort of removing our reliance on environment variables. Unfortunately this currently means that you have to specify 5 gyp flags:
    ANDROID_SDK, ANDROID_SDK_ROOT, ANDROID_SDK_TOOLS, ANDROID_SDK_VERSION, ANDROID_TOOLCHAIN.

This'll get better as we make further use of the checked in sdk both upstream and downstream. The problem stems from the android tree and released sdk having different configurations.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150172 0039d316-1c4b-4281-b951-d872f2087c98
parent 4f3db5b5
<!--
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="Base" default="dist" basedir=".">
<description>
building base java source code with ant
</description>
<!-- Set global properties for this build -->
<property name="src" location="src"/>
<property name="dist" location="dist"/>
<property name="out.dir" location="${PRODUCT_DIR}/lib.java"/>
<!-- TODO(jrg): establish a standard for the intermediate java
directories. Settle on a standard once ant/jar build files
like this are androidified -->
<property name="dest.dir" location="${PRODUCT_DIR}/java/base"/>
<import file="../../../build/android/ant/chromium-jars.xml" />
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${out.dir}"/>
<mkdir dir="${dest.dir}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<!-- TODO(jrg): adapting this to a proper android antfile will
remove warnings like this:
base.xml:23: warning: 'includeantruntime' was not set,
defaulting to build.sysclasspath=last;
set to false for repeatable builds
-->
<javac srcdir="${src}" destdir="${dest.dir}" debug="true" includeantruntime="false">
<classpath>
<path location="${ANDROID_SDK}/android.jar"/>
</classpath>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${out.dir}"/>
<jar jarfile="${out.dir}/chromium_base.jar" basedir="${dest.dir}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the appropriate directory trees -->
<delete dir="${dest.dir}"/>
<delete dir="${dist}"/>
</target>
<path id="javac.custom.classpath">
<pathelement location="${ANDROID_SDK}/android.jar" />
</path>
</project>
<!--
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>
<?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>
<?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>
......@@ -45,9 +45,20 @@
'<(PRODUCT_DIR)/<(test_suite_name)_apk',
'--app_abi',
'<(android_app_abi)',
'--sdk-build=<(sdk_build)',
'--ant-args',
'-DPRODUCT_DIR=<(ant_build_out)',
'--sdk-build=<(sdk_build)',
'--ant-args',
'-DANDROID_SDK=<(android_sdk)',
'--ant-args',
'-DANDROID_SDK_ROOT=<(android_sdk_root)',
'--ant-args',
'-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
'--ant-args',
'-DANDROID_SDK_VERSION=<(android_sdk_version)',
'--ant-args',
'-DANDROID_TOOLCHAIN=<(android_toolchain)',
'--ant-compile'
],
}],
}], # 'OS == "android" and gtest_target_type == "shared_library"
......
......@@ -47,6 +47,10 @@
'-DPRODUCT_DIR=<(ant_build_out)',
'-DPACKAGE_NAME=<(package_name)',
'-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)',
'-buildfile',
'<(java_in_dir)/<(package_name).xml',
]
......
<!--
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" default="dist" basedir=".">
<description>
Building chrome.jar from java source code.
</description>
<import file="../../../build/android/ant/chromium-jars.xml" />
<path id="javac.custom.classpath">
<pathelement location="${ANDROID_SDK}/android.jar" />
<pathelement location="${lib.dir}/chromium_content.jar" />
<pathelement location="${lib.dir}/chromium_base.jar" />
<pathelement location="${lib.dir}/chromium_net.jar" />
</path>
<!-- Override javac path to include jars in lib.java directory -->
<property-value name="javac.srcdir" value="${src}" />
</project>
......@@ -61,7 +61,7 @@ public abstract class IntentHelper {
send.putExtra(Intent.EXTRA_SUBJECT, subject);
send.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body));
try {
Intent chooser = Intent.createChooser(send, chooserTitle));
Intent chooser = Intent.createChooser(send, chooserTitle);
// we start this activity outside the main activity.
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(chooser);
......
......@@ -1073,5 +1073,24 @@
},
]}, # 'targets'
], # OS=="win"
['OS=="android"',
{
'targets': [
{
'target_name': 'chrome_java',
'type': 'none',
'dependencies': [
'../base/base.gyp:base_java',
'../content/content.gyp:content_java',
'../net/net.gyp:net_java',
],
'variables': {
'package_name': 'chrome',
'java_in_dir': '../chrome/android/java',
},
'includes': [ '../build/java.gypi' ],
},
]}, # 'targets'
], # OS=="android"
], # 'conditions'
}
......@@ -4591,6 +4591,7 @@
'dependencies': [
'../base/base.gyp:base_java',
'../net/net.gyp:net_java',
'chrome_java',
'unit_tests',
],
'variables': {
......
......@@ -647,6 +647,11 @@
'ant',
'-DPRODUCT_DIR=<(ant_build_out)',
'-DAPP_ABI=<(android_app_abi)',
'-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)',
'-buildfile',
'shell/android/java/content_shell_apk.xml',
# '<(CONFIGURATION_NAME)',
......
......@@ -824,6 +824,11 @@
'ant',
'-DPRODUCT_DIR=<(ant_build_out)',
'-DAPP_ABI=<(android_app_abi)',
'-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)',
'-buildfile',
'<(DEPTH)/content/shell/android/javatests/content_shell_test_apk.xml',
]
......
<!-- 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.
<!--
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="Content" default="dist" basedir=".">
<description>
building content java source code with ant
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="out.dir" location="${PRODUCT_DIR}/lib.java"/>
<property name="classes.dir" location="${PRODUCT_DIR}/java/${PACKAGE_NAME}"/>
<property name="jar.dir" location="${out.dir}"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${out.dir}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Create the classes output directory -->
<mkdir dir="${classes.dir}"/>
<!-- Compile the java code from ${src} into ${classes.dir} -->
<!-- Gyp target should have compiled aidl files into java source files in
lib.jar (see content.gyp:common_aidl). -->
<javac srcdir="${src}:${out.dir}" destdir="${classes.dir}" debug="true" includeantruntime="false">
<classpath>
<pathelement path="${ANDROID_SDK}/android.jar" />
<pathelement path="${jar.dir}/chromium_base.jar" />
<pathelement path="${jar.dir}/chromium_net.jar" />
</classpath>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${jar.dir}"/>
<!-- Put everything in ${classes.dir} into the chromium_content.jar file -->
<jar jarfile="${jar.dir}/chromium_${PACKAGE_NAME}.jar" basedir="${classes.dir}"/>
</target>
<import file="../../../../build/android/ant/chromium-jars.xml" />
<target name="clean" description="clean up" >
<!-- Delete the generated content -->
<delete dir="${classes.dir}"/>
<delete file="${jar.dir}/chromium_${PACKAGE_NAME}.jar"/>
</target>
<path id="javac.custom.classpath">
<pathelement location="${ANDROID_SDK}/android.jar" />
<pathelement location="${lib.dir}/chromium_base.jar" />
<pathelement location="${lib.dir}/chromium_net.jar" />
</path>
<!-- Override javac path to include jars in lib.java directory -->
<property-value name="javac.srcdir" value="${src}:${lib.dir}" />
</project>
......@@ -5,25 +5,22 @@
found in the LICENSE file.
-->
<project name="ContentShell" default="debug" basedir=".">
<description>
Building ContentShell.apk
</description>
<property environment="env"/>
<property name="sdk.dir" location="${env.ANDROID_SDK_ROOT}"/>
<property name="toolchain.dir" location="${env.ANDROID_TOOLCHAIN}"/>
<property name="source.dir" location="src"/>
<property name="target" value="android-${env.ANDROID_SDK_VERSION}"/>
<property name="target.abi" value="${APP_ABI}"/>
<property name="out.dir" location="${PRODUCT_DIR}/content_shell"/>
<import file="../../../../build/android/ant/common.xml"/>
<import file="../../../../build/android/ant/sdk-targets.xml"/>
<property-value name="target.abi" value="${APP_ABI}"/>
<property-location name="out.dir" location="${PRODUCT_DIR}/content_shell"
check-exists="false"/>
<property name="resource.absolute.dir" value="../res"/>
<property name="gen.absolute.dir" value="${out.dir}/gen"/>
<property name="jar.libs.dir" value="${out.dir}/java/libs"/>
<path id="native.libs.gdbserver">
<fileset file="${toolchain.dir}/../../gdbserver"/>
</path>
<property name="native.libs.absolute.dir" location="${out.dir}/libs" />
<property name="asset.absolute.dir" location="${out.dir}/assets" />
<property name="native.libs.absolute.dir" location="${out.dir}/libs"/>
<property name="asset.absolute.dir" location="${out.dir}/assets"/>
<path id="out.dex.jar.input.ref">
<fileset file="${out.dir}/java/libs/chromium_content.jar"/>
......@@ -33,8 +30,7 @@
</path>
<property name="java.compilerargs" value="-classpath ${toString:out.dex.jar.input.ref}"/>
<!-- We expect PRODUCT_DIR to be set like the gyp var
(e.g. $ROOT/out/Debug) -->
<!-- We expect PRODUCT_DIR to be set like the gyp var (e.g. $ROOT/out/Debug) -->
<fail message="PRODUCT_DIR env var not set?">
<condition>
<not>
......@@ -44,17 +40,19 @@
</fail>
<target name="-post-compile">
<!-- copy gdbserver to main libs directory if building debug.
<!--
Copy gdbserver to main libs directory if building debug.
TODO(jrg): for now, Chrome on Android always builds native code
as Release and java/ant as Debug, which means we always install
gdbserver. Resolve this discrepancy, possibly by making this
Release Official build java/ant as Release. -->
Release Official build java/ant as Release.
-->
<if>
<condition>
<equals arg1="${build.target}" arg2="debug" />
<equals arg1="${build.target}" arg2="debug"/>
</condition>
<then>
<echo message="Copying gdbserver to the apk to enable native debugging"/>
<echo message="Copying gdbserver to the apk to enable native debugging" />
<copy todir="${out.dir}/libs/${target.abi}">
<path refid="native.libs.gdbserver"/>
</copy>
......@@ -62,6 +60,9 @@
</if>
</target>
<import file="${sdk.dir}/tools/ant/build.xml" />
<!-- Classpath for javac -->
<path id="javac.custom.classpath">
<path refid="out.dex.jar.input.ref"/>
</path>
<import file="${sdk.dir}/tools/ant/build.xml"/>
</project>
......@@ -10,11 +10,8 @@
Building ContentShellTest.apk
</description>
<property environment="env"/>
<property name="sdk.dir" location="${env.ANDROID_SDK_ROOT}"/>
<property name="toolchain.dir" location="${env.ANDROID_TOOLCHAIN}"/>
<property name="source.dir" location="src"/>
<property name="target" value="android-${env.ANDROID_SDK_VERSION}"/>
<import file="../../../../build/android/ant/common.xml"/>
<import file="../../../../build/android/ant/sdk-targets.xml"/>
<property name="target.abi" value="${APP_ABI}"/>
<property name="out.dir" location="${PRODUCT_DIR}/content_shell_test"/>
<property name="resource.absolute.dir" value="../res"/>
......@@ -71,6 +68,10 @@
</target>
<!-- Classpath for javac -->
<path id="javac.custom.classpath">
<path refid="out.dex.jar.input.ref"/>
</path>
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>
<!-- 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.
<!--
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="Media" default="dist" basedir=".">
<description>
building media java source code with ant
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="out.dir" location="${PRODUCT_DIR}/lib.java"/>
<property name="dest.dir" location="${PRODUCT_DIR}/java/media"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${out.dir}"/>
<mkdir dir="${dest.dir}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${dest.dir} -->
<javac srcdir="${src}" destdir="${dest.dir}" debug="true" includeantruntime="false">
<classpath>
<pathelement path="${ANDROID_SDK}/android.jar" />
<pathelement path="${out.dir}/chromium_base.jar" />
</classpath>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${out.dir}"/>
<!-- Put everything in ${build} into the chromium_media.jar file -->
<jar jarfile="${out.dir}/chromium_media.jar" basedir="${dest.dir}"/>
</target>
<import file="../../../../build/android/ant/chromium-jars.xml"/>
<target name="clean"
description="clean up" >
<!-- Delete the appropriate directory trees -->
<delete dir="${dest.dir}"/>
<delete dir="${dist}"/>
</target>
<path id="javac.custom.classpath">
<pathelement location="${ANDROID_SDK}/android.jar"/>
<pathelement location="${lib.dir}/chromium_base.jar"/>
</path>
</project>
<!--
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="net" default="dist" basedir=".">
<description>
Building net/ java source code with ant.
</description>
<!-- Set global properties for this build -->
<property name="src" location="src"/>
<property name="dist" location="dist"/>
<property name="out.dir" location="${PRODUCT_DIR}/lib.java"/>
<!-- TODO(jrg): establish a standard for the intermediate java
directories. Settle on a standard once ant/jar build files
like this are androidified -->
<property name="dest.dir" location="${PRODUCT_DIR}/java/net"/>
<import file="../../../build/android/ant/chromium-jars.xml"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${out.dir}"/>
<mkdir dir="${dest.dir}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<javac srcdir="${src}" destdir="${dest.dir}" debug="true" includeantruntime="false">
<classpath>
<path location="${ANDROID_SDK}/android.jar"/>
<path location="${out.dir}/chromium_base.jar"/>
</classpath>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<jar jarfile="${out.dir}/chromium_net.jar" basedir="${dest.dir}"/>
</target>
<target name="clean"
description="clean up" >
<delete dir="${dest.dir}"/>
<delete dir="${dist}"/>
</target>
<path id="javac.custom.classpath">
<pathelement location="${ANDROID_SDK}/android.jar"/>
<pathelement location="${lib.dir}/chromium_base.jar"/>
</path>
</project>
......@@ -145,7 +145,7 @@ class NativeTestApkGenerator(object):
"""
cmd = ['ant']
if ant_args:
cmd.append(ant_args)
cmd.extend(ant_args)
cmd.append("-DAPP_ABI=" + self._target_abi)
cmd.extend(['-buildfile',
os.path.join(self._output_directory, 'native_test_apk.xml')])
......@@ -189,7 +189,7 @@ def main(argv):
help=('If specified, build the generated apk with ant. '
'Otherwise assume compiling within the Android '
'source tree using Android.mk.'))
parser.add_option('--ant-args',
parser.add_option('--ant-args', action='append',
help='extra args for ant')
options, _ = parser.parse_args(argv)
......
......@@ -39,6 +39,11 @@
'action': [
'ant',
'-DPRODUCT_DIR=<(ant_build_out)',
'-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)',
'-buildfile',
'<(DEPTH)/testing/android/native_test_apk.xml',
]
......
......@@ -11,25 +11,25 @@ found in the LICENSE file.
Building native test runner ChromeNativeTests_replaceme.apk
</description>
<property environment="env"/>
<property name="sdk.dir" location="${env.ANDROID_SDK_ROOT}"/>
<property name="sdk.version" value="${env.ANDROID_SDK_VERSION}"/>
<property name="toolchain.dir" location="${env.ANDROID_TOOLCHAIN}"/>
<property name="src" location="."/>
<property name="source.dir" location="java/src"/>
<!--
TODO(yfriedman): This target can be invoked from multiple depths. So we use ${PRODUCT_DIR} to normalize the paths. This could be cleaned up.
-->
<import file="${PRODUCT_DIR}/../../build/android/ant/common.xml"/>
<import file="${PRODUCT_DIR}/../../build/android/ant/sdk-targets.xml"/>
<!--
TODO(yfriedman): Remove the need to specify this. We should generate the packages in a way such
that it's not required.
-->
<property name="source.absolute.dir" value="java/src"/>
<path id="javac.custom.classpath">
<pathelement location="${ANDROID_SDK}/android.jar" />
</path>
<property name="target.abi" value="${APP_ABI}"/>
<property name="target" value="android-${env.ANDROID_SDK_VERSION}"/>
<path id="native.libs.gdbserver">
<fileset file="${toolchain.dir}/../../gdbserver"/>
</path>
<condition property="location.base"
value="${sdk.dir}"
else="${sdk.dir}/platforms/android-${sdk.version}">
<isset property="env.ANDROID_BUILD_TOP"/>
</condition>
<!-- We expect PRODUCT_DIR to be set like the gyp var
(e.g. $ROOT/out/Debug) -->
<fail message="PRODUCT_DIR env var not set?">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment