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', |
11 # 'type': 'none', | 11 # 'type': 'none', |
12 # 'variables': { | 12 # 'variables': { |
13 # 'java_in_dir': 'path/to/package/root', | 13 # 'java_in_dir': 'path/to/package/root', |
14 # }, | 14 # }, |
15 # 'includes': ['path/to/this/gypi/file'], | 15 # 'includes': ['path/to/this/gypi/file'], |
16 # } | 16 # } |
17 # | 17 # |
18 # Required variables: | 18 # Required variables: |
19 # java_in_dir - The top-level java directory. The src should be in | 19 # java_in_dir - The top-level java directory. The src should be in |
20 # <java_in_dir>/src. | 20 # <java_in_dir>/src. |
21 # Optional/automatic variables: | 21 # Optional/automatic variables: |
| 22 # add_to_dependents_classpaths - Set to 0 if the resulting jar file should not |
| 23 # be added to its dependents' classpaths. |
22 # additional_input_paths - These paths will be included in the 'inputs' list to | 24 # additional_input_paths - These paths will be included in the 'inputs' list to |
23 # ensure that this target is rebuilt when one of these paths changes. | 25 # ensure that this target is rebuilt when one of these paths changes. |
24 # additional_src_dirs - Additional directories with .java files to be compiled | 26 # additional_src_dirs - Additional directories with .java files to be compiled |
25 # and included in the output of this target. | 27 # and included in the output of this target. |
26 # generated_src_dirs - Same as additional_src_dirs except used for .java files | 28 # generated_src_dirs - Same as additional_src_dirs except used for .java files |
27 # that are generated at build time. This should be set automatically by a | 29 # that are generated at build time. This should be set automatically by a |
28 # target's dependencies. The .java files in these directories are not | 30 # target's dependencies. The .java files in these directories are not |
29 # included in the 'inputs' list (unlike additional_src_dirs). | 31 # included in the 'inputs' list (unlike additional_src_dirs). |
30 # input_jars_paths - The path to jars to be included in the classpath. This | 32 # input_jars_paths - The path to jars to be included in the classpath. This |
31 # should be filled automatically by depending on the appropriate targets. | 33 # should be filled automatically by depending on the appropriate targets. |
(...skipping 10 matching lines...) Expand all Loading... |
42 # res_extra_dirs - A list of extra directories containing Android resources. | 44 # res_extra_dirs - A list of extra directories containing Android resources. |
43 # These directories may be generated at build time. | 45 # These directories may be generated at build time. |
44 # 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. |
45 # never_lint - Set to 1 to not run lint on this target. | 47 # never_lint - Set to 1 to not run lint on this target. |
46 | 48 |
47 { | 49 { |
48 'dependencies': [ | 50 'dependencies': [ |
49 '<(DEPTH)/build/android/setup.gyp:build_output_dirs' | 51 '<(DEPTH)/build/android/setup.gyp:build_output_dirs' |
50 ], | 52 ], |
51 'variables': { | 53 'variables': { |
| 54 'add_to_dependents_classpaths%': 1, |
52 'android_jar': '<(android_sdk)/android.jar', | 55 'android_jar': '<(android_sdk)/android.jar', |
53 'input_jars_paths': [ '<(android_jar)' ], | 56 'input_jars_paths': [ '<(android_jar)' ], |
54 'additional_src_dirs': [], | 57 'additional_src_dirs': [], |
55 'javac_includes': [], | 58 'javac_includes': [], |
56 'jar_name': '<(_target_name).jar', | 59 'jar_name': '<(_target_name).jar', |
57 'jar_dir': '<(PRODUCT_DIR)/lib.java', | 60 'jar_dir': '<(PRODUCT_DIR)/lib.java', |
58 'jar_path': '<(intermediate_dir)/<(jar_name)', | 61 'jar_path': '<(intermediate_dir)/<(jar_name)', |
59 'jar_final_path': '<(jar_dir)/<(jar_name)', | 62 'jar_final_path': '<(jar_dir)/<(jar_name)', |
60 'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ], | 63 'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ], |
61 'instr_stamp': '<(intermediate_dir)/instr.stamp', | 64 'instr_stamp': '<(intermediate_dir)/instr.stamp', |
(...skipping 28 matching lines...) Expand all Loading... |
90 ['chromium_code != 0 and emma_coverage != 0 and emma_never_instrument ==
0', { | 93 ['chromium_code != 0 and emma_coverage != 0 and emma_never_instrument ==
0', { |
91 'emma_instrument': 1, | 94 'emma_instrument': 1, |
92 }, { | 95 }, { |
93 'emma_instrument': 0, | 96 'emma_instrument': 0, |
94 }], | 97 }], |
95 ], | 98 ], |
96 }, | 99 }, |
97 'emma_instrument': '<(emma_instrument)', | 100 'emma_instrument': '<(emma_instrument)', |
98 'javac_jar_path': '<(javac_jar_path)', | 101 'javac_jar_path': '<(javac_jar_path)', |
99 }, | 102 }, |
100 # This all_dependent_settings is used for java targets only. This will add the | |
101 # jar path to the classpath of dependent java targets. | |
102 'all_dependent_settings': { | |
103 'variables': { | |
104 'input_jars_paths': ['<(jar_final_path)'], | |
105 'library_dexed_jars_paths': ['<(dex_path)'], | |
106 }, | |
107 }, | |
108 'conditions': [ | 103 'conditions': [ |
| 104 ['add_to_dependents_classpaths == 1', { |
| 105 # This all_dependent_settings is used for java targets only. This will add
the |
| 106 # jar path to the classpath of dependent java targets. |
| 107 'all_dependent_settings': { |
| 108 'variables': { |
| 109 'input_jars_paths': ['<(jar_final_path)'], |
| 110 'library_dexed_jars_paths': ['<(dex_path)'], |
| 111 }, |
| 112 }, |
| 113 }], |
109 ['has_java_resources == 1', { | 114 ['has_java_resources == 1', { |
110 'variables': { | 115 'variables': { |
111 'res_dir': '<(java_in_dir)/res', | 116 'res_dir': '<(java_in_dir)/res', |
112 'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'], | 117 'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'], |
113 'resource_input_paths': ['<!@(find <(res_dir) -type f)'], | 118 'resource_input_paths': ['<!@(find <(res_dir) -type f)'], |
114 | 119 |
115 'R_dir': '<(intermediate_dir)/java_R', | 120 'R_dir': '<(intermediate_dir)/java_R', |
116 'R_text_file': '<(R_dir)/R.txt', | 121 'R_text_file': '<(R_dir)/R.txt', |
117 | 122 |
118 'generated_src_dirs': ['<(R_dir)'], | 123 'generated_src_dirs': ['<(R_dir)'], |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 'dex_no_locals': 1, | 311 'dex_no_locals': 1, |
307 }], | 312 }], |
308 ], | 313 ], |
309 'dex_input_paths': [ '<(jar_final_path)' ], | 314 'dex_input_paths': [ '<(jar_final_path)' ], |
310 'output_path': '<(dex_path)', | 315 'output_path': '<(dex_path)', |
311 }, | 316 }, |
312 'includes': [ 'android/dex_action.gypi' ], | 317 'includes': [ 'android/dex_action.gypi' ], |
313 }, | 318 }, |
314 ], | 319 ], |
315 } | 320 } |
OLD | NEW |