Skip to content

Commit

Permalink
Remove cludge preventing .so being runtime dep of resource_whitelist.
Browse files Browse the repository at this point in the history
Revert https://chromium-review.googlesource.com/c/586469
Fixed in GN https://chromium-review.googlesource.com/c/584832

Bug: 748113
Change-Id: Ie0fc0ceaaed017f8ee86ff223617cecf0a4296d5
Reviewed-on: https://chromium-review.googlesource.com/616280
Commit-Queue: Grigoriy Kraynov <kraynov@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#494667}
  • Loading branch information
Greg Kraynov authored and Commit Bot committed Aug 16, 2017
1 parent 49124ac commit 276a02c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 55 deletions.
48 changes: 20 additions & 28 deletions chrome/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ chrome_sync_shell_jinja_variables =
app_hooks_impl = "java/src/org/chromium/chrome/browser/AppHooksImpl.java"

if (enable_resource_whitelist_generation) {
# Path cannot depend on cur_toolchain.
monochrome_resource_whitelist =
"$root_build_dir/monochrome_resource_whitelist.txt"
"$target_gen_dir/monochrome_resource_whitelist.txt"
system_webview_locale_resource_id_list =
"$target_gen_dir/system_webview_locale_resource_id_list.txt"
monochrome_locale_whitelist =
Expand Down Expand Up @@ -718,30 +717,6 @@ shared_library("chrome") {
public_configs = extra_chrome_shared_library_configs
}

# For why we defined the whitelist target in $fat_lib_toolchain rather than
# just using :monochrome($fat_lib_toolchain) as a dep, see crbug.com/749003.
if (enable_resource_whitelist_generation) {
if (!android_64bit_target_cpu) {
fat_lib_toolchain = current_toolchain
} else {
fat_lib_toolchain = android_secondary_abi_toolchain
}

# Always use the 32-bit library's whitelist since the 64-bit one is
# webview-only.
if (current_toolchain == fat_lib_toolchain) {
generate_resource_whitelist("monochrome_resource_whitelist") {
deps = [
":monochrome",
]

input = get_label_info(deps[0], "root_out_dir") +
"/libmonochrome$shlib_extension.whitelist"
output = monochrome_resource_whitelist
}
}
}

# Ensure that .pak files are built only once (build them in the default
# toolchain). The central header file calling JNI registration functions
# is generated from Java code so it just needs to be generated once.
Expand All @@ -760,6 +735,23 @@ if (current_toolchain == default_toolchain) {
}

if (enable_resource_whitelist_generation) {
generate_resource_whitelist("monochrome_resource_whitelist") {
# Always use the 32-bit library's whitelist since the 64-bit one is
# webview-only.
if (!android_64bit_target_cpu) {
_fat_lib_toolchain = current_toolchain
} else {
_fat_lib_toolchain = android_secondary_abi_toolchain
}
deps = [
":monochrome($_fat_lib_toolchain)",
]

input = get_label_info(deps[0], "root_out_dir") +
"/libmonochrome$shlib_extension.whitelist"
output = monochrome_resource_whitelist
}

# Use custom resource ID list instead of android_webview's compiler
# resource whitelist because //android_webview: generate_webui_resources
# and //android_webview: generate_components_resources use hand-written
Expand Down Expand Up @@ -803,7 +795,7 @@ if (current_toolchain == default_toolchain) {
]

deps = [
":monochrome_resource_whitelist($fat_lib_toolchain)",
":monochrome_resource_whitelist",
":system_webview_locale_resource_id_list",
"//android_webview:system_webview_pak_whitelist",
]
Expand All @@ -829,7 +821,7 @@ if (current_toolchain == default_toolchain) {

if (enable_resource_whitelist_generation) {
repack_whitelist = monochrome_resource_whitelist
deps += [ ":monochrome_resource_whitelist($fat_lib_toolchain)" ]
deps += [ ":monochrome_resource_whitelist" ]
locale_whitelist = monochrome_locale_whitelist
deps += [ ":monochrome_locale_whitelist" ]
}
Expand Down
7 changes: 0 additions & 7 deletions tools/resources/dummy.c

This file was deleted.

25 changes: 5 additions & 20 deletions tools/resources/generate_resource_whitelist.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,17 @@
# output = "$target_gen_dir/pak_whitelist.txt"
# }
template("generate_resource_whitelist") {
# Wrap the shared_library in an executable so that it does not get added
# as a data_dep.
# TODO(crbug/748113): Remove once GN has a way to specify compile-only deps.
_deps = invoker.deps
_toolchain = get_label_info(_deps[0], "toolchain")
assert(current_toolchain == _toolchain,
"See crbug.com/748113, crbug.com/749003 for context")
executable("${target_name}__exec") {
forward_variables_from(invoker, [ "deps" ])
sources = [
"//tools/resources/dummy.c",
]

# dummy.c should be built without -finstrument-functions (crbug.com/750120).
configs -= [ "//build/config/android:default_cygprofile_instrumentation" ]
configs += [ "//build/config/android:no_cygprofile_instrumentation" ]
}
action(target_name) {
deps = [
":${target_name}__exec($_toolchain)",
]
forward_variables_from(invoker, [ "deps" ])
assert(is_android,
"Resource whitelist currently implemented only on Android")

script = "//tools/resources/generate_resource_whitelist.py"

inputs = [
invoker.input,
]

outputs = [
invoker.output,
]
Expand Down

0 comments on commit 276a02c

Please sign in to comment.