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