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

Side by Side Diff: testing/android/generate_native_test.py

Issue 10830012: [Android] Add chrome_java target for building Java code in the chromium layer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@reland
Patch Set: fix java build error Created 8 years, 4 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 unified diff | Download patch
« no previous file with comments | « net/android/java/net.xml ('k') | testing/android/native_test.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # 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
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # 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
8 # 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
9 # then jumps into it. Since java is required for many tests 9 # then jumps into it. Since java is required for many tests
10 # (e.g. PathUtils.java), a "pure native" test bundle is inadequate. 10 # (e.g. PathUtils.java), a "pure native" test bundle is inadequate.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 self._CopyLibraryAndJars() 138 self._CopyLibraryAndJars()
139 139
140 def Compile(self, ant_args): 140 def Compile(self, ant_args):
141 """Build the generated apk with ant. 141 """Build the generated apk with ant.
142 142
143 Args: 143 Args:
144 ant_args: extra args to pass to ant 144 ant_args: extra args to pass to ant
145 """ 145 """
146 cmd = ['ant'] 146 cmd = ['ant']
147 if ant_args: 147 if ant_args:
148 cmd.append(ant_args) 148 cmd.extend(ant_args)
149 cmd.append("-DAPP_ABI=" + self._target_abi) 149 cmd.append("-DAPP_ABI=" + self._target_abi)
150 cmd.extend(['-buildfile', 150 cmd.extend(['-buildfile',
151 os.path.join(self._output_directory, 'native_test_apk.xml')]) 151 os.path.join(self._output_directory, 'native_test_apk.xml')])
152 logging.warn(cmd) 152 logging.warn(cmd)
153 p = subprocess.Popen(cmd, stderr=subprocess.STDOUT) 153 p = subprocess.Popen(cmd, stderr=subprocess.STDOUT)
154 (stdout, _) = p.communicate() 154 (stdout, _) = p.communicate()
155 logging.warn(stdout) 155 logging.warn(stdout)
156 if p.returncode != 0: 156 if p.returncode != 0:
157 logging.error('Ant return code %d', p.returncode) 157 logging.error('Ant return code %d', p.returncode)
158 sys.exit(p.returncode) 158 sys.exit(p.returncode)
(...skipping 23 matching lines...) Expand all
182 help='ABI for native shared library') 182 help='ABI for native shared library')
183 parser.add_option('--sdk-build', type='int', default=1, 183 parser.add_option('--sdk-build', type='int', default=1,
184 help='Unless set to 0, build the generated apk with ant. ' 184 help='Unless set to 0, build the generated apk with ant. '
185 'Otherwise assume compiling within the Android ' 185 'Otherwise assume compiling within the Android '
186 'source tree using Android.mk.') 186 'source tree using Android.mk.')
187 # FIXME(beverloo): Remove --ant-compile when all users adopted. 187 # FIXME(beverloo): Remove --ant-compile when all users adopted.
188 parser.add_option('--ant-compile', action='store_true', 188 parser.add_option('--ant-compile', action='store_true',
189 help=('If specified, build the generated apk with ant. ' 189 help=('If specified, build the generated apk with ant. '
190 'Otherwise assume compiling within the Android ' 190 'Otherwise assume compiling within the Android '
191 'source tree using Android.mk.')) 191 'source tree using Android.mk.'))
192 parser.add_option('--ant-args', 192 parser.add_option('--ant-args', action='append',
193 help='extra args for ant') 193 help='extra args for ant')
194 194
195 options, _ = parser.parse_args(argv) 195 options, _ = parser.parse_args(argv)
196 196
197 # It is not an error to specify no native library; the apk should 197 # It is not an error to specify no native library; the apk should
198 # still be generated and build. It will, however, print 198 # still be generated and build. It will, however, print
199 # NATIVE_LOADER_FAILED when run. 199 # NATIVE_LOADER_FAILED when run.
200 if not options.output: 200 if not options.output:
201 raise Exception('No output directory specified for generated files') 201 raise Exception('No output directory specified for generated files')
202 202
(...skipping 13 matching lines...) Expand all
216 216
217 if options.sdk_build or options.ant_compile: 217 if options.sdk_build or options.ant_compile:
218 ntag.Compile(options.ant_args) 218 ntag.Compile(options.ant_args)
219 else: 219 else:
220 ntag.CompileAndroidMk() 220 ntag.CompileAndroidMk()
221 221
222 logging.warn('COMPLETE.') 222 logging.warn('COMPLETE.')
223 223
224 if __name__ == '__main__': 224 if __name__ == '__main__':
225 sys.exit(main(sys.argv)) 225 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « net/android/java/net.xml ('k') | testing/android/native_test.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698