Add restrictive visibility to all targets in //pc

This CL sets all visibility to ":*" (this buildfile) where no users
outside this directory are known, and marks up publicly exported
targets and Chrome dependencies explicitly.

Bug: webrtc:13661
Change-Id: I9b2c304ea222f401d71a1ec86eb7a052051f0be3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251690
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36004}
This commit is contained in:
Harald Alvestrand 2022-02-15 12:45:02 +00:00 committed by WebRTC LUCI CQ
parent 1b083a998b
commit e47493b3c0
2 changed files with 71 additions and 25 deletions

View File

@ -12,6 +12,15 @@
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.
# Use of visibility = clauses:
# The default visibility for all rtc_ targets is equivalent to "//*", or
# "all targets in webrtc can depend on this, nothing outside can".
#
# When overriding, the choices are:
# - visibility = [ "*" ] - public. Stuff outside webrtc can use this.
# - visibility = [ ":*" ] - directory private.
# As a general guideline, only targets in api/ should have public visibility.
import("//build/config/linux/pkg_config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//third_party/google_benchmark/buildconfig.gni")

View File

@ -6,6 +6,30 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
# Visibility considerations:
#
# Most targets in this file should have visibility ":*", as they are only
# used internally.
# Some functions are cleared for wider webrtc usage; these have default
# visibility (set to "//*", not the gn default of "*").
# These are:
# - rtc_pc_base
# - rtc_pc
# - session_description
# - simulcast_description
# - peerconnection
# - sdp_utils
# - media_stream_observer
# - video_track_source
# - libjingle_peerconnection
#
# Some targets are depended on by external users for historical reasons,
# and are therefore marked with visibility "*". This is in the process
# of being removed.
#
# Some targets are only publicly visible in Chrome builds.
# These are marked up as such.
import("../webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
@ -24,6 +48,7 @@ config("rtc_pc_config") {
}
rtc_library("proxy") {
visibility = [ ":*" ]
sources = [
"proxy.cc",
"proxy.h",
@ -38,7 +63,8 @@ rtc_library("proxy") {
}
rtc_library("rtc_pc_base") {
visibility = [ "*" ]
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Used by Chromium and others
defines = []
sources = [
"channel.cc",
@ -176,9 +202,9 @@ rtc_library("rtc_pc_base") {
}
rtc_source_set("session_description") {
visibility = [ "*" ]
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Used by Chrome and others
sources = [
"session_description.cc",
"session_description.h",
@ -202,9 +228,6 @@ rtc_source_set("session_description") {
}
rtc_source_set("simulcast_description") {
visibility = [ "*" ]
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
sources = [
"simulcast_description.cc",
"simulcast_description.h",
@ -218,7 +241,9 @@ rtc_source_set("simulcast_description") {
}
rtc_source_set("rtc_pc") {
visibility = [ "*" ]
if (build_with_chromium) {
visibility = [ "*" ]
}
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
deps = [
":rtc_pc_base",
@ -227,6 +252,7 @@ rtc_source_set("rtc_pc") {
}
rtc_library("media_protocol_names") {
visibility = [ ":*" ]
sources = [
"media_protocol_names.cc",
"media_protocol_names.h",
@ -235,7 +261,8 @@ rtc_library("media_protocol_names") {
}
rtc_source_set("peerconnection") {
visibility = [ "*" ]
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Used by Chromium and others
cflags = []
sources = []
@ -374,6 +401,7 @@ rtc_source_set("peerconnection") {
}
rtc_library("sctp_data_channel") {
visibility = [ ":*" ]
sources = [
"sctp_data_channel.cc",
"sctp_data_channel.h",
@ -406,9 +434,9 @@ rtc_library("sctp_data_channel") {
}
rtc_library("data_channel_utils") {
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Known to be used externally
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
sources = [
"data_channel_utils.cc",
"data_channel_utils.h",
@ -421,6 +449,7 @@ rtc_library("data_channel_utils") {
}
rtc_library("connection_context") {
visibility = [ ":*" ]
sources = [
"connection_context.cc",
"connection_context.h",
@ -447,10 +476,6 @@ rtc_library("connection_context") {
]
}
# These empty targets are the future homes of files moved out of
# the peerconnection target. They are broken out so that other
# projects and modules can add dependencies as needed.
# TODO(bugs.webrtc.org/13634): Fill these targets with files.
rtc_source_set("data_channel_controller") {
visibility = [ ":*" ]
sources = [
@ -745,10 +770,6 @@ rtc_source_set("sdp_serializer") {
]
}
rtc_source_set("sdp_utils") {
visibility = [
":*",
"../test/pc/e2e:*",
]
sources = [
"sdp_utils.cc",
"sdp_utils.h",
@ -824,9 +845,9 @@ rtc_source_set("track_media_info_map") {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
rtc_source_set("webrtc_sdp") {
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Used by Chrome and more
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
sources = [
"jsep_ice_candidate.cc",
"jsep_session_description.cc",
@ -891,9 +912,9 @@ rtc_source_set("webrtc_session_description_factory") {
}
rtc_library("ice_server_parsing") {
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Known to be used externally
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
sources = [
"ice_server_parsing.cc",
"ice_server_parsing.h",
@ -913,10 +934,6 @@ rtc_library("ice_server_parsing") {
}
rtc_library("media_stream_observer") {
visibility = [
":*",
"../sdk/android:*",
]
sources = [
"media_stream_observer.cc",
"media_stream_observer.h",
@ -928,6 +945,7 @@ rtc_library("media_stream_observer") {
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
}
rtc_source_set("peer_connection_factory") {
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Known to be used externally
sources = [
"peer_connection_factory.cc",
@ -982,6 +1000,7 @@ rtc_source_set("peer_connection_factory") {
}
rtc_library("peer_connection_message_handler") {
visibility = [ ":*" ]
sources = [
"peer_connection_message_handler.cc",
"peer_connection_message_handler.h",
@ -1000,6 +1019,7 @@ rtc_library("peer_connection_message_handler") {
}
rtc_library("usage_pattern") {
visibility = [ ":*" ]
sources = [
"usage_pattern.cc",
"usage_pattern.h",
@ -1012,6 +1032,7 @@ rtc_library("usage_pattern") {
}
rtc_library("rtp_transceiver") {
visibility = [ ":*" ]
sources = [
"rtp_transceiver.cc",
"rtp_transceiver.h",
@ -1049,6 +1070,7 @@ rtc_library("rtp_transceiver") {
}
rtc_library("rtp_transmission_manager") {
visibility = [ ":*" ]
sources = [
"rtp_transmission_manager.cc",
"rtp_transmission_manager.h",
@ -1085,6 +1107,7 @@ rtc_library("rtp_transmission_manager") {
}
rtc_library("transceiver_list") {
visibility = [ ":*" ]
sources = [
"transceiver_list.cc",
"transceiver_list.h",
@ -1104,6 +1127,7 @@ rtc_library("transceiver_list") {
}
rtc_library("rtp_receiver") {
visibility = [ ":*" ]
sources = [
"rtp_receiver.cc",
"rtp_receiver.h",
@ -1133,6 +1157,7 @@ rtc_library("rtp_receiver") {
}
rtc_library("audio_rtp_receiver") {
visibility = [ ":*" ]
sources = [
"audio_rtp_receiver.cc",
"audio_rtp_receiver.h",
@ -1169,6 +1194,7 @@ rtc_library("audio_rtp_receiver") {
}
rtc_library("video_rtp_receiver") {
visibility = [ ":*" ]
sources = [
"video_rtp_receiver.cc",
"video_rtp_receiver.h",
@ -1205,6 +1231,7 @@ rtc_library("video_rtp_receiver") {
}
rtc_library("video_rtp_track_source") {
visibility = [ ":*" ]
sources = [
"video_rtp_track_source.cc",
"video_rtp_track_source.h",
@ -1223,6 +1250,7 @@ rtc_library("video_rtp_track_source") {
}
rtc_library("audio_track") {
visibility = [ ":*" ]
sources = [
"audio_track.cc",
"audio_track.h",
@ -1237,6 +1265,7 @@ rtc_library("audio_track") {
}
rtc_library("video_track") {
visibility = [ ":*" ]
sources = [
"video_track.cc",
"video_track.h",
@ -1256,6 +1285,7 @@ rtc_library("video_track") {
}
rtc_source_set("sdp_state_provider") {
visibility = [ ":*" ]
sources = [ "sdp_state_provider.h" ]
deps = [
":rtc_pc_base",
@ -1264,6 +1294,7 @@ rtc_source_set("sdp_state_provider") {
}
rtc_library("jitter_buffer_delay") {
visibility = [ ":*" ]
sources = [
"jitter_buffer_delay.cc",
"jitter_buffer_delay.h",
@ -1279,6 +1310,7 @@ rtc_library("jitter_buffer_delay") {
}
rtc_library("remote_audio_source") {
visibility = [ ":*" ]
sources = [
"remote_audio_source.cc",
"remote_audio_source.h",
@ -1307,6 +1339,7 @@ rtc_library("remote_audio_source") {
}
rtc_library("rtp_sender") {
visibility = [ ":*" ]
sources = [
"rtp_sender.cc",
"rtp_sender.h",
@ -1338,6 +1371,7 @@ rtc_library("rtp_sender") {
}
rtc_library("rtp_parameters_conversion") {
visibility = [ ":*" ]
sources = [
"rtp_parameters_conversion.cc",
"rtp_parameters_conversion.h",
@ -1361,6 +1395,7 @@ rtc_library("rtp_parameters_conversion") {
}
rtc_library("dtmf_sender") {
visibility = [ ":*" ]
sources = [
"dtmf_sender.cc",
"dtmf_sender.h",
@ -1384,6 +1419,7 @@ rtc_library("dtmf_sender") {
}
rtc_library("media_stream") {
visibility = [ ":*" ]
sources = [
"media_stream.cc",
"media_stream.h",
@ -1423,6 +1459,7 @@ rtc_library("video_track_source") {
}
rtc_source_set("stats_collector_interface") {
visibility = [ ":*" ]
sources = [ "stats_collector_interface.h" ]
deps = [
"../api:libjingle_peerconnection_api",
@ -1431,9 +1468,9 @@ rtc_source_set("stats_collector_interface") {
}
rtc_source_set("libjingle_peerconnection") {
visibility = [ "*" ]
# TODO(bugs.webrtc.org/13661): Reduce visibility if possible
visibility = [ "*" ] # Used by Chrome and others
deps = [
":peerconnection",
"../api:libjingle_peerconnection_api",