OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/env python |
| 2 # |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 5 # found in the LICENSE file. |
5 | 6 |
6 # On Android we build unit test bundles as shared libraries. To run | 7 # On Android we build unit test bundles as shared libraries. To run |
7 # tests, we launch a special "test runner" apk which loads the library | 8 # tests, we launch a special "test runner" apk which loads the library |
8 # then jumps into it. Since java is required for many tests | 9 # then jumps into it. Since java is required for many tests |
9 # (e.g. PathUtils.java), a "pure native" test bundle is inadequate. | 10 # (e.g. PathUtils.java), a "pure native" test bundle is inadequate. |
10 # | 11 # |
11 # This script, generate_native_test.py, is used to generate the source | 12 # This script, generate_native_test.py, is used to generate the source |
12 # for an apk that wraps a unit test shared library bundle. That | 13 # for an apk that wraps a unit test shared library bundle. That |
13 # allows us to have a single boiler-plate application be used across | 14 # allows us to have a single boiler-plate application be used across |
14 # all unit test bundles. | 15 # all unit test bundles. |
15 | 16 |
16 import logging | 17 import logging |
17 import optparse | 18 import optparse |
18 import os | 19 import os |
19 import re | 20 import re |
20 import shutil | 21 import shutil |
21 import subprocess | 22 import subprocess |
22 import sys | 23 import sys |
23 | 24 |
24 # cmd_helper.py is under ../../build/android/ | 25 # cmd_helper.py is under ../../build/android/ |
25 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', | 26 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', |
26 '..', 'build', 'android'))) | 27 '..', 'build', 'android'))) |
27 import cmd_helper # pylint: disable=F0401 | 28 from pylib import cmd_helper # pylint: disable=F0401 |
28 | 29 |
29 | 30 |
30 class NativeTestApkGenerator(object): | 31 class NativeTestApkGenerator(object): |
31 """Generate a native test apk source tree. | 32 """Generate a native test apk source tree. |
32 | 33 |
33 TODO(jrg): develop this more so the activity name is replaced as | 34 TODO(jrg): develop this more so the activity name is replaced as |
34 well. That will allow multiple test runners to be installed at the | 35 well. That will allow multiple test runners to be installed at the |
35 same time. (The complication is that it involves renaming a java | 36 same time. (The complication is that it involves renaming a java |
36 class, which implies regeneration of a jni header, and on and on...) | 37 class, which implies regeneration of a jni header, and on and on...) |
37 """ | 38 """ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 210 |
210 if options.ant_compile: | 211 if options.ant_compile: |
211 ntag.Compile(options.ant_args) | 212 ntag.Compile(options.ant_args) |
212 else: | 213 else: |
213 ntag.CompileAndroidMk() | 214 ntag.CompileAndroidMk() |
214 | 215 |
215 logging.warn('COMPLETE.') | 216 logging.warn('COMPLETE.') |
216 | 217 |
217 if __name__ == '__main__': | 218 if __name__ == '__main__': |
218 sys.exit(main(sys.argv)) | 219 sys.exit(main(sys.argv)) |
OLD | NEW |