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 Android APKs in a consistent manner. | 6 # to build Android APKs 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_apk', | 10 # 'target_name': 'my_package_apk', |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 # is_test_apk - Set to 1 if building a test apk. This prevents resources from | 52 # is_test_apk - Set to 1 if building a test apk. This prevents resources from |
53 # dependencies from being re-included. | 53 # dependencies from being re-included. |
54 # native_libs_paths - The path to any native library to be included in this | 54 # native_libs_paths - The path to any native library to be included in this |
55 # target. This should be a path in <(SHARED_LIB_DIR). A stripped copy of | 55 # target. This should be a path in <(SHARED_LIB_DIR). A stripped copy of |
56 # the library will be included in the apk and symbolic links to the | 56 # the library will be included in the apk and symbolic links to the |
57 # unstripped copy will be added to <(android_product_out) to enable native | 57 # unstripped copy will be added to <(android_product_out) to enable native |
58 # debugging. | 58 # debugging. |
59 # resource_dir - The directory for resources. | 59 # resource_dir - The directory for resources. |
60 # R_package - A custom Java package to generate the resource file R.java in. | 60 # R_package - A custom Java package to generate the resource file R.java in. |
61 # By default, the package given in AndroidManifest.xml will be used. | 61 # By default, the package given in AndroidManifest.xml will be used. |
| 62 # java_strings_grd - The name of the grd file from which to generate localized |
| 63 # strings.xml files, if any. |
62 | 64 |
63 { | 65 { |
64 'variables': { | 66 'variables': { |
65 'asset_location%': '', | 67 'asset_location%': '', |
66 'additional_input_paths': [], | 68 'additional_input_paths': [], |
67 'input_jars_paths': [], | 69 'input_jars_paths': [], |
68 'additional_src_dirs': [], | 70 'additional_src_dirs': [], |
69 'generated_src_dirs': [], | 71 'generated_src_dirs': [], |
70 'app_manifest_version_name%': '<(android_app_version_name)', | 72 'app_manifest_version_name%': '<(android_app_version_name)', |
71 'app_manifest_version_code%': '<(android_app_version_code)', | 73 'app_manifest_version_code%': '<(android_app_version_code)', |
72 'proguard_enabled%': 'false', | 74 'proguard_enabled%': 'false', |
73 'proguard_flags%': '', | 75 'proguard_flags%': '', |
74 'native_libs_paths': [], | 76 'native_libs_paths': [], |
75 'jar_name%': 'chromium_apk_<(package_name).jar', | 77 'jar_name%': 'chromium_apk_<(package_name).jar', |
76 'resource_dir%':'', | 78 'resource_dir%':'', |
77 'R_package%':'', | 79 'R_package%':'', |
78 'additional_res_dirs': [], | 80 'additional_res_dirs': [], |
79 'additional_res_packages': [], | 81 'additional_res_packages': [], |
80 'is_test_apk%': 0, | 82 'is_test_apk%': 0, |
| 83 'java_strings_grd%': '', |
| 84 'grit_grd_file%': '', |
81 }, | 85 }, |
82 'sources': [ | 86 'sources': [ |
83 '<@(native_libs_paths)' | 87 '<@(native_libs_paths)' |
84 ], | 88 ], |
85 # Pass the jar path to the apk's "fake" jar target. This would be better as | 89 # Pass the jar path to the apk's "fake" jar target. This would be better as |
86 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 90 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
87 # cannot be lifted in a dependent to all_dependent_settings. | 91 # cannot be lifted in a dependent to all_dependent_settings. |
88 'all_dependent_settings': { | 92 'all_dependent_settings': { |
89 'variables': { | 93 'variables': { |
90 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 94 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
(...skipping 13 matching lines...) Expand all Loading... |
104 # both strip the library and create the link in <(link_dir) a separate | 108 # both strip the library and create the link in <(link_dir) a separate |
105 # script is required. | 109 # script is required. |
106 'action': [ | 110 'action': [ |
107 '<(DEPTH)/build/android/prepare_library_for_apk', | 111 '<(DEPTH)/build/android/prepare_library_for_apk', |
108 '<(android_strip)', | 112 '<(android_strip)', |
109 '<(RULE_INPUT_PATH)', | 113 '<(RULE_INPUT_PATH)', |
110 '<(stripped_library_path)', | 114 '<(stripped_library_path)', |
111 ], | 115 ], |
112 }, | 116 }, |
113 ], | 117 ], |
| 118 'conditions': [ |
| 119 ['R_package != ""', { |
| 120 'variables': { |
| 121 # We generate R.java in package R_package (in addition to the package |
| 122 # listed in the AndroidManifest.xml, which is unavoidable). |
| 123 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
| 124 'additional_res_packages': ['<(R_package)'], |
| 125 }, |
| 126 }], |
| 127 ['java_strings_grd != ""', { |
| 128 'variables': { |
| 129 'out_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res', |
| 130 'additional_res_dirs': ['<(out_res_dir)'], |
| 131 # grit_grd_file is used by grit_action.gypi, included below. |
| 132 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
| 133 }, |
| 134 'actions': [ |
| 135 { |
| 136 'action_name': 'generate_localized_strings_xml', |
| 137 'variables': { |
| 138 'grit_out_dir': '<(out_res_dir)', |
| 139 # resource_ids is unneeded since we don't generate .h headers. |
| 140 'grit_resource_ids': '', |
| 141 }, |
| 142 'includes': ['../build/grit_action.gypi'], |
| 143 }, |
| 144 ], |
| 145 }], |
| 146 ], |
114 'actions': [ | 147 'actions': [ |
115 { | 148 { |
116 'action_name': 'ant_<(package_name)_apk', | 149 'action_name': 'ant_<(package_name)_apk', |
117 'message': 'Building <(package_name) apk.', | 150 'message': 'Building <(package_name) apk.', |
118 'inputs': [ | 151 'inputs': [ |
119 '<(java_in_dir)/AndroidManifest.xml', | 152 '<(java_in_dir)/AndroidManifest.xml', |
120 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 153 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
121 '<(DEPTH)/build/android/ant/common.xml', | 154 '<(DEPTH)/build/android/ant/common.xml', |
122 '<(DEPTH)/build/android/ant/sdk-targets.xml', | 155 '<(DEPTH)/build/android/ant/sdk-targets.xml', |
123 # If there is a separate find for additional_src_dirs, it will find the | 156 # If there is a separate find for additional_src_dirs, it will find the |
124 # wrong .java files when additional_src_dirs is empty. | 157 # wrong .java files when additional_src_dirs is empty. |
125 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 158 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
126 '>@(input_jars_paths)', | 159 '>@(input_jars_paths)', |
127 '>@(native_libs_paths)', | 160 '>@(native_libs_paths)', |
128 '>@(additional_input_paths)', | 161 '>@(additional_input_paths)', |
129 ], | 162 ], |
130 'conditions': [ | 163 'conditions': [ |
131 ['resource_dir!=""', { | 164 ['resource_dir!=""', { |
132 'inputs': ['<!@(find <(java_in_dir)/<(resource_dir) -name "*")'] | 165 'inputs': ['<!@(find <(java_in_dir)/<(resource_dir) -name "*")'] |
133 }], | 166 }], |
| 167 ['java_strings_grd != ""', { |
| 168 'inputs': [ |
| 169 # TODO(newt): replace this with .../values/strings.xml once |
| 170 # the English strings.xml is generated as well? That would be |
| 171 # simpler and faster and should be equivalent. |
| 172 '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(out_res_di
r)" <(grit_grd_file))', |
| 173 ], |
| 174 }], |
134 ['is_test_apk == 1', { | 175 ['is_test_apk == 1', { |
135 'variables': { | 176 'variables': { |
136 'additional_res_dirs=': [], | 177 'additional_res_dirs=': [], |
137 'additional_res_packages=': [], | 178 'additional_res_packages=': [], |
138 } | 179 } |
139 }], | 180 }], |
140 ['proguard_enabled == "true" and proguard_flags != ""', { | 181 ['proguard_enabled == "true" and proguard_flags != ""', { |
141 'inputs': ['<(java_in_dir)/<(proguard_flags)'] | 182 'inputs': ['<(java_in_dir)/<(proguard_flags)'] |
142 }] | 183 }] |
143 ], | 184 ], |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 '-Dbasedir=<(java_in_dir)', | 216 '-Dbasedir=<(java_in_dir)', |
176 '-buildfile', | 217 '-buildfile', |
177 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 218 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
178 | 219 |
179 # Specify CONFIGURATION_NAME as the target for ant to build. The | 220 # Specify CONFIGURATION_NAME as the target for ant to build. The |
180 # buildfile will then build the appropriate SDK tools target. | 221 # buildfile will then build the appropriate SDK tools target. |
181 '<(CONFIGURATION_NAME)', | 222 '<(CONFIGURATION_NAME)', |
182 ] | 223 ] |
183 }, | 224 }, |
184 ], | 225 ], |
185 'conditions': [ | |
186 ['R_package != ""', { | |
187 'variables': { | |
188 # We generate R.java in package R_package (in addition to the package | |
189 # listed in the AndroidManifest.xml, which is unavoidable). | |
190 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | |
191 'additional_res_packages': ['<(R_package)'], | |
192 }, | |
193 }], | |
194 ], | |
195 } | 226 } |
OLD | NEW |