Commit 50f3c4a3 authored by Mirko Bonadei's avatar Mirko Bonadei Committed by Commit Bot

Restrict absl_source_set visibility in favor of the component.

Since the absl component build has landed, this CL restricts access
to the absl source_sets in favor of a direct dependency on the
component target.

For now there is an allowlist but based on the outcome of
https://groups.google.com/a/chromium.org/forum/#!topic/cxx/cNZPHgfhNP4
it might be lifted.

Bug: 1046390
Change-Id: I171ff8352e10241ca5dd3703d15e189a5ff534b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2260532
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782940}
parent df10e490
......@@ -8,6 +8,7 @@
import("//build/toolchain/toolchain.gni")
import("//testing/test.gni")
import("//third_party/abseil-cpp/absl.gni")
config("absl_component_build") {
defines = [ "ABSL_CONSUME_DLL" ]
......@@ -62,6 +63,14 @@ component("absl") {
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/abseil-cpp/absl/types:variant",
]
# Usage of Abseil in Chromium is guarded by an explicit opt-in list, before
# adding projects to this list please reach out to cxx@chromium.org and CC:
# - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS
#
# More information can be found at:
# https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
visibility = absl_visibility
}
group("default") {
......
......@@ -30,25 +30,24 @@ import("//build_overrides/build.gni")
# https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
declare_args() {
# Additional targets that can depend on absl.
# ** DISCLAIMER **
#
# Using "additional_absl_clients" is highly discouraged because it will break
# the component build since Abseil doesn't have export annotations and WebRTC
# is already depending on it. Any CL that use "additional_absl_clients" will
# have a really high probability of being reverted.
additional_absl_clients = []
}
assert(!is_component_build || additional_absl_clients == [])
_chromium_absl_clients = [
"//libassistant/*",
"//third_party/webrtc/*",
"//third_party/abseil-cpp/*",
"//third_party/blink/renderer/modules/peerconnection",
"//third_party/blink/renderer/platform",
"//third_party/googletest:gtest",
"//third_party/shell-encryption/*",
"//third_party/openscreen/src/third_party/abseil/*",
"//third_party/private_membership/*",
"//third_party/shell-encryption/*",
"//third_party/webrtc/*",
]
# When adding a new package to `absl_visibility`, please check that all the
# Abseil dependencies that are required are listed in the dependencies of
# //third_party/abseil-cpp:absl. If not, please add them and run:
# //third_party/abseil-cpp/generate_def_file.py.
absl_visibility = _chromium_absl_clients + additional_absl_clients
template("absl_source_set") {
......@@ -73,15 +72,22 @@ template("absl_source_set") {
}
public_configs += [ "//third_party/abseil-cpp:absl_include_config" ]
# Usage of Abseil in Chromium is guarded by an explicit opt-in list, before
# adding projects to this list please reach out to cxx@chromium.org and CC:
# - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS
#
# More information can be found at:
# https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
if (!defined(visibility)) {
if (build_with_chromium) {
visibility = absl_visibility
visibility = [
"//third_party/abseil-cpp/*",
# WebRTC binary to run PSNR and SSIM video quality analysis. It
# statically links absl and it is used by "browser_tests" when
# is_component_build=false but it cannot depend on the absl
# component because it uses absl/flags.
"//third_party/webrtc/rtc_tools:frame_analyzer",
# WebRTC binaries used by //:chromium_builder_asan, they both
# statically link absl (because they depend on absl/flags) and are
# used by Chromium only when is_component_build=false.
"//third_party/webrtc/rtc_tools:rtp_generator",
"//third_party/webrtc/rtc_tools:video_replay",
]
} else {
visibility = [ "*" ]
}
......
......@@ -10,15 +10,13 @@ absl_source_set("atomic_hook") {
":config",
":core_headers",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("errno_saver") {
public = [ "internal/errno_saver.h" ]
deps = [ ":config" ]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("log_severity") {
......@@ -39,8 +37,7 @@ absl_source_set("raw_logging_internal") {
":core_headers",
":log_severity",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("spinlock_wait") {
......@@ -57,8 +54,7 @@ absl_source_set("spinlock_wait") {
":core_headers",
":errno_saver",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/base:*" ]
visibility = [ "//third_party/abseil-cpp/absl/base:*" ]
}
absl_source_set("config") {
......@@ -75,7 +71,6 @@ absl_source_set("dynamic_annotations") {
# Abseil's dynamic annotations are only visible inside Abseil because
# their usage is deprecated in Chromium (see README.chromium for more info).
visibility = []
visibility = [ "//third_party/abseil-cpp/absl/*" ]
deps = [ ":config" ]
}
......@@ -120,8 +115,7 @@ absl_source_set("base_internal") {
":config",
"//third_party/abseil-cpp/absl/meta:type_traits",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("base") {
......@@ -168,22 +162,19 @@ absl_source_set("throw_delegate") {
":config",
":raw_logging_internal",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("exception_testing") {
testonly = true
public = [ "internal/exception_testing.h" ]
deps = [ ":config" ]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("pretty_function") {
public = [ "internal/pretty_function.h" ]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
# TODO(mbonadei): This target throws by design. We should probably
......@@ -242,8 +233,7 @@ absl_source_set("bits") {
":config",
":core_headers",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("exponential_biased") {
......@@ -253,8 +243,7 @@ absl_source_set("exponential_biased") {
":config",
":core_headers",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("periodic_sampler") {
......@@ -274,8 +263,7 @@ absl_source_set("scoped_set_env") {
":config",
":raw_logging_internal",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("strerror") {
......@@ -286,15 +274,13 @@ absl_source_set("strerror") {
":core_headers",
":errno_saver",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("fast_type_id") {
public = [ "internal/fast_type_id.h" ]
deps = [ ":config" ]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("config_test") {
......
......@@ -47,8 +47,7 @@ absl_source_set("counting_allocator") {
testonly = true
public = [ "internal/counting_allocator.h" ]
deps = [ "//third_party/abseil-cpp/absl/base:config" ]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("test_instance_tracker") {
......@@ -56,8 +55,7 @@ absl_source_set("test_instance_tracker") {
sources = [ "internal/test_instance_tracker.cc" ]
public = [ "internal/test_instance_tracker.h" ]
deps = [ "//third_party/abseil-cpp/absl/types:compare" ]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("flat_hash_map") {
......@@ -196,8 +194,7 @@ absl_source_set("raw_hash_map") {
absl_source_set("have_sse") {
public = [ "internal/have_sse.h" ]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("common") {
......
......@@ -58,8 +58,7 @@ absl_source_set("symbolize") {
absl_source_set("examine_stack") {
sources = [ "internal/examine_stack.cc" ]
public = [ "internal/examine_stack.h" ]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
deps = [
":stacktrace",
":symbolize",
......@@ -137,8 +136,7 @@ if (is_lsan) {
testonly = true
sources = [ "leak_check.cc" ]
public = [ "leak_check.h" ]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
deps = [ "//third_party/abseil-cpp/absl/base:config" ]
}
} else {
......@@ -146,8 +144,7 @@ if (is_lsan) {
testonly = true
sources = [ "leak_check.cc" ]
public = [ "leak_check.h" ]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
deps = [ "//third_party/abseil-cpp/absl/base:config" ]
}
}
......@@ -161,6 +158,5 @@ absl_source_set("stack_consumption") {
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/base:raw_logging_internal",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
......@@ -16,8 +16,7 @@ absl_source_set("path_util") {
"//third_party/abseil-cpp/absl/base:config",
"//third_party/abseil-cpp/absl/strings",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("program_name") {
......@@ -31,8 +30,7 @@ absl_source_set("program_name") {
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/synchronization",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("config") {
......@@ -72,8 +70,7 @@ absl_source_set("commandlineflag_internal") {
"//third_party/abseil-cpp/absl/base:config",
"//third_party/abseil-cpp/absl/base:fast_type_id",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("commandlineflag") {
......@@ -99,8 +96,7 @@ absl_source_set("private_handle_accessor") {
"//third_party/abseil-cpp/absl/base:config",
"//third_party/abseil-cpp/absl/strings",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("reflection") {
......@@ -141,8 +137,7 @@ absl_source_set("flag_internal") {
"//third_party/abseil-cpp/absl/synchronization",
"//third_party/abseil-cpp/absl/utility",
]
visibility = []
visibility += [
visibility = [
":*",
"//third_party/abseil-cpp/absl/base/*",
]
......@@ -183,8 +178,7 @@ absl_source_set("usage_internal") {
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/strings",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("usage") {
......
......@@ -5,19 +5,6 @@
import("//build_overrides/build.gni")
import("//third_party/abseil-cpp/absl.gni")
# Usage of Abseil in Chromium is guarded by an explicit opt-in list, before
# adding projects to this list please reach out to cxx@chromium.org and CC:
# - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS
#
# More information can be found at:
# https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
if (build_with_chromium) {
default_visibility = absl_visibility
default_visibility += [ "//third_party/openscreen/*" ]
} else {
default_visibility = [ "*" ]
}
absl_source_set("hash") {
sources = [
"internal/hash.cc",
......@@ -36,7 +23,6 @@ absl_source_set("hash") {
"//third_party/abseil-cpp/absl/types:variant",
"//third_party/abseil-cpp/absl/utility",
]
visibility = default_visibility
}
absl_source_set("hash_testing") {
......@@ -59,8 +45,7 @@ absl_source_set("spy_hash_state") {
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/strings:str_format",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("city") {
......
......@@ -5,19 +5,6 @@
import("//build_overrides/build.gni")
import("//third_party/abseil-cpp/absl.gni")
# Usage of Abseil in Chromium is guarded by an explicit opt-in list, before
# adding projects to this list please reach out to cxx@chromium.org and CC:
# - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS
#
# More information can be found at:
# https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
if (build_with_chromium) {
default_visibility = absl_visibility
default_visibility += [ "//third_party/openscreen/*" ]
} else {
default_visibility = [ "*" ]
}
absl_source_set("strings") {
sources = [
"ascii.cc",
......@@ -67,7 +54,6 @@ absl_source_set("strings") {
"//third_party/abseil-cpp/absl/meta:type_traits",
"//third_party/abseil-cpp/absl/numeric:int128",
]
visibility = default_visibility
}
absl_source_set("internal") {
......@@ -115,8 +101,7 @@ absl_source_set("str_format_internal") {
"internal/str_format/output.h",
"internal/str_format/parser.h",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
deps = [
":strings",
"//third_party/abseil-cpp/absl/base:bits",
......@@ -132,8 +117,7 @@ absl_source_set("str_format_internal") {
absl_source_set("cord_internal") {
public = [ "internal/cord_internal.h" ]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
deps = [
":strings",
"//third_party/abseil-cpp/absl/meta:type_traits",
......@@ -171,8 +155,7 @@ absl_source_set("pow10_helper") {
testonly = true
sources = [ "internal/pow10_helper.cc" ]
public = [ "internal/pow10_helper.h" ]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
deps = [ "//third_party/abseil-cpp/absl/base:config" ]
}
......
......@@ -15,8 +15,7 @@ absl_source_set("graphcycles_internal") {
"//third_party/abseil-cpp/absl/base:malloc_internal",
"//third_party/abseil-cpp/absl/base:raw_logging_internal",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("kernel_timeout_internal") {
......@@ -26,8 +25,7 @@ absl_source_set("kernel_timeout_internal") {
"//third_party/abseil-cpp/absl/base:raw_logging_internal",
"//third_party/abseil-cpp/absl/time",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("synchronization") {
......@@ -74,8 +72,7 @@ absl_source_set("thread_pool") {
":synchronization",
"//third_party/abseil-cpp/absl/base:core_headers",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/*" ]
visibility = [ "//third_party/abseil-cpp/absl/*" ]
}
absl_source_set("per_thread_sem_test_common") {
......
......@@ -44,6 +44,5 @@ absl_source_set("test_util") {
"//third_party/googletest:gtest",
"//third_party/googletest:gmock",
]
visibility = []
visibility += [ "//third_party/abseil-cpp/absl/time:*" ]
visibility = [ "//third_party/abseil-cpp/absl/time:*" ]
}
......@@ -5,23 +5,6 @@
import("//build_overrides/build.gni")
import("//third_party/abseil-cpp/absl.gni")
# Usage of Abseil in Chromium is guarded by an explicit opt-in list, before
# adding projects to this list please reach out to cxx@chromium.org and CC:
# - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS
#
# More information can be found at:
# https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU
if (build_with_chromium) {
default_visibility = absl_visibility
default_visibility += [
"//third_party/blink/renderer/platform:platform",
"//third_party/blink/renderer/modules/peerconnection:peerconnection",
"//third_party/openscreen/*",
]
} else {
default_visibility = [ "*" ]
}
absl_source_set("any") {
public = [ "any.h" ]
deps = [
......@@ -49,8 +32,7 @@ absl_source_set("bad_any_cast_impl") {
"//third_party/abseil-cpp/absl/base:config",
"//third_party/abseil-cpp/absl/base:raw_logging_internal",
]
visibility = []
visibility += [ ":*" ]
visibility = [ ":*" ]
}
absl_source_set("span") {
......@@ -76,7 +58,6 @@ absl_source_set("optional") {
"//third_party/abseil-cpp/absl/meta:type_traits",
"//third_party/abseil-cpp/absl/utility",
]
visibility = default_visibility
}
absl_source_set("bad_optional_access") {
......@@ -108,7 +89,6 @@ absl_source_set("variant") {
"//third_party/abseil-cpp/absl/meta:type_traits",
"//third_party/abseil-cpp/absl/utility",
]
visibility = default_visibility
}
absl_source_set("compare") {
......
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