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 # javac_includes - A list of specific files to include. This is by default | 37 # javac_includes - A list of specific files to include. This is by default |
38 # empty, which leads to inclusion of all files specified. May include | 38 # empty, which leads to inclusion of all files specified. May include |
39 # wildcard, and supports '**/' for recursive path wildcards, ie.: | 39 # wildcard, and supports '**/' for recursive path wildcards, ie.: |
40 # '**/MyFileRegardlessOfDirectory.java', '**/IncludedPrefix*.java'. | 40 # '**/MyFileRegardlessOfDirectory.java', '**/IncludedPrefix*.java'. |
41 # has_java_resources - Set to 1 if the java target contains an | 41 # has_java_resources - Set to 1 if the java target contains an |
42 # Android-compatible resources folder named res. If 1, R_package and | 42 # Android-compatible resources folder named res. If 1, R_package and |
43 # R_package_relpath must also be set. | 43 # R_package_relpath must also be set. |
44 # R_package - The java package in which the R class (which maps resources to | 44 # R_package - The java package in which the R class (which maps resources to |
45 # integer IDs) should be generated, e.g. org.chromium.content. | 45 # integer IDs) should be generated, e.g. org.chromium.content. |
46 # R_package_relpath - Same as R_package, but replace each '.' with '/'. | 46 # R_package_relpath - Same as R_package, but replace each '.' with '/'. |
| 47 # java_strings_grd - The name of the grd file from which to generate localized |
| 48 # strings.xml files, if any. |
47 | 49 |
48 { | 50 { |
49 'dependencies': [ | 51 'dependencies': [ |
50 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' | 52 '<(DEPTH)/build/build_output_dirs_android.gyp:build_output_dirs' |
51 ], | 53 ], |
52 # This all_dependent_settings is used for java targets only. This will add the | 54 # This all_dependent_settings is used for java targets only. This will add the |
53 # chromium_<(package_name) jar to the classpath of dependent java targets. | 55 # chromium_<(package_name) jar to the classpath of dependent java targets. |
54 'all_dependent_settings': { | 56 'all_dependent_settings': { |
55 'variables': { | 57 'variables': { |
56 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar
'], | 58 'input_jars_paths': ['<(PRODUCT_DIR)/lib.java/chromium_<(package_name).jar
'], |
57 }, | 59 }, |
58 }, | 60 }, |
59 'variables': { | 61 'variables': { |
60 'input_jars_paths': [], | 62 'input_jars_paths': [], |
61 'additional_src_dirs': [], | 63 'additional_src_dirs': [], |
62 'javac_includes': [], | 64 'javac_includes': [], |
63 'additional_input_paths': ['>@(additional_R_files)'], | 65 'additional_input_paths': ['>@(additional_R_files)'], |
64 'generated_src_dirs': ['>@(generated_R_dirs)'], | 66 'generated_src_dirs': ['>@(generated_R_dirs)'], |
65 'generated_R_dirs': [], | 67 'generated_R_dirs': [], |
66 'additional_R_files': [], | 68 'additional_R_files': [], |
67 'has_java_resources%': 0, | 69 'has_java_resources%': 0, |
| 70 'java_strings_grd%': '', |
68 }, | 71 }, |
69 'conditions': [ | 72 'conditions': [ |
70 ['has_java_resources == 1', { | 73 ['has_java_resources == 1', { |
71 'variables': { | 74 'variables': { |
72 'res_dir': '<(java_in_dir)/res', | 75 'res_dir': '<(java_in_dir)/res', |
73 'crunched_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/res', | 76 'out_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/res', |
74 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', | 77 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', |
75 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', | 78 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', |
76 'R_text_file': '<(R_dir)/R.txt', | 79 'R_text_file': '<(R_dir)/R.txt', |
77 'generated_src_dirs': ['<(R_dir)'], | 80 'generated_src_dirs': ['<(R_dir)'], |
78 'additional_input_paths': ['<(R_file)'], | 81 'additional_input_paths': ['<(R_file)'], |
| 82 # grit_grd_file is used by grit_action.gypi, included below. |
| 83 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
79 }, | 84 }, |
80 'all_dependent_settings': { | 85 'all_dependent_settings': { |
81 'variables': { | 86 'variables': { |
82 # Dependent jars include this target's R.java file via | 87 # Dependent jars include this target's R.java file via |
83 # generated_R_dirs and additional_R_files. | 88 # generated_R_dirs and additional_R_files. |
84 'generated_R_dirs': ['<(R_dir)'], | 89 'generated_R_dirs': ['<(R_dir)'], |
85 'additional_R_files': ['<(R_file)'], | 90 'additional_R_files': ['<(R_file)'], |
86 'additional_R_text_files': ['<(R_text_file)'], | 91 'additional_R_text_files': ['<(R_text_file)'], |
87 | 92 |
88 # Dependent APKs include this target's resources via | 93 # Dependent APKs include this target's resources via |
89 # additional_res_dirs and additional_res_packages. | 94 # additional_res_dirs and additional_res_packages. |
90 'additional_res_dirs': ['<(crunched_res_dir)', '<(res_dir)'], | 95 'additional_res_dirs': ['<(out_res_dir)', '<(res_dir)'], |
91 'additional_res_packages': ['<(R_package)'], | 96 'additional_res_packages': ['<(R_package)'], |
92 }, | 97 }, |
93 }, | 98 }, |
| 99 'conditions': [ |
| 100 ['java_strings_grd != ""', { |
| 101 'actions': [ |
| 102 { |
| 103 'action_name': 'generate_localized_strings_xml', |
| 104 'variables': { |
| 105 'grit_out_dir': '<(out_res_dir)', |
| 106 # resource_ids is unneeded since we don't generate .h headers. |
| 107 'grit_resource_ids': '', |
| 108 }, |
| 109 'includes': ['../build/grit_action.gypi'], |
| 110 }, |
| 111 ], |
| 112 }], |
| 113 ], |
94 'actions': [ | 114 'actions': [ |
95 # Generate R.java and crunch image resources. | 115 # Generate R.java and crunch image resources. |
96 { | 116 { |
97 'action_name': 'process_resources', | 117 'action_name': 'process_resources', |
98 'message': 'processing resources for <(package_name)', | 118 'message': 'processing resources for <(package_name)', |
| 119 'conditions': [ |
| 120 ['java_strings_grd != ""', { |
| 121 'inputs': [ |
| 122 # TODO(newt): replace this with .../values/strings.xml once |
| 123 # the English strings.xml is generated as well? That would be |
| 124 # simpler and faster and should be equivalent. |
| 125 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(out_re
s_dir)" <(grit_grd_file))', |
| 126 ], |
| 127 }], |
| 128 ], |
99 'inputs': [ | 129 'inputs': [ |
100 '<(DEPTH)/build/android/process_resources.py', | 130 '<(DEPTH)/build/android/process_resources.py', |
101 '<!@(find <(res_dir) -type f)', | 131 '<!@(find <(res_dir) -type f)', |
102 ], | 132 ], |
103 'outputs': [ | 133 'outputs': [ |
104 '<(R_file)', | 134 '<(R_file)', |
105 ], | 135 ], |
106 'action': [ | 136 'action': [ |
107 '<(DEPTH)/build/android/process_resources.py', | 137 '<(DEPTH)/build/android/process_resources.py', |
108 '--android-sdk', '<(android_sdk)', | 138 '--android-sdk', '<(android_sdk)', |
109 '--android-sdk-tools', '<(android_sdk_tools)', | 139 '--android-sdk-tools', '<(android_sdk_tools)', |
110 '--R-package', '<(R_package)', | 140 '--R-package', '<(R_package)', |
111 '--R-dir', '<(R_dir)', | 141 '--R-dir', '<(R_dir)', |
112 '--res-dir', '<(res_dir)', | 142 '--res-dir', '<(res_dir)', |
113 '--crunched-res-dir', '<(crunched_res_dir)', | 143 '--crunched-res-dir', '<(out_res_dir)', |
114 ], | 144 ], |
115 }, | 145 }, |
116 ], | 146 ], |
117 }], | 147 }], |
118 ], | 148 ], |
119 'actions': [ | 149 'actions': [ |
120 { | 150 { |
121 'action_name': 'ant_<(package_name)', | 151 'action_name': 'ant_<(package_name)', |
122 'message': 'Building <(package_name) java sources.', | 152 'message': 'Building <(package_name) java sources.', |
123 'inputs': [ | 153 'inputs': [ |
(...skipping 22 matching lines...) Expand all Loading... |
146 '-DPACKAGE_NAME=<(package_name)', | 176 '-DPACKAGE_NAME=<(package_name)', |
147 '-DJAVAC_INCLUDES=>(javac_includes)', | 177 '-DJAVAC_INCLUDES=>(javac_includes)', |
148 | 178 |
149 '-Dbasedir=<(java_in_dir)', | 179 '-Dbasedir=<(java_in_dir)', |
150 '-buildfile', | 180 '-buildfile', |
151 '<(DEPTH)/build/android/ant/chromium-jars.xml' | 181 '<(DEPTH)/build/android/ant/chromium-jars.xml' |
152 ] | 182 ] |
153 }, | 183 }, |
154 ], | 184 ], |
155 } | 185 } |
OLD | NEW |