Commit 835f0bc3 authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

Code inclusion: whitelist -> allowlist for repack and related code

This renames "repack_whitelist" to "repack_allowlist" and swaps out
related code (ex. variables in chrome/ layer). The new term is
consistent with "enable_resource_allowlist_generation" and avoids
non-inclusive terminology.

Bug: 1097644
Test: autoninja -C out/Official monochrome_public_apk (official build)
Change-Id: I3e319c8b8bec9ab9df081b0b61ec02683d665af6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2399453Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805426}
parent 57f8b8cf
...@@ -699,7 +699,7 @@ webview_repack_locales("repack_locales") { ...@@ -699,7 +699,7 @@ webview_repack_locales("repack_locales") {
output_locales = locales output_locales = locales
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
repack_whitelist = system_webview_pak_allowlist repack_allowlist = system_webview_pak_allowlist
deps = [ ":system_webview_pak_allowlist" ] deps = [ ":system_webview_pak_allowlist" ]
} }
} }
...@@ -738,7 +738,7 @@ repack("repack_pack") { ...@@ -738,7 +738,7 @@ repack("repack_pack") {
output = "$target_gen_dir/resources.pak" output = "$target_gen_dir/resources.pak"
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
repack_whitelist = system_webview_pak_allowlist repack_allowlist = system_webview_pak_allowlist
deps += [ ":system_webview_pak_allowlist" ] deps += [ ":system_webview_pak_allowlist" ]
} }
...@@ -762,7 +762,7 @@ repack("repack_100_percent") { ...@@ -762,7 +762,7 @@ repack("repack_100_percent") {
output = "$target_gen_dir/chrome_100_percent.pak" output = "$target_gen_dir/chrome_100_percent.pak"
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
repack_whitelist = system_webview_pak_allowlist repack_allowlist = system_webview_pak_allowlist
deps += [ ":system_webview_pak_allowlist" ] deps += [ ":system_webview_pak_allowlist" ]
} }
if (webview_includes_weblayer) { if (webview_includes_weblayer) {
......
...@@ -1408,7 +1408,7 @@ if (!is_android) { ...@@ -1408,7 +1408,7 @@ if (!is_android) {
} }
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
repack_whitelist = chrome_resource_whitelist repack_allowlist = chrome_resource_whitelist
deps = [ "//chrome:resource_whitelist" ] deps = [ "//chrome:resource_whitelist" ]
} }
......
...@@ -1474,16 +1474,16 @@ template("libchrome_impl") { ...@@ -1474,16 +1474,16 @@ template("libchrome_impl") {
} }
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
libchrome_impl("libchrome_pak_whitelist_inputs") { libchrome_impl("libchrome_pak_allowlist_inputs") {
collect_inputs_only = true collect_inputs_only = true
} }
} }
libchrome_impl("libchrome") { libchrome_impl("libchrome") {
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
# Make sure whitelist_inputs is built first so when concurrent_links == 1 # Make sure allowlist_inputs is built first so when concurrent_links == 1
# it comes before the actual (very slow) link step. # it comes before the actual (very slow) link step.
deps = [ ":libchrome_pak_whitelist_inputs" ] deps = [ ":libchrome_pak_allowlist_inputs" ]
} }
} }
...@@ -1571,19 +1571,19 @@ if (current_toolchain == default_toolchain) { ...@@ -1571,19 +1571,19 @@ if (current_toolchain == default_toolchain) {
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
if (_is_trichrome || _is_monochrome) { if (_is_trichrome || _is_monochrome) {
_lib = "libmonochrome_pak_whitelist_inputs" _lib = "libmonochrome_pak_allowlist_inputs"
} else { } else {
_lib = "libchrome_pak_whitelist_inputs" _lib = "libchrome_pak_allowlist_inputs"
} }
_resource_whitelist_target = "${_variant}_resource_whitelist" _resource_allowlist_target = "${_variant}_resource_allowlist"
_resource_whitelist_file = _resource_allowlist_file =
"$target_gen_dir/${_variant}_resource_whitelist.txt" "$target_gen_dir/${_variant}_resource_allowlist.txt"
_lib_path = "/lib.unstripped/" + _lib + shlib_extension _lib_path = "/lib.unstripped/" + _lib + shlib_extension
generate_resource_allowlist(_resource_whitelist_target) { generate_resource_allowlist(_resource_allowlist_target) {
_fat_lib_toolchain = "" _fat_lib_toolchain = ""
if (_is_monochrome || _is_trichrome) { if (_is_monochrome || _is_trichrome) {
# Always use the 32-bit library's whitelist since the 64-bit one is # Always use the 32-bit library's allowlist since the 64-bit one is
# webview-only. # webview-only.
if (!android_64bit_target_cpu) { if (!android_64bit_target_cpu) {
_fat_lib_toolchain = current_toolchain _fat_lib_toolchain = current_toolchain
...@@ -1594,24 +1594,24 @@ if (current_toolchain == default_toolchain) { ...@@ -1594,24 +1594,24 @@ if (current_toolchain == default_toolchain) {
deps = [ ":${_lib}($_fat_lib_toolchain)" ] deps = [ ":${_lib}($_fat_lib_toolchain)" ]
inputs = [ get_label_info(deps[0], "root_out_dir") + _lib_path ] inputs = [ get_label_info(deps[0], "root_out_dir") + _lib_path ]
output = _resource_whitelist_file output = _resource_allowlist_file
} }
# Use custom resource ID list instead of android_webview's compiler # Use custom resource ID list instead of android_webview's compiler
# resource whitelist because //android_webview:generate_webui_resources # resource allowlist because //android_webview:generate_webui_resources
# and //android_webview:generate_components_resources use hand-written # and //android_webview:generate_components_resources use hand-written
# resource whitelists. # resource allowlists.
if (_is_monochrome) { if (_is_monochrome) {
_locale_whitelist_target = "${_variant}_locale_whitelist" _locale_allowlist_target = "${_variant}_locale_allowlist"
_locale_whitelist_file = _locale_allowlist_file =
"$target_gen_dir/${_variant}_locale_whitelist.txt" "$target_gen_dir/${_variant}_locale_allowlist.txt"
_system_webview_locale_whitelist_target = _system_webview_locale_allowlist_target =
"${_variant}_system_webview_locale_resource_whitelist" "${_variant}_system_webview_locale_resource_allowlist"
_system_webview_locale_whitelist_file = _system_webview_locale_allowlist_file =
"$target_gen_dir/" + "$target_gen_dir/" +
"${_variant}_system_webview_locale_resource_id_list.txt" "${_variant}_system_webview_locale_resource_id_list.txt"
action(_system_webview_locale_whitelist_target) { action(_system_webview_locale_allowlist_target) {
script = "//tools/grit/pak_util.py" script = "//tools/grit/pak_util.py"
_system_webview_en_US_locale_pak = _system_webview_en_US_locale_pak =
...@@ -1619,41 +1619,41 @@ if (current_toolchain == default_toolchain) { ...@@ -1619,41 +1619,41 @@ if (current_toolchain == default_toolchain) {
inputs = [ _system_webview_en_US_locale_pak ] inputs = [ _system_webview_en_US_locale_pak ]
outputs = [ _system_webview_locale_whitelist_file ] outputs = [ _system_webview_locale_allowlist_file ]
deps = [ "//android_webview:repack_locales" ] deps = [ "//android_webview:repack_locales" ]
args = [ args = [
"list-id", "list-id",
"--output", "--output",
rebase_path(_system_webview_locale_whitelist_file, root_build_dir), rebase_path(_system_webview_locale_allowlist_file, root_build_dir),
rebase_path(_system_webview_en_US_locale_pak, root_build_dir), rebase_path(_system_webview_en_US_locale_pak, root_build_dir),
] ]
} }
action(_locale_whitelist_target) { action(_locale_allowlist_target) {
script = "//tools/resources/filter_resource_whitelist.py" script = "//tools/resources/filter_resource_allowlist.py"
inputs = [ inputs = [
_resource_whitelist_file, _resource_allowlist_file,
_system_webview_locale_whitelist_file, _system_webview_locale_allowlist_file,
] ]
outputs = [ _locale_whitelist_file ] outputs = [ _locale_allowlist_file ]
deps = [ deps = [
":$_resource_whitelist_target", ":$_resource_allowlist_target",
":$_system_webview_locale_whitelist_target", ":$_system_webview_locale_allowlist_target",
"//android_webview:system_webview_pak_allowlist", "//android_webview:system_webview_pak_allowlist",
] ]
args = [ args = [
"--input", "--input",
rebase_path(_resource_whitelist_file, root_build_dir), rebase_path(_resource_allowlist_file, root_build_dir),
"--filter", "--filter",
rebase_path(_system_webview_locale_whitelist_file, root_build_dir), rebase_path(_system_webview_locale_allowlist_file, root_build_dir),
"--output", "--output",
rebase_path(_locale_whitelist_file, root_build_dir), rebase_path(_locale_allowlist_file, root_build_dir),
] ]
} }
} }
...@@ -1681,11 +1681,11 @@ if (current_toolchain == default_toolchain) { ...@@ -1681,11 +1681,11 @@ if (current_toolchain == default_toolchain) {
} }
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
repack_whitelist = _resource_whitelist_file repack_allowlist = _resource_allowlist_file
deps += [ ":${_resource_whitelist_target}" ] deps += [ ":${_resource_allowlist_target}" ]
if (_is_monochrome) { if (_is_monochrome) {
locale_whitelist = _locale_whitelist_file locale_allowlist = _locale_allowlist_file
deps += [ ":$_locale_whitelist_target" ] deps += [ ":$_locale_allowlist_target" ]
} }
} }
} }
...@@ -1734,7 +1734,7 @@ if (current_toolchain == default_toolchain) { ...@@ -1734,7 +1734,7 @@ if (current_toolchain == default_toolchain) {
} }
# Resource packaging varies with Monochrome and bundles because the pak # Resource packaging varies with Monochrome and bundles because the pak
# resource whitelist is derived from the native library. # resource allowlist is derived from the native library.
resource_packaging("chrome_apk_pak_assets") { resource_packaging("chrome_apk_pak_assets") {
is_monochrome = false is_monochrome = false
} }
...@@ -1790,15 +1790,15 @@ if (!android_64bit_target_cpu || ...@@ -1790,15 +1790,15 @@ if (!android_64bit_target_cpu ||
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
# Avoiding a real link for this step allows the actual libmonochrome to # Avoiding a real link for this step allows the actual libmonochrome to
# run at the same time as R8. # run at the same time as R8.
libmonochrome_apk_or_bundle_tmpl("libmonochrome_pak_whitelist_inputs") { libmonochrome_apk_or_bundle_tmpl("libmonochrome_pak_allowlist_inputs") {
collect_inputs_only = true collect_inputs_only = true
} }
} }
libmonochrome_apk_or_bundle_tmpl("libmonochrome") { libmonochrome_apk_or_bundle_tmpl("libmonochrome") {
if (enable_resource_allowlist_generation) { if (enable_resource_allowlist_generation) {
# Make sure whitelist_inputs is built first so when concurrent_links == 1 # Make sure allowlist_inputs is built first so when concurrent_links == 1
# it comes before the actual (very slow) link step. # it comes before the actual (very slow) link step.
deps = [ ":libmonochrome_pak_whitelist_inputs" ] deps = [ ":libmonochrome_pak_allowlist_inputs" ]
} }
} }
......
...@@ -25,7 +25,7 @@ template("chrome_repack_percent") { ...@@ -25,7 +25,7 @@ template("chrome_repack_percent") {
forward_variables_from(invoker, forward_variables_from(invoker,
[ [
"copy_data_to_bundle", "copy_data_to_bundle",
"repack_whitelist", "repack_allowlist",
"visibility", "visibility",
]) ])
...@@ -84,7 +84,7 @@ template("chrome_extra_paks") { ...@@ -84,7 +84,7 @@ template("chrome_extra_paks") {
forward_variables_from(invoker, forward_variables_from(invoker,
[ [
"copy_data_to_bundle", "copy_data_to_bundle",
"repack_whitelist", "repack_allowlist",
"visibility", "visibility",
]) ])
output = "${invoker.output_dir}/resources.pak" output = "${invoker.output_dir}/resources.pak"
...@@ -271,12 +271,12 @@ template("chrome_extra_paks") { ...@@ -271,12 +271,12 @@ template("chrome_extra_paks") {
# output_dir [required]: Directory to output .pak files. Locale .pak files # output_dir [required]: Directory to output .pak files. Locale .pak files
# will always be place in $output_dir/locales # will always be place in $output_dir/locales
# additional_extra_paks: List of extra .pak sources for resources.pak. # additional_extra_paks: List of extra .pak sources for resources.pak.
# locale_whitelist: if set, override repack_whitelist for locale .pak files. # locale_allowlist: if set, override repack_allowlist for locale .pak files.
# copy_data_to_bundle: # copy_data_to_bundle:
# deps: # deps:
# output_dir: # output_dir:
# public_deps: # public_deps:
# repack_whitelist: # repack_allowlist:
# visibility: # visibility:
# Normal meanings. # Normal meanings.
# #
...@@ -288,7 +288,7 @@ template("chrome_paks") { ...@@ -288,7 +288,7 @@ template("chrome_paks") {
"copy_data_to_bundle", "copy_data_to_bundle",
"deps", "deps",
"output_dir", "output_dir",
"repack_whitelist", "repack_allowlist",
"visibility", "visibility",
]) ])
} }
...@@ -301,7 +301,7 @@ template("chrome_paks") { ...@@ -301,7 +301,7 @@ template("chrome_paks") {
"copy_data_to_bundle", "copy_data_to_bundle",
"deps", "deps",
"output_dir", "output_dir",
"repack_whitelist", "repack_allowlist",
"visibility", "visibility",
]) ])
} }
...@@ -313,7 +313,7 @@ template("chrome_paks") { ...@@ -313,7 +313,7 @@ template("chrome_paks") {
"copy_data_to_bundle", "copy_data_to_bundle",
"deps", "deps",
"output_dir", "output_dir",
"repack_whitelist", "repack_allowlist",
"visibility", "visibility",
]) ])
if (defined(invoker.additional_extra_paks)) { if (defined(invoker.additional_extra_paks)) {
...@@ -328,10 +328,10 @@ template("chrome_paks") { ...@@ -328,10 +328,10 @@ template("chrome_paks") {
"deps", "deps",
"visibility", "visibility",
]) ])
if (defined(invoker.locale_whitelist)) { if (defined(invoker.locale_allowlist)) {
repack_whitelist = invoker.locale_whitelist repack_allowlist = invoker.locale_allowlist
} else if (defined(invoker.repack_whitelist)) { } else if (defined(invoker.repack_allowlist)) {
repack_whitelist = invoker.repack_whitelist repack_allowlist = invoker.repack_allowlist
} }
input_locales = locales input_locales = locales
......
...@@ -60,10 +60,10 @@ template("repack") { ...@@ -60,10 +60,10 @@ template("repack") {
] ]
args = [ "repack" ] args = [ "repack" ]
if (defined(invoker.repack_whitelist)) { if (defined(invoker.repack_allowlist)) {
inputs += [ invoker.repack_whitelist ] inputs += [ invoker.repack_allowlist ]
_rebased_whitelist = rebase_path(invoker.repack_whitelist) _rebased_allowlist = rebase_path(invoker.repack_allowlist)
args += [ "--allowlist=$_rebased_whitelist" ] args += [ "--allowlist=$_rebased_allowlist" ]
args += [ "--suppress-removed-key-output" ] args += [ "--suppress-removed-key-output" ]
} }
args += [ rebase_path(invoker.output, root_build_dir) ] args += [ rebase_path(invoker.output, root_build_dir) ]
...@@ -117,7 +117,7 @@ template("repack") { ...@@ -117,7 +117,7 @@ template("repack") {
# visibility [optional] # visibility [optional]
# testonly [optional] # testonly [optional]
# copy_data_to_bundle [optional] # copy_data_to_bundle [optional]
# repack_whitelist [optional] # repack_allowlist [optional]
# Normal meaning. # Normal meaning.
template("repack_locales") { template("repack_locales") {
if (defined(invoker.output_dir)) { if (defined(invoker.output_dir)) {
...@@ -152,7 +152,7 @@ template("repack_locales") { ...@@ -152,7 +152,7 @@ template("repack_locales") {
"bundle_output", "bundle_output",
"compress", "compress",
"deps", "deps",
"repack_whitelist", "repack_allowlist",
"testonly", "testonly",
]) ])
visibility = [ ":${invoker.target_name}" ] visibility = [ ":${invoker.target_name}" ]
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
"""filter_resource_whitelist.py [-h] [--input INPUT] [--filter FILTER] """filter_resource_allowlist.py [-h] [--input INPUT] [--filter FILTER]
[--output OUTPUT] [--output OUTPUT]
INPUT specifies a resource whitelist file containing resource IDs that should INPUT specifies a resource allowlist file containing resource IDs that should
be whitelisted, where each line of INPUT contains a single resource ID. be allowed, where each line of INPUT contains a single resource ID.
FILTER specifies a resource whitelist file containing resource IDs that should FILTER specifies a resource denylist file containing resource IDs that should
not be whitelisted, where each line of FILTER contains a single resource ID. not be allowed, where each line of FILTER contains a single resource ID.
Filters a resource whitelist by removing resource IDs that are contained in a Filters a resource allowlist by removing resource IDs that are contained in a
another resource whitelist. another resource allowlist.
This script is used to generate Monochrome's locale paks. This script is used to generate Monochrome's locale paks.
""" """
...@@ -26,11 +26,11 @@ def main(): ...@@ -26,11 +26,11 @@ def main():
parser = argparse.ArgumentParser(usage=__doc__) parser = argparse.ArgumentParser(usage=__doc__)
parser.add_argument( parser.add_argument(
'--input', type=argparse.FileType('r'), required=True, '--input', type=argparse.FileType('r'), required=True,
help='A resource whitelist where each line contains one resource ID. ' help='A resource allowlist where each line contains one resource ID. '
'These IDs, excluding the ones in FILTER, are to be included.') 'These IDs, excluding the ones in FILTER, are to be included.')
parser.add_argument( parser.add_argument(
'--filter', type=argparse.FileType('r'), required=True, '--filter', type=argparse.FileType('r'), required=True,
help='A resource whitelist where each line contains one resource ID. ' help='A resource allowlist where each line contains one resource ID. '
'These IDs are to be excluded.') 'These IDs are to be excluded.')
parser.add_argument( parser.add_argument(
'--output', type=argparse.FileType('w'), default=sys.stdout, '--output', type=argparse.FileType('w'), default=sys.stdout,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment