Index: testing/android/generate_native_test.py |
diff --git a/testing/android/generate_native_test.py b/testing/android/generate_native_test.py |
index 153403bd611f52d0dc8ac70be82edd7176461a8f..563112e868c117b095a8bf2db6d171410c6ad733 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) |