Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
| 6 | 6 |
| 7 assert(is_android) | 7 assert(is_android) |
| 8 | 8 |
| 9 | 9 |
| 10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 } | 138 } |
| 139 | 139 |
| 140 if (defined(invoker.args)) { | 140 if (defined(invoker.args)) { |
| 141 args += invoker.args | 141 args += invoker.args |
| 142 } | 142 } |
| 143 | 143 |
| 144 args += rebase_path(invoker.sources, root_build_dir) | 144 args += rebase_path(invoker.sources, root_build_dir) |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 # Packages resources, assets, dex, and native libraries into an apk. Signs and | |
| 149 # zipaligns the apk. | |
| 150 template("create_apk") { | |
| 151 _android_manifest = invoker.android_manifest | |
| 152 _base_path = invoker.base_path | |
| 153 _final_apk_path = invoker.apk_path | |
| 154 _resources_zip = invoker.resources_zip | |
| 155 _dex_path = invoker.classes_dex_path | |
|
newt (away)
2014/07/30 21:23:14
any reason not to use the same name for both of th
cjhopman
2014/07/31 22:15:05
Ah, this was more useful before I had come up with
| |
| 156 _keystore_path = invoker.keystore_path | |
| 157 _keystore_name = invoker.keystore_name | |
| 158 _keystore_password = invoker.keystore_password | |
| 159 | |
| 160 _deps = [] | |
| 161 if (defined(invoker.deps)) { | |
| 162 _deps = invoker.deps | |
| 163 } | |
| 164 | |
| 165 _native_libs_dir = "//build/android/empty/res" | |
|
newt (away)
2014/07/30 21:23:14
this path looks wrong (or at least oddly named)
cjhopman
2014/07/31 22:15:05
It's just a guaranteed to be empty path. I could m
| |
| 166 if (defined(invoker.native_libs_dir)) { | |
| 167 _native_libs_dir = invoker.native_libs_dir | |
| 168 } | |
| 169 | |
| 170 _asset_location = "//build/android/empty/res" | |
| 171 if (defined(invoker.asset_location)) { | |
| 172 _asset_location = invoker.asset_location | |
| 173 } | |
| 174 | |
| 175 _version_code = "0" | |
| 176 _version_name = "Developer Build" | |
| 177 | |
| 178 _base_apk_path = _base_path + ".apk_intermediates" | |
| 179 | |
| 180 _resource_packaged_apk_path = _base_apk_path + ".ap_" | |
| 181 _packaged_apk_path = _base_apk_path + ".unfinished.apk" | |
| 182 | |
| 183 | |
| 184 _configuration_name = "Release" | |
| 185 if (is_debug) { | |
| 186 _configuration_name = "Debug" | |
| 187 } | |
| 188 | |
| 189 action("${target_name}__package_resources") { | |
| 190 deps = _deps | |
| 191 | |
| 192 script = "//build/android/gyp/package_resources.py" | |
| 193 depfile = "${target_gen_dir}/${target_name}.d" | |
| 194 source_prereqs = [ | |
| 195 _android_manifest, | |
| 196 _resources_zip, | |
| 197 ] | |
| 198 outputs = [depfile, _resource_packaged_apk_path] | |
| 199 | |
| 200 _rebased_resources_zips = [rebase_path(_resources_zip, root_build_dir)] | |
| 201 args = [ | |
| 202 "--depfile", rebase_path(depfile, root_build_dir), | |
| 203 "--android-sdk", rebased_android_sdk, | |
| 204 "--android-sdk-tools", rebased_android_sdk_build_tools, | |
| 205 | |
| 206 "--configuration-name=$_configuration_name", | |
| 207 | |
| 208 "--android-manifest", rebase_path(_android_manifest, root_build_dir), | |
| 209 "--version-code", _version_code, | |
| 210 "--version-name", _version_name, | |
| 211 | |
| 212 "--asset-dir", rebase_path(_asset_location, root_build_dir), | |
| 213 "--resource-zips=$_rebased_resources_zips", | |
| 214 | |
| 215 "--apk-path", rebase_path(_resource_packaged_apk_path, root_build_dir), | |
| 216 ] | |
| 217 } | |
| 218 | |
| 219 action("${target_name}__package") { | |
| 220 script = "//build/android/gyp/ant.py" | |
| 221 _ant_script = "//build/android/ant/apk-package.xml" | |
| 222 | |
| 223 depfile = "$target_gen_dir/$target_name.d" | |
| 224 | |
| 225 source_prereqs = [ | |
| 226 _dex_path, | |
| 227 _resource_packaged_apk_path, | |
| 228 _ant_script | |
| 229 ] | |
| 230 | |
| 231 outputs = [ | |
| 232 depfile, | |
| 233 _packaged_apk_path, | |
| 234 ] | |
| 235 | |
| 236 _rebased_emma_jar = "" | |
| 237 _rebased_resource_packaged_apk_path = rebase_path(_resource_packaged_apk_pat h, root_build_dir) | |
| 238 _rebased_packaged_apk_path = rebase_path(_packaged_apk_path, root_build_dir) | |
| 239 _rebased_native_libs_dir = rebase_path(_native_libs_dir, root_build_dir) | |
| 240 _rebased_dex_path = rebase_path(_dex_path, root_build_dir) | |
| 241 args = [ | |
| 242 "--depfile", rebase_path(depfile, root_build_dir), | |
| 243 "--", | |
| 244 "-quiet", | |
| 245 "-DANDROID_SDK_ROOT=$rebased_android_sdk_root", | |
| 246 "-DANDROID_SDK_TOOLS=$rebased_android_sdk_build_tools", | |
| 247 "-DRESOURCE_PACKAGED_APK_NAME=$_rebased_resource_packaged_apk_path", | |
| 248 "-DCONFIGURATION_NAME=$_configuration_name", | |
| 249 "-DNATIVE_LIBS_DIR=$_rebased_native_libs_dir", | |
| 250 "-DOUT_DIR=", | |
| 251 "-DUNSIGNED_APK_PATH=$_rebased_packaged_apk_path", | |
| 252 "-DEMMA_INSTRUMENT=0", | |
| 253 "-DEMMA_DEVICE_JAR=$_rebased_emma_jar", | |
| 254 "-DDEX_FILE_PATH=$_rebased_dex_path", | |
| 255 | |
| 256 "-Dbasedir=.", | |
| 257 "-buildfile", rebase_path(_ant_script, root_build_dir) | |
| 258 ] | |
| 259 } | |
| 260 | |
| 261 action("${target_name}__finalize") { | |
| 262 script = "//build/android/gyp/finalize_apk.py" | |
| 263 depfile = "$target_gen_dir/$target_name.d" | |
| 264 | |
| 265 sources = [_packaged_apk_path] | |
| 266 source_prereqs = [_keystore_path] | |
| 267 outputs = [depfile, _final_apk_path] | |
| 268 | |
| 269 args = [ | |
| 270 "--depfile", rebase_path(depfile, root_build_dir), | |
| 271 "--zipalign-path", rebase_path(zipalign_path, root_build_dir), | |
| 272 "--unsigned-apk-path", rebase_path(_packaged_apk_path, root_build_dir), | |
| 273 "--final-apk-path", rebase_path(_final_apk_path, root_build_dir), | |
| 274 "--key-path", rebase_path(_keystore_path, root_build_dir), | |
| 275 "--key-name", _keystore_name, | |
| 276 "--key-passwd", _keystore_password, | |
| 277 ] | |
| 278 } | |
| 279 | |
| 280 group(target_name) { | |
|
newt (away)
2014/07/30 21:23:14
do you need to use a group here? Could you just ch
cjhopman
2014/07/31 22:15:05
Yeah, I could. I've basically followed the pattern
| |
| 281 deps = [":${target_name}__finalize"] | |
| 282 } | |
| 283 } | |
| 284 | |
| 148 # Compiles and jars a set of java files. | 285 # Compiles and jars a set of java files. |
| 149 # | 286 # |
| 150 # Outputs: | 287 # Outputs: |
| 151 # $jar_path.jar | 288 # $jar_path.jar |
| 152 # $jar_path.jar.TOC | 289 # $jar_path.jar.TOC |
| 153 # | 290 # |
| 154 # Variables | 291 # Variables |
| 155 # java_files: List of .java files to compile. | 292 # java_files: List of .java files to compile. |
| 156 # java_deps: List of java dependencies. These should all have a .jar output | 293 # java_deps: List of java dependencies. These should all have a .jar output |
| 157 # at "${target_gen_dir}/${target_name}.jar. | 294 # at "${target_gen_dir}/${target_name}.jar. |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 args += [ | 507 args += [ |
| 371 "--all-resources-zip-out", rebase_path(all_resources_zip, root_build_dir ) | 508 "--all-resources-zip-out", rebase_path(all_resources_zip, root_build_dir ) |
| 372 ] | 509 ] |
| 373 } | 510 } |
| 374 | 511 |
| 375 if (defined(invoker.args)) { | 512 if (defined(invoker.args)) { |
| 376 args += invoker.args | 513 args += invoker.args |
| 377 } | 514 } |
| 378 } | 515 } |
| 379 } | 516 } |
| OLD | NEW |