summaryrefslogtreecommitdiffstats
path: root/testing/android
diff options
context:
space:
mode:
authorcjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 02:32:23 +0000
committercjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 02:32:23 +0000
commit4afef6e27ecbcf6430c5d37881eca04c6b1f8d78 (patch)
tree29f825a11473ccd8fb96ccaec1faa2ea6f55a95c /testing/android
parent3c87ce67a3d75e184c14e1c9d3ff53b34f67659b (diff)
downloadchromium_src-4afef6e27ecbcf6430c5d37881eca04c6b1f8d78.zip
chromium_src-4afef6e27ecbcf6430c5d37881eca04c6b1f8d78.tar.gz
chromium_src-4afef6e27ecbcf6430c5d37881eca04c6b1f8d78.tar.bz2
Remove hardcoded chromium_*.jar paths
Targets with dependencies (direct/indirect) on a java target receive the chromium_*.jar paths in the variable input_jars_paths. Targets should use that rather than hardcoding where they think the jar will be. Change native_test_apk.xml to build with a list of jars in INPUT_JARS_PATHS rather than using all jars in a specific output directory. Make generate_native_test.py pass the --jars argument to ant with -DINPUT_JARS_PATHS. This supports those targets (WebKit) that are not updated to pass the ant-arg directly. BUG= Review URL: https://chromiumcodereview.appspot.com/11308351 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing/android')
-rwxr-xr-xtesting/android/generate_native_test.py26
-rw-r--r--testing/android/native_test.gyp10
-rw-r--r--testing/android/native_test_apk.xml9
3 files changed, 15 insertions, 30 deletions
diff --git a/testing/android/generate_native_test.py b/testing/android/generate_native_test.py
index 153403b..563112e 100755
--- a/testing/android/generate_native_test.py
+++ b/testing/android/generate_native_test.py
@@ -18,7 +18,6 @@ import logging
import optparse
import os
import re
-import shutil
import subprocess
import sys
@@ -52,10 +51,9 @@ class NativeTestApkGenerator(object):
'native_test_apk.xml',
'res/values/strings.xml']
- def __init__(self, native_library, jars, strip_binary, output_directory,
+ def __init__(self, native_library, strip_binary, output_directory,
target_abi):
self._native_library = native_library
- self._jars = jars
self._strip_binary = strip_binary
self._output_directory = os.path.abspath(output_directory)
self._target_abi = target_abi
@@ -110,8 +108,8 @@ class NativeTestApkGenerator(object):
dest = dest.replace('replaceme', self._root_name) # update the filename!
open(dest, 'w').write(contents)
- def _CopyLibraryAndJars(self):
- """Copy the shlib and jars into the apk source tree (if relevant)."""
+ def _CopyLibrary(self):
+ """Copy the shlib into the apk source tree (if relevant)."""
if self._native_library:
destdir = os.path.join(self._output_directory, 'libs/' + self._target_abi)
if not os.path.exists(destdir):
@@ -121,20 +119,12 @@ class NativeTestApkGenerator(object):
cmd_helper.RunCmd(
[self._strip_binary, '--strip-unneeded', self._native_library, '-o',
dest])
- if self._jars:
- destdir = os.path.join(self._output_directory, 'java/libs')
- if not os.path.exists(destdir):
- os.makedirs(destdir)
- for jar in self._jars:
- dest = os.path.join(destdir, os.path.basename(jar))
- logging.warn('%s --> %s', jar, dest)
- shutil.copyfile(jar, dest)
def CreateBundle(self):
"""Create the apk bundle source and assemble components."""
self._CopyTemplateFilesAndClearDir()
self._ReplaceStrings()
- self._CopyLibraryAndJars()
+ self._CopyLibrary()
def Compile(self, ant_args):
"""Build the generated apk with ant.
@@ -189,13 +179,17 @@ def main(argv):
if not options.strip_binary:
raise Exception('No tool for stripping the libraries has been supplied')
- # Remove all quotes from the jars string
+ # Remove all quotes from the jars string and pass the list to ant as
+ # INPUT_JARS_PATHS.
+ # TODO(cjhopman): Remove this when all targets pass the list of jars as an
+ # ant-arg directly.
jar_list = []
if options.jars:
jar_list = options.jars.replace('"', '').split()
+ options.ant_args.append('-DINPUT_JARS_PATHS=' + " ".join(jar_list))
+
ntag = NativeTestApkGenerator(native_library=options.native_library,
- jars=jar_list,
strip_binary=options.strip_binary,
output_directory=options.output,
target_abi=options.app_abi)
diff --git a/testing/android/native_test.gyp b/testing/android/native_test.gyp
index 3a9a7d5..80fe486 100644
--- a/testing/android/native_test.gyp
+++ b/testing/android/native_test.gyp
@@ -12,20 +12,15 @@
'type': 'none',
'dependencies': [
'native_test_native_code',
+ '<(DEPTH)/base/base.gyp:base_java',
],
'actions': [
{
- 'action_name': 'copy_base_jar',
- 'inputs': ['<(PRODUCT_DIR)/lib.java/chromium_base.jar'],
- 'outputs': ['<(PRODUCT_DIR)/replaceme_apk/java/libs/chromium_base.jar'],
- 'action': ['cp', '<@(_inputs)', '<@(_outputs)'],
- },
- {
'action_name': 'native_test_apk',
'inputs': [
'<(DEPTH)/testing/android/native_test_apk.xml',
'<!@(find <(DEPTH)/testing/android -name "*.java")',
- '<(PRODUCT_DIR)/replaceme_apk/java/libs/chromium_base.jar',
+ '>@(input_jars_paths)',
'native_test_launcher.cc'
],
'outputs': [
@@ -48,6 +43,7 @@
'-DANDROID_SDK_VERSION=<(android_sdk_version)',
'-DANDROID_GDBSERVER=<(android_gdbserver)',
'-DCHROMIUM_SRC=<(ant_build_out)/../..',
+ '-DINPUT_JARS_PATHS=>(input_jars_paths)',
'-buildfile',
'<(DEPTH)/testing/android/native_test_apk.xml',
]
diff --git a/testing/android/native_test_apk.xml b/testing/android/native_test_apk.xml
index 5e63cbc..545568d 100644
--- a/testing/android/native_test_apk.xml
+++ b/testing/android/native_test_apk.xml
@@ -49,18 +49,13 @@ found in the LICENSE file.
<property name="resource.absolute.dir" value="res"/>
<property name="gen.absolute.dir" value="${out.dir}/gen"/>
- <condition property="external.jars.dir"
- value="${out.dir}/java/libs"
- else="">
- <available file="${out.dir}/java/libs" type="dir"/>
- </condition>
<path id="out.dex.jar.input.ref">
- <fileset dir="${external.jars.dir}" includes="*.jar"/>
+ <filelist files="${INPUT_JARS_PATHS}"/>
</path>
<condition property="java.compilerargs"
value="-classpath ${toString:out.dex.jar.input.ref}">
<not>
- <equals arg1="${external.jars.dir}" arg2=""/>
+ <equals arg1="${toString:out.dex.jar.input.ref}" arg2=""/>
</not>
</condition>
<property name="native.libs.absolute.dir" location="${out.dir}/libs" />