| 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. | |
| 64 | 62 |
| 65 { | 63 { |
| 66 'variables': { | 64 'variables': { |
| 67 'asset_location%': '', | 65 'asset_location%': '', |
| 68 'additional_input_paths': [], | 66 'additional_input_paths': [], |
| 69 'input_jars_paths': [], | 67 'input_jars_paths': [], |
| 70 'additional_src_dirs': [], | 68 'additional_src_dirs': [], |
| 71 'generated_src_dirs': [], | 69 'generated_src_dirs': [], |
| 72 'app_manifest_version_name%': '<(android_app_version_name)', | 70 'app_manifest_version_name%': '<(android_app_version_name)', |
| 73 'app_manifest_version_code%': '<(android_app_version_code)', | 71 'app_manifest_version_code%': '<(android_app_version_code)', |
| 74 'proguard_enabled%': 'false', | 72 'proguard_enabled%': 'false', |
| 75 'proguard_flags%': '', | 73 'proguard_flags%': '', |
| 76 'native_libs_paths': [], | 74 'native_libs_paths': [], |
| 77 'jar_name%': 'chromium_apk_<(package_name).jar', | 75 'jar_name%': 'chromium_apk_<(package_name).jar', |
| 78 'resource_dir%':'', | 76 'resource_dir%':'', |
| 79 'R_package%':'', | 77 'R_package%':'', |
| 80 'additional_res_dirs': [], | 78 'additional_res_dirs': [], |
| 81 'additional_res_packages': [], | 79 'additional_res_packages': [], |
| 82 'is_test_apk%': 0, | 80 'is_test_apk%': 0, |
| 83 'java_strings_grd%': '', | |
| 84 'grit_grd_file%': '', | |
| 85 }, | 81 }, |
| 86 'sources': [ | 82 'sources': [ |
| 87 '<@(native_libs_paths)' | 83 '<@(native_libs_paths)' |
| 88 ], | 84 ], |
| 89 # Pass the jar path to the apk's "fake" jar target. This would be better as | 85 # Pass the jar path to the apk's "fake" jar target. This would be better as |
| 90 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 86 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
| 91 # cannot be lifted in a dependent to all_dependent_settings. | 87 # cannot be lifted in a dependent to all_dependent_settings. |
| 92 'all_dependent_settings': { | 88 'all_dependent_settings': { |
| 93 'variables': { | 89 'variables': { |
| 94 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 90 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
| (...skipping 13 matching lines...) Expand all Loading... |
| 108 # both strip the library and create the link in <(link_dir) a separate | 104 # both strip the library and create the link in <(link_dir) a separate |
| 109 # script is required. | 105 # script is required. |
| 110 'action': [ | 106 'action': [ |
| 111 '<(DEPTH)/build/android/prepare_library_for_apk', | 107 '<(DEPTH)/build/android/prepare_library_for_apk', |
| 112 '<(android_strip)', | 108 '<(android_strip)', |
| 113 '<(RULE_INPUT_PATH)', | 109 '<(RULE_INPUT_PATH)', |
| 114 '<(stripped_library_path)', | 110 '<(stripped_library_path)', |
| 115 ], | 111 ], |
| 116 }, | 112 }, |
| 117 ], | 113 ], |
| 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 ], | |
| 147 'actions': [ | 114 'actions': [ |
| 148 { | 115 { |
| 149 'action_name': 'ant_<(package_name)_apk', | 116 'action_name': 'ant_<(package_name)_apk', |
| 150 'message': 'Building <(package_name) apk.', | 117 'message': 'Building <(package_name) apk.', |
| 151 'inputs': [ | 118 'inputs': [ |
| 152 '<(java_in_dir)/AndroidManifest.xml', | 119 '<(java_in_dir)/AndroidManifest.xml', |
| 153 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 120 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
| 154 '<(DEPTH)/build/android/ant/common.xml', | 121 '<(DEPTH)/build/android/ant/common.xml', |
| 155 '<(DEPTH)/build/android/ant/sdk-targets.xml', | 122 '<(DEPTH)/build/android/ant/sdk-targets.xml', |
| 156 # If there is a separate find for additional_src_dirs, it will find the | 123 # If there is a separate find for additional_src_dirs, it will find the |
| 157 # wrong .java files when additional_src_dirs is empty. | 124 # wrong .java files when additional_src_dirs is empty. |
| 158 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', | 125 '>!@(find >(java_in_dir) >(additional_src_dirs) -name "*.java")', |
| 159 '>@(input_jars_paths)', | 126 '>@(input_jars_paths)', |
| 160 '>@(native_libs_paths)', | 127 '>@(native_libs_paths)', |
| 161 '>@(additional_input_paths)', | 128 '>@(additional_input_paths)', |
| 162 ], | 129 ], |
| 163 'conditions': [ | 130 'conditions': [ |
| 164 ['resource_dir!=""', { | 131 ['resource_dir!=""', { |
| 165 'inputs': ['<!@(find <(java_in_dir)/<(resource_dir) -name "*")'] | 132 'inputs': ['<!@(find <(java_in_dir)/<(resource_dir) -name "*")'] |
| 166 }], | 133 }], |
| 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 }], | |
| 175 ['is_test_apk == 1', { | 134 ['is_test_apk == 1', { |
| 176 'variables': { | 135 'variables': { |
| 177 'additional_res_dirs=': [], | 136 'additional_res_dirs=': [], |
| 178 'additional_res_packages=': [], | 137 'additional_res_packages=': [], |
| 179 } | 138 } |
| 180 }], | 139 }], |
| 181 ['proguard_enabled == "true" and proguard_flags != ""', { | 140 ['proguard_enabled == "true" and proguard_flags != ""', { |
| 182 'inputs': ['<(java_in_dir)/<(proguard_flags)'] | 141 'inputs': ['<(java_in_dir)/<(proguard_flags)'] |
| 183 }] | 142 }] |
| 184 ], | 143 ], |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 '-Dbasedir=<(java_in_dir)', | 175 '-Dbasedir=<(java_in_dir)', |
| 217 '-buildfile', | 176 '-buildfile', |
| 218 '<(DEPTH)/build/android/ant/chromium-apk.xml', | 177 '<(DEPTH)/build/android/ant/chromium-apk.xml', |
| 219 | 178 |
| 220 # Specify CONFIGURATION_NAME as the target for ant to build. The | 179 # Specify CONFIGURATION_NAME as the target for ant to build. The |
| 221 # buildfile will then build the appropriate SDK tools target. | 180 # buildfile will then build the appropriate SDK tools target. |
| 222 '<(CONFIGURATION_NAME)', | 181 '<(CONFIGURATION_NAME)', |
| 223 ] | 182 ] |
| 224 }, | 183 }, |
| 225 ], | 184 ], |
| 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 ], |
| 226 } | 195 } |
| OLD | NEW |