OLD | NEW |
---|---|
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 26 matching lines...) Expand all Loading... | |
37 # Android-compatible resources folder named res. If 1, R_package and | 37 # Android-compatible resources folder named res. If 1, R_package and |
38 # R_package_relpath must also be set. | 38 # R_package_relpath must also be set. |
39 # R_package - The java package in which the R class (which maps resources to | 39 # R_package - The java package in which the R class (which maps resources to |
40 # integer IDs) should be generated, e.g. org.chromium.content. | 40 # integer IDs) should be generated, e.g. org.chromium.content. |
41 # R_package_relpath - Same as R_package, but replace each '.' with '/'. | 41 # R_package_relpath - Same as R_package, but replace each '.' with '/'. |
42 # java_strings_grd - The name of the grd file from which to generate localized | 42 # java_strings_grd - The name of the grd file from which to generate localized |
43 # strings.xml files, if any. | 43 # strings.xml files, if any. |
44 # res_extra_dirs - A list of extra directories containing Android resources. | 44 # res_extra_dirs - A list of extra directories containing Android resources. |
45 # These directories may be generated at build time. | 45 # These directories may be generated at build time. |
46 # res_extra_files - A list of the files in res_extra_dirs. | 46 # res_extra_files - A list of the files in res_extra_dirs. |
47 # emma_should_instrument - If 1, and emma_coverage is 1, then this java target | |
48 # will be instrumented. | |
47 | 49 |
48 { | 50 { |
49 'dependencies': [ | 51 'dependencies': [ |
50 '<(DEPTH)/build/android/setup.gyp:build_output_dirs' | 52 '<(DEPTH)/build/android/setup.gyp:build_output_dirs' |
51 ], | 53 ], |
52 'variables': { | 54 'variables': { |
53 'android_jar': '<(android_sdk)/android.jar', | 55 'android_jar': '<(android_sdk)/android.jar', |
54 'input_jars_paths': [ '<(android_jar)' ], | 56 'input_jars_paths': [ '<(android_jar)' ], |
55 'additional_src_dirs': [], | 57 'additional_src_dirs': [], |
56 'javac_includes': [], | 58 'javac_includes': [], |
57 'jar_name': '<(_target_name).jar', | 59 'jar_name': '<(_target_name).jar', |
58 'jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 60 'jar_dir': '<(PRODUCT_DIR)/lib.java', |
61 'jar_path': '<(intermediate_dir)/<(jar_name)', | |
62 'jar_final_path': '<(jar_dir)/<(jar_name)', | |
59 'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ], | 63 'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ], |
64 'instr_stamp': '<(intermediate_dir)/instr.stamp', | |
60 'additional_input_paths': [], | 65 'additional_input_paths': [], |
61 'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar', | 66 'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar', |
62 'generated_src_dirs': ['>@(generated_R_dirs)'], | 67 'generated_src_dirs': ['>@(generated_R_dirs)'], |
63 'generated_R_dirs': [], | 68 'generated_R_dirs': [], |
64 'has_java_resources%': 0, | 69 'has_java_resources%': 0, |
65 'java_strings_grd%': '', | 70 'java_strings_grd%': '', |
66 'res_extra_dirs': [], | 71 'res_extra_dirs': [], |
67 'res_extra_files': [], | 72 'res_extra_files': [], |
68 'res_v14_verify_only%': 0, | 73 'res_v14_verify_only%': 0, |
69 'resource_input_paths': ['>@(res_extra_files)'], | 74 'resource_input_paths': ['>@(res_extra_files)'], |
70 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', | 75 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', |
71 'classes_dir': '<(intermediate_dir)/classes', | 76 'classes_dir': '<(intermediate_dir)/classes', |
72 'compile_stamp': '<(intermediate_dir)/compile.stamp', | 77 'compile_stamp': '<(intermediate_dir)/compile.stamp', |
73 'proguard_config%': '', | 78 'proguard_config%': '', |
74 'proguard_preprocess%': '0', | 79 'proguard_preprocess%': '0', |
75 'variables': { | 80 'variables': { |
76 'variables': { | 81 'variables': { |
77 'proguard_preprocess%': 0, | 82 'proguard_preprocess%': 0, |
83 'emma_should_instrument%': 0, | |
78 }, | 84 }, |
79 'conditions': [ | 85 'conditions': [ |
80 ['proguard_preprocess == 1', { | 86 ['proguard_preprocess == 1', { |
81 'javac_jar_path': '<(intermediate_dir)/<(_target_name).pre.jar' | 87 'javac_jar_path': '<(intermediate_dir)/<(_target_name).pre.jar' |
82 }, { | 88 }, { |
83 'javac_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)' | 89 'javac_jar_path': '<(jar_path)' |
cjhopman
2013/08/20 15:27:24
I'm not sure that you can expand jar_path here (si
gkanwar1
2013/08/20 17:30:14
But doesn't the previous code also try to expand j
| |
90 }], | |
91 ['emma_should_instrument != 0', { | |
92 'emma_instrument': '<(emma_coverage)', | |
93 }, { | |
94 'emma_instrument': 0, | |
84 }], | 95 }], |
85 ], | 96 ], |
86 }, | 97 }, |
87 'javac_jar_path': '<(javac_jar_path)', | 98 'javac_jar_path': '<(javac_jar_path)', |
99 'emma_instrument': '<(emma_instrument)', | |
88 }, | 100 }, |
89 # This all_dependent_settings is used for java targets only. This will add the | 101 # This all_dependent_settings is used for java targets only. This will add the |
90 # jar path to the classpath of dependent java targets. | 102 # jar path to the classpath of dependent java targets. |
91 'all_dependent_settings': { | 103 'all_dependent_settings': { |
92 'variables': { | 104 'variables': { |
93 'input_jars_paths': ['<(jar_path)'], | 105 'input_jars_paths': ['<(jar_final_path)'], |
94 'library_dexed_jars_paths': ['<(dex_path)'], | 106 'library_dexed_jars_paths': ['<(dex_path)'], |
95 }, | 107 }, |
96 }, | 108 }, |
97 'conditions': [ | 109 'conditions': [ |
98 ['has_java_resources == 1', { | 110 ['has_java_resources == 1', { |
99 'variables': { | 111 'variables': { |
100 'res_dir': '<(java_in_dir)/res', | 112 'res_dir': '<(java_in_dir)/res', |
101 'res_crunched_dir': '<(intermediate_dir)/res_crunched', | 113 'res_crunched_dir': '<(intermediate_dir)/res_crunched', |
102 'res_v14_compatibility_stamp': '<(intermediate_dir)/res_v14_compatibilit y.stamp', | 114 'res_v14_compatibility_stamp': '<(intermediate_dir)/res_v14_compatibilit y.stamp', |
103 'res_v14_compatibility_dir': '<(intermediate_dir)/res_v14_compatibility' , | 115 'res_v14_compatibility_dir': '<(intermediate_dir)/res_v14_compatibility' , |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 'python', '<(DEPTH)/build/android/gyp/jar.py', | 325 'python', '<(DEPTH)/build/android/gyp/jar.py', |
314 '--classes-dir=<(classes_dir)', | 326 '--classes-dir=<(classes_dir)', |
315 '--jar-path=<(javac_jar_path)', | 327 '--jar-path=<(javac_jar_path)', |
316 '--excluded-classes=<(jar_excluded_classes)', | 328 '--excluded-classes=<(jar_excluded_classes)', |
317 | 329 |
318 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . | 330 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . |
319 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 331 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
320 ] | 332 ] |
321 }, | 333 }, |
322 { | 334 { |
335 'action_name': 'instr_jar_<(_target_name)', | |
336 'message': 'Instrumenting <(_target_name) jar', | |
337 'variables': { | |
338 'input_path': '<(jar_path)', | |
339 'output_path': '<(jar_final_path)', | |
340 'stamp_path': '<(instr_stamp)', | |
341 'instr_type': 'jar', | |
342 }, | |
343 'outputs': [ | |
344 '<(jar_final_path)', | |
345 ], | |
346 'inputs': [ | |
347 '<(jar_path)', | |
348 ], | |
349 'includes': [ 'android/instr_action.gypi' ], | |
350 }, | |
351 { | |
323 'action_name': 'jar_toc_<(_target_name)', | 352 'action_name': 'jar_toc_<(_target_name)', |
324 'message': 'Creating <(_target_name) jar.TOC', | 353 'message': 'Creating <(_target_name) jar.TOC', |
325 'inputs': [ | 354 'inputs': [ |
326 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 355 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
327 '<(DEPTH)/build/android/gyp/util/md5_check.py', | 356 '<(DEPTH)/build/android/gyp/util/md5_check.py', |
328 '<(DEPTH)/build/android/gyp/jar_toc.py', | 357 '<(DEPTH)/build/android/gyp/jar_toc.py', |
329 '<(jar_path)', | 358 '<(jar_final_path)', |
330 ], | 359 ], |
331 'outputs': [ | 360 'outputs': [ |
332 '<(jar_path).TOC', | 361 '<(jar_final_path).TOC', |
333 ], | 362 ], |
334 'action': [ | 363 'action': [ |
335 'python', '<(DEPTH)/build/android/gyp/jar_toc.py', | 364 'python', '<(DEPTH)/build/android/gyp/jar_toc.py', |
336 '--jar-path=<(jar_path)', | 365 '--jar-path=<(jar_final_path)', |
337 '--toc-path=<(jar_path).TOC', | 366 '--toc-path=<(jar_final_path).TOC', |
338 | 367 |
339 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . | 368 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja . |
340 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 369 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
341 ] | 370 ] |
342 }, | 371 }, |
343 { | 372 { |
344 'action_name': 'dex_<(_target_name)', | 373 'action_name': 'dex_<(_target_name)', |
345 'variables': { | 374 'variables': { |
346 'dex_input_paths': [ '<(jar_path)' ], | 375 'conditions': [ |
376 ['emma_instrument != 0', { | |
377 'dex_no_locals': 1, | |
378 }], | |
379 ], | |
380 'dex_input_paths': [ '<(jar_final_path)' ], | |
347 'output_path': '<(dex_path)', | 381 'output_path': '<(dex_path)', |
348 }, | 382 }, |
349 'includes': [ 'android/dex_action.gypi' ], | 383 'includes': [ 'android/dex_action.gypi' ], |
350 }, | 384 }, |
351 ], | 385 ], |
352 } | 386 } |
OLD | NEW |