Skip to content

Commit

Permalink
Replace most uses of asset_location with android_assets() template
Browse files Browse the repository at this point in the history
Using the android_assets() template enables the removal of duplicated asset copying logic.

BUG=547162

Review URL: https://codereview.chromium.org/1421473010

Cr-Commit-Position: refs/heads/master@{#359059}
  • Loading branch information
pkotwicz authored and Commit bot committed Nov 11, 2015
1 parent fc14444 commit 8c7027d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 101 deletions.
21 changes: 6 additions & 15 deletions chrome/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -347,26 +347,17 @@ android_resources("chrome_public_apk_resources") {
]
}

copy_ex("chrome_public_apk_assets") {
clear_dir = true
dest = "$root_build_dir/chrome_public_apk_assets"
android_assets("chrome_public_apk_assets") {
sources = chrome_android_paks_gypi.chrome_android_pak_input_resources
if (icu_use_data_file) {
sources += [ "$root_build_dir/icudtl.dat" ]
}
sources += [ "$root_build_dir/resources.pak" ]
disable_compression = true

deps = [
"//chrome:packed_extra_resources",
"//chrome:packed_resources",
"//third_party/icu:icudata",
"//third_party/icu:icu_assets",
"//v8:v8_external_startup_data_assets",
]

if (v8_use_external_startup_data) {
renaming_sources = v8_external_startup_data_renaming_sources
renaming_destinations = v8_external_startup_data_renaming_destinations
deps += [ "//v8" ]
}

sources += [ "$root_build_dir/resources.pak" ]
}

# GYP: //chrome/android/chrome_apk.gyp:chrome_apk_manifest
Expand Down
1 change: 0 additions & 1 deletion chrome/android/chrome_public_apk_tmpl.gni
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ template("chrome_public_apk_tmpl") {
forward_variables_from(invoker, "*")

android_apk(target_name) {
asset_location = "$root_build_dir/chrome_public_apk_assets"
_native_lib_file =
rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
Expand Down
20 changes: 4 additions & 16 deletions chrome/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1618,10 +1618,11 @@ test("unit_tests") {

android_manifest =
"//chrome/test/android/unit_tests_apk/AndroidManifest.xml"
apk_asset_location = "$root_out_dir/unit_tests_apk/assets"
apk_deps = [ ":unit_tests_java" ]
apk_deps = [
":unit_tests_java",
"//v8:v8_external_startup_data_assets",
]
isolate_file = "../unit_tests.isolate"
deps += [ ":copy_unit_tests_apk_assets" ]

# Some android targets still depend on --gc-sections to link.
# TODO: remove --gc-sections for Debug builds (crbug.com/159847).
Expand Down Expand Up @@ -2198,19 +2199,6 @@ source_set("test_support_unit") {
}

if (is_android) {
copy_ex("copy_unit_tests_apk_assets") {
clear_dir = true
dest = "$root_out_dir/unit_tests_apk/assets"

if (v8_use_external_startup_data) {
renaming_sources = v8_external_startup_data_renaming_sources
renaming_destinations = v8_external_startup_data_renaming_destinations
deps = [
"//v8",
]
}
}

android_library("unit_tests_java") {
DEPRECATED_java_in_dir = "//chrome/test/android/unit_tests_apk/src"
deps = [
Expand Down
9 changes: 1 addition & 8 deletions content/content_unittests.isolate
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@
],
},
}],
['OS=="android"', {
'variables': {
'files': [
'<(PRODUCT_DIR)/content_shell/assets/content_shell.pak',
],
},
}],
['OS=="linux" or OS=="mac" or OS=="win"', {
['OS=="linux" or OS=="mac" or OS=="win" or OS=="android"', {
'variables': {
'files': [
'<(PRODUCT_DIR)/content_shell.pak',
Expand Down
24 changes: 6 additions & 18 deletions content/shell/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,16 @@ android_library("content_shell_apk_java") {
DEPRECATED_java_in_dir = "shell_apk/src"
}

content_shell_assets_dir = "$root_build_dir/content_shell/assets"
copy_ex("copy_content_shell_assets") {
clear_dir = true
dest = content_shell_assets_dir
android_assets("content_shell_assets") {
sources = [
"$root_out_dir/content_shell.pak",
]
disable_compression = true
deps = [
"//content/shell:pak",
"//third_party/icu:icu_assets",
"//v8:v8_external_startup_data_assets",
]

if (icu_use_data_file) {
sources += [ "$root_build_dir/icudtl.dat" ]
deps += [ "//third_party/icu:icudata" ]
}
if (v8_use_external_startup_data) {
renaming_sources = v8_external_startup_data_renaming_sources
renaming_destinations = v8_external_startup_data_renaming_destinations
deps += [ "//v8" ]
}
}

android_apk("content_shell_apk") {
Expand All @@ -116,9 +106,9 @@ android_apk("content_shell_apk") {
deps = [
":content_shell_apk_java",
":content_shell_apk_resources",
":content_shell_assets",
":content_shell_java",
":content_shell_manifest",
":copy_content_shell_assets",
":libcontent_shell_content_view",
"//base:base_java",
"//content/public/android:content_java",
Expand All @@ -131,7 +121,6 @@ android_apk("content_shell_apk") {
apk_name = "ContentShell"
android_manifest = content_shell_manifest
native_libs = [ "libcontent_shell_content_view.so" ]
asset_location = content_shell_assets_dir

# TODO(GYP)
#'extra_native_libs': ['<(SHARED_LIB_DIR)/libosmesa.so'],
Expand Down Expand Up @@ -190,16 +179,15 @@ if (current_cpu != "x64") {
testonly = true
deps = [
":chromium_linker_test_manifest",
":content_shell_assets",
":content_shell_java",
":copy_content_shell_assets",
":linker_resources",
":linker_test",
"//base:base_java",
"//content/public/android:content_java",
"//ui/android:ui_java",
]
android_manifest = chromium_linker_test_manifest
asset_location = content_shell_assets_dir
apk_name = "ChromiumLinkerTest"
DEPRECATED_java_in_dir = "linker_test_apk/src"
native_libs = [ "liblinker_test.so" ]
Expand Down
24 changes: 2 additions & 22 deletions content/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ source_set("test_support") {

if (is_android) {
deps += [
"//content/shell/android:copy_content_shell_assets",
"//ui/android",
"//ui/shell_dialogs",
]
Expand Down Expand Up @@ -483,23 +482,6 @@ test("content_browsertests") {
}
}

if (is_android) {
_content_unittests_apk_assets_dir =
"$root_out_dir/content_unittests_apk/assets"
copy_ex("copy_content_unittests_apk_assets") {
clear_dir = true
dest = _content_unittests_apk_assets_dir

if (v8_use_external_startup_data) {
renaming_sources = v8_external_startup_data_renaming_sources
renaming_destinations = v8_external_startup_data_renaming_destinations
deps = [
"//v8",
]
}
}
}

# TODO(GYP): Delete this after we've converted everything to GN.
# The _run targets exist only for compatibility w/ GYP.
group("content_unittests_run") {
Expand Down Expand Up @@ -686,12 +668,11 @@ test("content_unittests") {
"../browser/webui/url_data_manager_backend_unittest.cc",
]
deps -= [ "//device/battery" ]
deps += [ ":copy_content_unittests_apk_assets" ]

apk_asset_location = _content_unittests_apk_assets_dir
apk_deps = [
"//base:base_java_unittest_support",
"//content/public/android:content_java",
"//v8:v8_external_startup_data_assets",
]

defines += [ "APPCACHE_USE_SIMPLE_CACHE" ]
Expand Down Expand Up @@ -812,9 +793,8 @@ test("content_gl_tests") {
if (is_android) {
apk_deps = [
"//content/public/test/android:content_java_test_support",
"//content/shell/android:copy_content_shell_assets",
"//content/shell/android:content_shell_assets",
]
apk_asset_location = "$root_build_dir/content_shell/assets"
} else {
data_deps = [
"//third_party/ffmpeg",
Expand Down
18 changes: 1 addition & 17 deletions net/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1208,21 +1208,6 @@ if (is_android) {
]
jni_package = "net/test"
}

_net_unittests_apk_assets_dir = "$root_out_dir/net_unittests_apk/assets"

copy_ex("copy_net_unittests_apk_assets") {
clear_dir = true
dest = _net_unittests_apk_assets_dir

if (v8_use_external_startup_data) {
renaming_sources = v8_external_startup_data_renaming_sources
renaming_destinations = v8_external_startup_data_renaming_destinations
deps = [
"//v8",
]
}
}
}

if (is_android || is_linux) {
Expand Down Expand Up @@ -1616,7 +1601,7 @@ test("net_unittests") {
"//net/android:net_javatests",
"//net/android:net_java_test_support",
"//net/android:net_unittests_apk_resources",
":copy_net_unittests_apk_assets",
"//v8:v8_external_startup_data_assets",
]
android_manifest = "//net/android/unittest_support/AndroidManifest.xml"
sources -= [
Expand All @@ -1633,7 +1618,6 @@ test("net_unittests") {
set_sources_assignment_filter([])
sources += [ "base/address_tracker_linux_unittest.cc" ]
set_sources_assignment_filter(sources_assignment_filter)
apk_asset_location = _net_unittests_apk_assets_dir
isolate_file = "net_unittests.isolate"
}

Expand Down
3 changes: 1 addition & 2 deletions third_party/WebKit/Source/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,9 @@ test("heap_unittests") {
if (is_android) {
apk_deps = [
"//base:base_java",
"//content/shell/android:copy_content_shell_assets",
"//content/shell/android:content_shell_assets",
"//net/android:net_java",
]
apk_asset_location = "$root_build_dir/content_shell/assets"
}
}

Expand Down
3 changes: 1 addition & 2 deletions third_party/WebKit/Source/web/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ test("webkit_unit_tests") {
if (is_android) {
apk_deps = [
"//base:base_java",
"//content/shell/android:content_shell_assets",
"//net/android:net_java",
"//content/shell/android:copy_content_shell_assets",
]
apk_asset_location = "$root_build_dir/content_shell/assets"
}
}

0 comments on commit 8c7027d

Please sign in to comment.