Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Unified Diff: build/config/android/internal_rules.gni

Issue 1418243003: Add GN template for android_assets(). Use it in content_shell_apk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments & two-pass _AddAssets Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/internal_rules.gni
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index 1a1a75266252ef7dd00e5637914ac6cbbfb3b30e..32470f6bad8dcf6a43d8e9490abc341ecd84c99d 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -242,7 +242,8 @@ template("write_build_config") {
build_config = invoker.build_config
assert(type == "android_apk" || type == "java_library" ||
- type == "android_resources" || type == "deps_dex")
+ type == "android_resources" || type == "deps_dex" ||
+ type == "android_assets")
action(target_name) {
deps = []
@@ -283,15 +284,18 @@ template("write_build_config") {
is_java_library = type == "java_library"
is_apk = type == "android_apk"
+ is_android_assets = type == "android_assets"
is_android_resources = type == "android_resources"
is_deps_dex = type == "deps_dex"
- supports_android = is_apk || is_android_resources || is_deps_dex ||
- (is_java_library && defined(invoker.supports_android) &&
- invoker.supports_android)
- requires_android = is_apk || is_android_resources || is_deps_dex ||
- (is_java_library && defined(invoker.requires_android) &&
- invoker.requires_android)
+ supports_android =
+ is_apk || is_android_assets || is_android_resources || is_deps_dex ||
+ (is_java_library && defined(invoker.supports_android) &&
+ invoker.supports_android)
+ requires_android =
+ is_apk || is_android_assets || is_android_resources || is_deps_dex ||
+ (is_java_library && defined(invoker.requires_android) &&
+ invoker.requires_android)
assert(!requires_android || supports_android,
"requires_android requires" + " supports_android")
@@ -339,6 +343,27 @@ template("write_build_config") {
]
}
+ if (is_android_assets) {
+ if (defined(invoker.asset_sources)) {
+ inputs += invoker.asset_sources
+ _rebased_asset_sources =
+ rebase_path(invoker.asset_sources, root_build_dir)
+ args += [ "--asset-sources=$_rebased_asset_sources" ]
+ }
+ if (defined(invoker.asset_renaming_sources)) {
+ inputs += invoker.asset_renaming_sources
+ _rebased_asset_renaming_sources =
+ rebase_path(invoker.asset_renaming_sources, root_build_dir)
+ args += [ "--asset-renaming-sources=$_rebased_asset_renaming_sources" ]
+
+ # These are zip paths, so no need to rebase.
+ args += [ "--asset-renaming-destinations=${invoker.asset_renaming_destinations}" ]
+ }
+ if (defined(invoker.disable_compression) && invoker.disable_compression) {
+ args += [ "--disable-asset-compression" ]
+ }
+ }
+
if (is_android_resources || is_apk) {
assert(defined(invoker.resources_zip))
args += [
@@ -480,6 +505,8 @@ template("process_java_prebuilt") {
# Creates an unsigned .apk.
#
# Variables
+# assets_build_config: Path to android_apk .build_config containing merged
+# asset information.
# deps: Specifies the dependencies of this target.
# dex_path: Path to classes.dex file to include (optional).
# resource_packaged_apk_path: Path to .ap_ to use.
@@ -525,6 +552,15 @@ template("package_apk") {
"--resource-apk=$_rebased_resource_packaged_apk_path",
"--output-apk=$_rebased_packaged_apk_path",
]
+ if (defined(invoker.assets_build_config)) {
+ inputs += [ invoker.assets_build_config ]
+ _rebased_build_config =
+ rebase_path(invoker.assets_build_config, root_build_dir)
+ args += [
+ "--assets=@FileArg($_rebased_build_config:assets)",
+ "--uncompressed-assets=@FileArg($_rebased_build_config:uncompressed_assets)",
+ ]
+ }
if (defined(invoker.dex_path)) {
_rebased_dex_path = rebase_path(invoker.dex_path, root_build_dir)
args += [ "--dex-file=$_rebased_dex_path" ]
@@ -636,6 +672,8 @@ template("create_apk") {
_incremental_deps = invoker.incremental_deps
}
+ # TODO(agrieve): Remove support for asset_location in favor of using
+ # android_assets() everywhere (http://crbug.com/547162).
if (defined(invoker.asset_location)) {
_asset_location = invoker.asset_location
assert(_asset_location != "") # Mark as used.
@@ -802,7 +840,11 @@ template("create_apk") {
package_target = "${target_name}__package"
package_apk(package_target) {
- forward_variables_from(invoker, [ "native_libs_dir" ])
+ forward_variables_from(invoker,
+ [
+ "assets_build_config",
+ "native_libs_dir",
+ ])
deps = _deps + [ ":${_package_resources_target_name}" ]
if (defined(_dex_path)) {
@@ -815,6 +857,7 @@ template("create_apk") {
_incremental_package_target = "${target_name}_incremental__package"
package_apk(_incremental_package_target) {
+ forward_variables_from(invoker, [ "assets_build_config" ])
_dex_target = "//build/android/incremental_install:bootstrap_java__dex"
deps = _incremental_deps + [
":${_incremental_package_resources_target_name}",
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698