Skip to content

Commit

Permalink
GN hack to tag targets as poisonous (and use it with audio codecs)
Browse files Browse the repository at this point in the history
Only specially taggged targets may transitively depend on poisonous
targets. We first apply it to audio codecs.

This makes it much clearer exactly what parts of the code still have
dependencies on the audio codecs (and we want to eventually get rid of
pretty much all of them).

Bug: webrtc:8396, webrtc:9121
Change-Id: Iba5c2e806c702b5cfe881022674705f647896d43
Reviewed-on: https://webrtc-review.googlesource.com/69520
Commit-Queue: Karl Wiberg <[email protected]>
Reviewed-by: Patrik Höglund <[email protected]>
Cr-Commit-Position: refs/heads/master@{#22979}
  • Loading branch information
Karl Wiberg authored and Commit Bot committed Apr 23, 2018
1 parent e999b3f commit bb23c83
Show file tree
Hide file tree
Showing 22 changed files with 239 additions and 3 deletions.
12 changes: 12 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -587,3 +587,15 @@ if (rtc_include_tests) {
}
}
}

# ---- Poisons ----
#
# Here is one empty dummy target for each poison type (needed because
# "being poisonous with poison type foo" is implemented as "depends on
# //:poison_foo").
#
# The set of poison_* targets needs to be kept in sync with the
# `all_poison_types` list in webrtc.gni.
#
group("poison_audio_codecs") {
}
1 change: 1 addition & 0 deletions api/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ rtc_source_set("video_stream_decoder") {

rtc_source_set("video_stream_decoder_create") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
sources = [
"video/video_stream_decoder_create.cc",
"video/video_stream_decoder_create.h",
Expand Down
1 change: 1 addition & 0 deletions api/audio/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ rtc_source_set("aec3_config") {

rtc_source_set("aec3_factory") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
configs += [ "../../modules/audio_processing:apm_debug_dump" ]
sources = [
"echo_canceller3_factory.cc",
Expand Down
2 changes: 2 additions & 0 deletions api/audio_codecs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ rtc_source_set("audio_codecs_api") {

rtc_static_library("builtin_audio_decoder_factory") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ]
sources = [
"builtin_audio_decoder_factory.cc",
"builtin_audio_decoder_factory.h",
Expand Down Expand Up @@ -73,6 +74,7 @@ rtc_static_library("builtin_audio_decoder_factory") {

rtc_static_library("builtin_audio_encoder_factory") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ]
sources = [
"builtin_audio_encoder_factory.cc",
"builtin_audio_encoder_factory.h",
Expand Down
2 changes: 2 additions & 0 deletions api/audio_codecs/L16/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if (is_android) {

rtc_static_library("audio_encoder_L16") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_encoder_L16.cc",
"audio_encoder_L16.h",
Expand All @@ -29,6 +30,7 @@ rtc_static_library("audio_encoder_L16") {

rtc_static_library("audio_decoder_L16") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_L16.cc",
"audio_decoder_L16.h",
Expand Down
2 changes: 2 additions & 0 deletions api/audio_codecs/g711/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if (is_android) {

rtc_static_library("audio_encoder_g711") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_encoder_g711.cc",
"audio_encoder_g711.h",
Expand All @@ -30,6 +31,7 @@ rtc_static_library("audio_encoder_g711") {

rtc_static_library("audio_decoder_g711") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_g711.cc",
"audio_decoder_g711.h",
Expand Down
2 changes: 2 additions & 0 deletions api/audio_codecs/g722/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rtc_source_set("audio_encoder_g722_config") {

rtc_static_library("audio_encoder_g722") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_encoder_g722.cc",
"audio_encoder_g722.h",
Expand All @@ -38,6 +39,7 @@ rtc_static_library("audio_encoder_g722") {

rtc_static_library("audio_decoder_g722") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_g722.cc",
"audio_decoder_g722.h",
Expand Down
2 changes: 2 additions & 0 deletions api/audio_codecs/ilbc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rtc_source_set("audio_encoder_ilbc_config") {

rtc_static_library("audio_encoder_ilbc") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_encoder_ilbc.cc",
"audio_encoder_ilbc.h",
Expand All @@ -38,6 +39,7 @@ rtc_static_library("audio_encoder_ilbc") {

rtc_static_library("audio_decoder_ilbc") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_ilbc.cc",
"audio_decoder_ilbc.h",
Expand Down
6 changes: 6 additions & 0 deletions api/audio_codecs/isac/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if (is_android) {

rtc_source_set("audio_encoder_isac") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
public = [
"audio_encoder_isac.h",
]
Expand All @@ -36,6 +37,7 @@ rtc_source_set("audio_encoder_isac") {

rtc_source_set("audio_decoder_isac") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
public = [
"audio_decoder_isac.h",
]
Expand Down Expand Up @@ -68,6 +70,7 @@ config("isac_config") {

rtc_static_library("audio_encoder_isac_fix") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_encoder_isac_fix.cc",
"audio_encoder_isac_fix.h",
Expand All @@ -83,6 +86,7 @@ rtc_static_library("audio_encoder_isac_fix") {

rtc_static_library("audio_decoder_isac_fix") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_isac_fix.cc",
"audio_decoder_isac_fix.h",
Expand All @@ -98,6 +102,7 @@ rtc_static_library("audio_decoder_isac_fix") {

rtc_static_library("audio_encoder_isac_float") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_encoder_isac_float.cc",
"audio_encoder_isac_float.h",
Expand All @@ -113,6 +118,7 @@ rtc_static_library("audio_encoder_isac_float") {

rtc_static_library("audio_decoder_isac_float") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_isac_float.cc",
"audio_decoder_isac_float.h",
Expand Down
2 changes: 2 additions & 0 deletions api/audio_codecs/opus/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rtc_static_library("audio_encoder_opus_config") {

rtc_source_set("audio_encoder_opus") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
public = [
"audio_encoder_opus.h",
]
Expand All @@ -49,6 +50,7 @@ rtc_source_set("audio_encoder_opus") {

rtc_static_library("audio_decoder_opus") {
visibility = [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"audio_decoder_opus.cc",
"audio_decoder_opus.h",
Expand Down
4 changes: 4 additions & 0 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ rtc_source_set("rtc_media_config") {

rtc_static_library("rtc_media_base") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
defines = []
libs = []
deps = [
Expand Down Expand Up @@ -155,6 +156,7 @@ rtc_static_library("rtc_constants") {

rtc_static_library("rtc_internal_video_codecs") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
defines = []
libs = []
deps = [
Expand Down Expand Up @@ -253,6 +255,7 @@ rtc_static_library("rtc_software_fallback_wrappers") {

rtc_static_library("rtc_audio_video") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
defines = []
libs = []
deps = [
Expand Down Expand Up @@ -420,6 +423,7 @@ rtc_static_library("rtc_data") {

rtc_source_set("rtc_media") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
deps = [
":rtc_audio_video",
":rtc_data",
Expand Down
19 changes: 19 additions & 0 deletions modules/audio_coding/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ rtc_source_set("audio_coding_module_typedefs") {

rtc_static_library("audio_coding") {
visibility += [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
sources = [
"acm2/acm_receiver.cc",
"acm2/acm_receiver.h",
Expand Down Expand Up @@ -220,6 +221,7 @@ config("g711_config") {

rtc_static_library("g711") {
visibility += [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"codecs/g711/audio_decoder_pcm.cc",
"codecs/g711/audio_decoder_pcm.h",
Expand All @@ -242,6 +244,7 @@ rtc_static_library("g711") {
}

rtc_source_set("g711_c") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/g711/g711.c",
"codecs/g711/g711.h",
Expand All @@ -260,6 +263,7 @@ config("g722_config") {

rtc_static_library("g722") {
visibility += [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"codecs/g722/audio_decoder_g722.cc",
"codecs/g722/audio_decoder_g722.h",
Expand All @@ -283,6 +287,7 @@ rtc_static_library("g722") {
}

rtc_source_set("g722_c") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/g722/g722_decode.c",
"codecs/g722/g722_enc_dec.h",
Expand All @@ -302,6 +307,7 @@ config("ilbc_config") {

rtc_static_library("ilbc") {
visibility += webrtc_default_visibility
poisonous = [ "audio_codecs" ]
sources = [
"codecs/ilbc/audio_decoder_ilbc.cc",
"codecs/ilbc/audio_decoder_ilbc.h",
Expand All @@ -326,6 +332,7 @@ rtc_static_library("ilbc") {
}

rtc_source_set("ilbc_c") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/ilbc/abs_quant.c",
"codecs/ilbc/abs_quant.h",
Expand Down Expand Up @@ -483,6 +490,7 @@ rtc_source_set("ilbc_c") {
}

rtc_static_library("isac_common") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/audio_decoder_isac_t.h",
"codecs/isac/audio_decoder_isac_t_impl.h",
Expand All @@ -508,6 +516,7 @@ config("isac_config") {

rtc_static_library("isac") {
visibility += [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/main/include/audio_decoder_isac.h",
"codecs/isac/main/include/audio_encoder_isac.h",
Expand All @@ -525,6 +534,7 @@ rtc_static_library("isac") {
}

rtc_static_library("isac_c") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/main/include/isac.h",
"codecs/isac/main/source/arith_routines.c",
Expand Down Expand Up @@ -602,6 +612,7 @@ config("isac_fix_config") {

rtc_static_library("isac_fix") {
visibility += [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/fix/source/audio_decoder_isacfix.cc",
"codecs/isac/fix/source/audio_encoder_isacfix.cc",
Expand All @@ -625,6 +636,7 @@ rtc_static_library("isac_fix") {
}

rtc_source_set("isac_fix_common") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/fix/source/codec.h",
"codecs/isac/fix/source/entropy_coding.h",
Expand All @@ -645,6 +657,7 @@ rtc_source_set("isac_fix_common") {
}

rtc_source_set("isac_fix_c_arm_asm") {
poisonous = [ "audio_codecs" ]
sources = []
if (current_cpu == "arm" && arm_version >= 7) {
sources += [
Expand All @@ -659,6 +672,7 @@ rtc_source_set("isac_fix_c_arm_asm") {
}

rtc_source_set("isac_fix_c") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/fix/include/audio_decoder_isacfix.h",
"codecs/isac/fix/include/audio_encoder_isacfix.h",
Expand Down Expand Up @@ -760,6 +774,7 @@ rtc_source_set("isac_fix_c") {

if (rtc_build_with_neon) {
rtc_static_library("isac_neon") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/isac/fix/source/entropy_coding_neon.c",
"codecs/isac/fix/source/filterbanks_neon.c",
Expand Down Expand Up @@ -801,6 +816,7 @@ config("pcm16b_config") {

rtc_static_library("pcm16b") {
visibility += [ "*" ]
poisonous = [ "audio_codecs" ]
sources = [
"codecs/pcm16b/audio_decoder_pcm16b.cc",
"codecs/pcm16b/audio_decoder_pcm16b.h",
Expand All @@ -825,6 +841,7 @@ rtc_static_library("pcm16b") {
}

rtc_source_set("pcm16b_c") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/pcm16b/pcm16b.c",
"codecs/pcm16b/pcm16b.h",
Expand All @@ -839,6 +856,7 @@ rtc_source_set("pcm16b_c") {

rtc_static_library("webrtc_opus") {
visibility += webrtc_default_visibility
poisonous = [ "audio_codecs" ]
sources = [
"codecs/opus/audio_decoder_opus.cc",
"codecs/opus/audio_decoder_opus.h",
Expand Down Expand Up @@ -874,6 +892,7 @@ rtc_static_library("webrtc_opus") {
}

rtc_source_set("webrtc_opus_c") {
poisonous = [ "audio_codecs" ]
sources = [
"codecs/opus/opus_inst.h",
"codecs/opus/opus_interface.c",
Expand Down
1 change: 1 addition & 0 deletions modules/audio_processing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ config("apm_debug_dump") {

rtc_static_library("audio_processing") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
configs += [ ":apm_debug_dump" ]
sources = [
"aec/aec_resampler.cc",
Expand Down
1 change: 1 addition & 0 deletions modules/audio_processing/aec3/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import("../../../webrtc.gni")

rtc_static_library("aec3") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
configs += [ "..:apm_debug_dump" ]
sources = [
"adaptive_fir_filter.cc",
Expand Down
2 changes: 2 additions & 0 deletions modules/video_capture/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import("../../webrtc.gni")
# use the internal capturer.
rtc_static_library("video_capture_module") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
sources = [
"device_info_impl.cc",
"device_info_impl.h",
Expand Down Expand Up @@ -50,6 +51,7 @@ rtc_static_library("video_capture_module") {

rtc_static_library("video_capture") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
sources = [
"external/device_info_external.cc",
"external/video_capture_external.cc",
Expand Down
Loading

0 comments on commit bb23c83

Please sign in to comment.