Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2318)

Unified Diff: testing/android/generate_native_test.py

Issue 10408091: Chromium support of running DumpRenderTree as an apk on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and move out net dependency from testing/android Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/test_support_android.cc ('k') | testing/android/native_test.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/android/generate_native_test.py
diff --git a/testing/android/generate_native_test.py b/testing/android/generate_native_test.py
index 5fe664a5ac01f8c64c704102a3b7ebbe9b20b2f7..658a13a46965b2aeb00a941cf5b4a3b400fc3d38 100755
--- a/testing/android/generate_native_test.py
+++ b/testing/android/generate_native_test.py
@@ -137,8 +137,11 @@ class NativeTestApkGenerator(object):
logging.warn('%s --> %s' % (jar, dest))
shutil.copyfile(jar, dest)
- def CreateBundle(self):
+ def CreateBundle(self, ant_compile):
"""Create the apk bundle source and assemble components."""
+ if not ant_compile:
+ self._SOURCE_FILES.append('Android.mk')
+ self._REPLACEME_FILES.append('Android.mk')
self._CopyTemplateFiles()
self._ReplaceStrings()
self._CopyLibraryAndJars()
@@ -162,6 +165,16 @@ class NativeTestApkGenerator(object):
logging.error('Ant return code %d' % p.returncode)
sys.exit(p.returncode)
+ def CompileAndroidMk(self):
+ """Build the generated apk within Android source tree using Android.mk."""
+ try:
+ import compile_android_mk # pylint: disable=F0401
+ except:
+ raise AssertionError('Not in Android source tree. '
+ 'Please use --ant-compile.')
+ compile_android_mk.CompileAndroidMk(self._native_library,
+ self._output_directory)
+
def main(argv):
parser = optparse.OptionParser()
@@ -176,7 +189,9 @@ def main(argv):
parser.add_option('--app_abi', default='armeabi',
help='ABI for native shared library')
parser.add_option('--ant-compile', action='store_true',
- help='If specified, build the generated apk with ant')
+ 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',
help='extra args for ant')
@@ -195,13 +210,21 @@ def main(argv):
jar_list = []
if options.jars:
jar_list = options.jars.replace('"', '').split()
+
+ # Ignore --ant-compile when building with Android source.
+ if 'ANDROID_BUILD_TOP' in os.environ:
+ options.ant_compile = False
+
ntag = NativeTestApkGenerator(native_library=options.native_library,
jars=jar_list,
output_directory=options.output,
target_abi=options.app_abi)
- ntag.CreateBundle()
+ ntag.CreateBundle(options.ant_compile)
+
if options.ant_compile:
ntag.Compile(options.ant_args)
+ else:
+ ntag.CompileAndroidMk()
logging.warn('COMPLETE.')
« no previous file with comments | « base/test/test_support_android.cc ('k') | testing/android/native_test.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698