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

Side by Side Diff: build/java.gypi

Issue 20210002: [Android] Sets up a coverage system for java using EMMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gets code coverage for non-apk java working Created 7 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
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # This file is meant to be included into a target to provide a rule 5 # This file is meant to be included into a target to provide a rule
6 # to build Java in a consistent manner. 6 # to build Java in a consistent manner.
7 # 7 #
8 # To use this, create a gyp target with the following form: 8 # To use this, create a gyp target with the following form:
9 # { 9 # {
10 # 'target_name': 'my-package_java', 10 # 'target_name': 'my-package_java',
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 { 48 {
49 'dependencies': [ 49 'dependencies': [
50 '<(DEPTH)/build/android/setup.gyp:build_output_dirs' 50 '<(DEPTH)/build/android/setup.gyp:build_output_dirs'
51 ], 51 ],
52 'variables': { 52 'variables': {
53 'android_jar': '<(android_sdk)/android.jar', 53 'android_jar': '<(android_sdk)/android.jar',
54 'input_jars_paths': [ '<(android_jar)' ], 54 'input_jars_paths': [ '<(android_jar)' ],
55 'additional_src_dirs': [], 55 'additional_src_dirs': [],
56 'javac_includes': [], 56 'javac_includes': [],
57 'jar_name': '<(_target_name).jar', 57 'jar_name': '<(_target_name).jar',
58 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', 58 'jar_dir': '<(PRODUCT_DIR)/lib.java',
59 'jar_final_path': '<(jar_dir)/<(jar_name)',
59 'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ], 60 'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ],
60 'additional_input_paths': [], 61 'additional_input_paths': [],
61 'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar', 62 'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar',
63 'emma_device_jar': '<(android_sdk_root)/tools/lib/emma_device.jar',
62 'generated_src_dirs': ['>@(generated_R_dirs)'], 64 'generated_src_dirs': ['>@(generated_R_dirs)'],
63 'generated_R_dirs': [], 65 'generated_R_dirs': [],
64 'has_java_resources%': 0, 66 'has_java_resources%': 0,
65 'java_strings_grd%': '', 67 'java_strings_grd%': '',
66 'res_extra_dirs': [], 68 'res_extra_dirs': [],
67 'res_extra_files': [], 69 'res_extra_files': [],
68 'res_v14_verify_only%': 0, 70 'res_v14_verify_only%': 0,
69 'resource_input_paths': ['>@(res_extra_files)'], 71 'resource_input_paths': ['>@(res_extra_files)'],
70 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', 72 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)',
71 'classes_dir': '<(intermediate_dir)/classes', 73 'classes_dir': '<(intermediate_dir)/classes',
72 'compile_stamp': '<(intermediate_dir)/compile.stamp', 74 'compile_stamp': '<(intermediate_dir)/compile.stamp',
75 'conditions': [
76 ['emma_instrument != 0', {
77 'jar_path': '<(intermediate_dir)/<(jar_name)',
78 }, {
79 'jar_path': '<(jar_final_path)',
80 }]
81 ]
73 }, 82 },
74 # This all_dependent_settings is used for java targets only. This will add the 83 # This all_dependent_settings is used for java targets only. This will add the
75 # jar path to the classpath of dependent java targets. 84 # jar path to the classpath of dependent java targets.
76 'all_dependent_settings': { 85 'all_dependent_settings': {
77 'variables': { 86 'variables': {
78 'input_jars_paths': ['<(jar_path)'], 87 'input_jars_paths': ['<(jar_final_path)'],
79 'library_dexed_jars_paths': ['<(dex_path)'], 88 'library_dexed_jars_paths': ['<(dex_path)'],
80 }, 89 },
81 }, 90 },
82 'conditions': [ 91 'conditions': [
83 ['has_java_resources == 1', { 92 ['has_java_resources == 1', {
84 'variables': { 93 'variables': {
85 'res_dir': '<(java_in_dir)/res', 94 'res_dir': '<(java_in_dir)/res',
86 'res_crunched_dir': '<(intermediate_dir)/res_crunched', 95 'res_crunched_dir': '<(intermediate_dir)/res_crunched',
87 'res_v14_compatibility_stamp': '<(intermediate_dir)/res_v14_compatibilit y.stamp', 96 'res_v14_compatibility_stamp': '<(intermediate_dir)/res_v14_compatibilit y.stamp',
88 'res_v14_compatibility_dir': '<(intermediate_dir)/res_v14_compatibility' , 97 'res_v14_compatibility_dir': '<(intermediate_dir)/res_v14_compatibility' ,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 'action': [ 220 'action': [
212 'python', '<(DEPTH)/build/android/gyp/generate_v14_compatible_resour ces.py', 221 'python', '<(DEPTH)/build/android/gyp/generate_v14_compatible_resour ces.py',
213 '--res-dir=<(res_dir)', 222 '--res-dir=<(res_dir)',
214 '--res-v14-compatibility-dir=<(res_v14_compatibility_dir)', 223 '--res-v14-compatibility-dir=<(res_v14_compatibility_dir)',
215 '--stamp', '<(res_v14_compatibility_stamp)', 224 '--stamp', '<(res_v14_compatibility_stamp)',
216 '<@(res_v14_additional_options)', 225 '<@(res_v14_additional_options)',
217 ] 226 ]
218 }, 227 },
219 ], 228 ],
220 }], 229 }],
230 ['emma_instrument != 0', {
231 'actions': [
232 {
233 'action_name': 'emma_instr_<(_target_name)',
234 'message': 'Instrumenting <(_target_name) classes',
235 'inputs': [
236 '<(jar_path)',
237 '<(DEPTH)/build/android/ant/apk-instr.xml',
238 '<(DEPTH)/build/android/gyp/ant.py',
239 '<(DEPTH)/build/android/gyp/util/build_utils.py',
240 ],
241 'outputs': [
242 '<(intermediate_dir)/coverage.em',
243 '<(jar_final_path)',
244 ],
245 'action': [
246 'python', '<(DEPTH)/build/android/gyp/ant.py',
247 '-DINPUT_JAR_FILE=<(jar_path)',
248 '-DOUTPUT_JAR_DIR=<(intermediate_dir)',
249 '-DOUTPUT_JAR_FINAL_DIR=<(jar_dir)',
250 '-DEMMA_COVERAGE_FILE=<(intermediate_dir)/coverage.em',
251 '-DEMMA_SOURCES_FILE=<(intermediate_dir)/emma_sources.txt',
252 '-DJAVA_SRC=<(java_in_dir)/src',
253 '-DADDITIONAL_SRC=>(additional_src_dirs)',
254 '-DGENERATED_SRC=>(generated_src_dirs)',
255 '-DANDROID_SDK_ROOT=<(android_sdk_root)',
256 '-Dbasedir=.',
257 '-buildfile',
258 '<(DEPTH)/build/android/ant/apk-instr.xml',
259 ]
260 },
261 ],
262 }],
221 ], 263 ],
222 'actions': [ 264 'actions': [
223 { 265 {
224 'action_name': 'javac_<(_target_name)', 266 'action_name': 'javac_<(_target_name)',
225 'message': 'Compiling <(_target_name) java sources', 267 'message': 'Compiling <(_target_name) java sources',
226 'variables': { 268 'variables': {
227 'all_src_dirs': [ 269 'all_src_dirs': [
228 '>(java_in_dir)/src', 270 '>(java_in_dir)/src',
229 '>@(additional_src_dirs)', 271 '>@(additional_src_dirs)',
230 '>@(generated_src_dirs)', 272 '>@(generated_src_dirs)',
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', 317 '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
276 ] 318 ]
277 }, 319 },
278 { 320 {
279 'action_name': 'jar_toc_<(_target_name)', 321 'action_name': 'jar_toc_<(_target_name)',
280 'message': 'Creating <(_target_name) jar.TOC', 322 'message': 'Creating <(_target_name) jar.TOC',
281 'inputs': [ 323 'inputs': [
282 '<(DEPTH)/build/android/gyp/util/build_utils.py', 324 '<(DEPTH)/build/android/gyp/util/build_utils.py',
283 '<(DEPTH)/build/android/gyp/util/md5_check.py', 325 '<(DEPTH)/build/android/gyp/util/md5_check.py',
284 '<(DEPTH)/build/android/gyp/jar_toc.py', 326 '<(DEPTH)/build/android/gyp/jar_toc.py',
285 '<(jar_path)', 327 '<(jar_final_path)',
286 ], 328 ],
287 'outputs': [ 329 'outputs': [
288 '<(jar_path).TOC', 330 '<(jar_final_path).TOC',
289 ], 331 ],
290 'action': [ 332 'action': [
291 'python', '<(DEPTH)/build/android/gyp/jar_toc.py', 333 'python', '<(DEPTH)/build/android/gyp/jar_toc.py',
292 '--jar-path=<(jar_path)', 334 '--jar-path=<(jar_final_path)',
293 '--toc-path=<(jar_path).TOC', 335 '--toc-path=<(jar_final_path).TOC',
294 336
295 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . 337 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja .
296 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', 338 '--ignore=>!(echo \'>(_inputs)\' | md5sum)',
297 ] 339 ]
298 }, 340 },
299 { 341 {
300 'action_name': 'dex_<(_target_name)', 342 'action_name': 'dex_<(_target_name)',
301 'variables': { 343 'variables': {
302 'dex_input_paths': [ '<(jar_path)' ], 344 'conditions': [
345 ['emma_instrument != 0', {
346 'dex_no_locals': [ '--no-locals' ],
347 }],
348 ],
349 'dex_input_paths': [ '<(jar_final_path)' ],
303 'output_path': '<(dex_path)', 350 'output_path': '<(dex_path)',
304 }, 351 },
305 'includes': [ 'android/dex_action.gypi' ], 352 'includes': [ 'android/dex_action.gypi' ],
306 }, 353 },
307 ], 354 ],
308 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698