Skip to content

Commit

Permalink
Reland: "Cludge to prevent .so from being a data_dep in resource_whit…
Browse files Browse the repository at this point in the history
…elist"

This reverts commit a207fe6.

Reason for reland: Now tested with monochrome_public
official build on arm64

Bug: 748113, 749003
Change-Id: I0f2aeaa27857ec0456a65395c02a2c466f3261ed
Reviewed-on: https://chromium-review.googlesource.com/586469
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489947}
  • Loading branch information
agrieve authored and Commit Bot committed Jul 27, 2017
1 parent 4ef5784 commit dde1afc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 deletions.
48 changes: 28 additions & 20 deletions chrome/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ 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 =
"$target_gen_dir/monochrome_resource_whitelist.txt"
"$root_build_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 @@ -702,6 +703,30 @@ 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 @@ -720,23 +745,6 @@ 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 @@ -780,7 +788,7 @@ if (current_toolchain == default_toolchain) {
]

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

if (enable_resource_whitelist_generation) {
repack_whitelist = monochrome_resource_whitelist
deps += [ ":monochrome_resource_whitelist" ]
deps += [ ":monochrome_resource_whitelist($fat_lib_toolchain)" ]
locale_whitelist = monochrome_locale_whitelist
deps += [ ":monochrome_locale_whitelist" ]
}
Expand Down
7 changes: 7 additions & 0 deletions tools/resources/dummy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

int main(int argc, char** argv) {
return 0;
}
21 changes: 16 additions & 5 deletions tools/resources/generate_resource_whitelist.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,28 @@
# output = "$target_gen_dir/pak_whitelist.txt"
# }
template("generate_resource_whitelist") {
action(target_name) {
# 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",
]
}
action(target_name) {
deps = [
":${target_name}__exec($_toolchain)",
]
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 dde1afc

Please sign in to comment.