# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS.  All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("//build/config/arm.gni")
import("//build/config/features.gni")
import("//build/config/mips.gni")
import("//build/config/ozone.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/sysroot.gni")
import("//build_overrides/build.gni")

if (!build_with_chromium && is_component_build) {
  print("The Gn argument `is_component_build` is currently " +
        "ignored for WebRTC builds.")
  print("Component builds are supported by Chromium and the argument " +
        "`is_component_build` makes it possible to create shared libraries " +
        "instead of static libraries.")
  print("If an app depends on WebRTC it makes sense to just depend on the " +
        "WebRTC static library, so there is no difference between " +
        "`is_component_build=true` and `is_component_build=false`.")
  print(
      "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md")
  assert(!is_component_build, "Component builds are not supported in WebRTC.")
}

if (is_ios) {
  import("//build/config/ios/rules.gni")
}

if (is_mac) {
  import("//build/config/mac/rules.gni")
}

if (is_fuchsia) {
  import("//build/config/fuchsia/config.gni")
}

if (build_with_chromium) {
  import("//media/media_options.gni")
}

# This declare_args is separated from the next one because args declared
# in this one, can be read from the next one (args defined in the same
# declare_args cannot be referenced in that scope).
declare_args() {
  # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
  # expand to code that will manage symbols visibility.
  rtc_enable_symbol_export = false
}

declare_args() {
  # Setting this to true, will make RTC_DLOG() expand to log statements instead
  # of being removed by the preprocessor.
  # This is useful for example to be able to get RTC_DLOGs on a release build.
  rtc_dlog_always_on = false

  # Enables additional build targets that rely on
  # //third_party/google_benchmarks.
  rtc_enable_google_benchmarks = true

  # Setting this to true will make RTC_OBJC_EXPORT expand to code that will
  # manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported
  # if C++ symbols are but setting this arg to true while keeping
  # rtc_enable_symbol_export=false will only export RTC_OBJC_EXPORT
  # annotated symbols.
  rtc_enable_objc_symbol_export = rtc_enable_symbol_export

  # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
  # will tell the pre-processor to remove the default definition of symbols
  # needed to use field_trial. In that case a new implementation needs to be
  # provided.
  if (build_with_chromium) {
    # When WebRTC is built as part of Chromium it should exclude the default
    # implementation of field_trial unless it is building for NACL or
    # Chromecast.
    rtc_exclude_field_trial_default = !is_nacl && !is_castos && !is_cast_android
  } else {
    rtc_exclude_field_trial_default = false
  }

  # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
  # will tell the pre-processor to remove the default definition of symbols
  # needed to use metrics. In that case a new implementation needs to be
  # provided.
  rtc_exclude_metrics_default = build_with_chromium

  # Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which
  # will tell the pre-processor to remove the default definition of the
  # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In
  # that case a new implementation needs to be provided.
  rtc_exclude_system_time = build_with_chromium

  # Setting this to false will require the API user to pass in their own
  # SSLCertificateVerifier to verify the certificates presented from a
  # TLS-TURN server. In return disabling this saves around 100kb in the binary.
  rtc_builtin_ssl_root_certificates = true

  # Include the iLBC audio codec?
  rtc_include_ilbc = true

  # Disable this to avoid building the Opus audio codec.
  rtc_include_opus = true

  # Enable this if the Opus version upon which WebRTC is built supports direct
  # encoding of 120 ms packets.
  rtc_opus_support_120ms_ptime = true

  # Enable this to let the Opus audio codec change complexity on the fly.
  rtc_opus_variable_complexity = false

  # Used to specify an external Jsoncpp include path when not compiling the
  # library that comes with WebRTC (i.e. rtc_build_json == 0).
  rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"

  # Used to specify an external OpenSSL include path when not compiling the
  # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
  rtc_ssl_root = ""

  # Enable when an external authentication mechanism is used for performing
  # packet authentication for RTP packets instead of libsrtp.
  rtc_enable_external_auth = build_with_chromium

  # Selects whether debug dumps for the audio processing module
  # should be generated.
  apm_debug_dump = false

  # Selects whether the audio processing module should be excluded.
  rtc_exclude_audio_processing_module = false

  # Set this to false to skip building examples.
  rtc_build_examples = true

  # Set this to false to skip building tools.
  rtc_build_tools = true

  # Set this to false to skip building code that requires X11.
  rtc_use_x11 = ozone_platform_x11

  # Set this to use PipeWire on the Wayland display server.
  # By default it's only enabled on desktop Linux (excludes ChromeOS) and
  # only when using the sysroot as PipeWire is not available in older and
  # supported Ubuntu and Debian distributions.
  rtc_use_pipewire = is_linux && use_sysroot

  # Set this to link PipeWire and required libraries directly instead of using the dlopen.
  rtc_link_pipewire = false

  # Enable to use the Mozilla internal settings.
  build_with_mozilla = false

  # Experimental: enable use of Android AAudio which requires Android SDK 26 or above
  # and NDK r16 or above.
  rtc_enable_android_aaudio = false

  # Set to "func", "block", "edge" for coverage generation.
  # At unit test runtime set UBSAN_OPTIONS="coverage=1".
  # It is recommend to set include_examples=0.
  # Use llvm's sancov -html-report for human readable reports.
  # See http://clang.llvm.org/docs/SanitizerCoverage.html .
  rtc_sanitize_coverage = ""

  # Selects fixed-point code where possible.
  rtc_prefer_fixed_point = false
  if (current_cpu == "arm" || current_cpu == "arm64") {
    rtc_prefer_fixed_point = true
  }

  # Determines whether NEON code will be built.
  rtc_build_with_neon =
      (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"

  # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
  # all platforms except Android and iOS. Because FFmpeg can be built
  # with/without H.264 support, `ffmpeg_branding` has to separately be set to a
  # value that includes H.264, for example "Chrome". If FFmpeg is built without
  # H.264, compilation succeeds but `H264DecoderImpl` fails to initialize.
  # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
  # http://www.openh264.org, https://www.ffmpeg.org/
  #
  # Enabling H264 when building with MSVC is currently not supported, see
  # bugs.webrtc.org/9213#c13 for more info.
  rtc_use_h264 =
      proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)

  # Use system OpenH264
  rtc_system_openh264 = false

  # Enable to use H265
  if (build_with_chromium) {
    rtc_use_h265 = enable_hevc_parser_and_hw_decoder
  } else {
    rtc_use_h265 = proprietary_codecs
  }

  # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
  rtc_use_absl_mutex = false

  # By default, use normal platform audio support or dummy audio, but don't
  # use file-based audio playout and record.
  rtc_use_dummy_audio_file_devices = false

  # When set to true, replace the audio output with a sinus tone at 440Hz.
  # The ADM will ask for audio data from WebRTC but instead of reading real
  # audio samples from NetEQ, a sinus tone will be generated and replace the
  # real audio samples.
  rtc_audio_device_plays_sinus_tone = false

  if (is_ios) {
    # Build broadcast extension in AppRTCMobile for iOS. This results in the
    # binary only running on iOS 11+, which is why it is disabled by default.
    rtc_apprtcmobile_broadcast_extension = false
  }

  # Determines whether OpenGL is available on iOS.
  rtc_ios_use_opengl_rendering = is_ios && target_environment != "catalyst"

  # When set to false, builtin audio encoder/decoder factories and all the
  # audio codecs they depend on will not be included in libwebrtc.{a|lib}
  # (they will still be included in libjingle_peerconnection_so.so and
  # WebRTC.framework)
  rtc_include_builtin_audio_codecs = true

  # When set to true and in a standalone build, it will undefine UNICODE and
  # _UNICODE (which are always defined globally by the Chromium Windows
  # toolchain).
  # This is only needed for testing purposes, WebRTC wants to be sure it
  # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
  # wide character functions.
  rtc_win_undef_unicode = false

  # When set to true, a capturer implementation that uses the
  # Windows.Graphics.Capture APIs will be available for use. This introduces a
  # dependency on the Win 10 SDK v10.0.17763.0.
  rtc_enable_win_wgc = is_win

  # Includes the dav1d decoder in the internal decoder factory when set to true.
  rtc_include_dav1d_in_internal_decoder_factory = true

  # When enabled, a run-time check will make sure that all field trial keys have
  # been registered in accordance with the field trial policy, see
  # g3doc/field-trials.md. The value can be set to the following:
  #
  #  "dcheck": RTC_DCHECKs that the field trial has been registered. RTC_DCHECK
  #            must be enabled separately.
  #
  #  "warn": RTC_LOGs a message with LS_WARNING severity if the field trial
  #          hasn't been registered.
  rtc_strict_field_trials = ""

  # If different from "", symbols exported with RTC_OBJC_EXPORT will be prefixed
  # with this string.
  # See the definition of RTC_OBJC_TYPE_PREFIX in the code.
  rtc_objc_prefix = ""

  # Embedders can define dependencies needed by WebRTC. Dependencies can be
  # configs or targets. This can be defined in their `.gn` file.
  #
  # In practise, this is use by Chromium: Targets from
  # `//third_party/webrtc_overrides` are depending on Chrome's `//base`, but
  # WebRTC does not declare its public dependencies. See webrtc:8603. Instead
  # WebRTC is using a global common dependencies.
  rtc_common_public_deps = []  # no-presubmit-check TODO(webrtc:8603)

  # When true, include the Perfetto library.
  rtc_use_perfetto = false
}

if (!build_with_mozilla) {
  import("//testing/test.gni")
}

# A second declare_args block, so that declarations within it can
# depend on the possibly overridden variables in the first
# declare_args block.
declare_args() {
  # Enables the use of protocol buffers for debug recordings.
  rtc_enable_protobuf = !build_with_mozilla

  # Set this to disable building with support for SCTP data channels.
  rtc_enable_sctp = !build_with_mozilla

  # Disable these to not build components which can be externally provided.
  rtc_build_json = !build_with_mozilla
  rtc_build_libsrtp = !build_with_mozilla
  rtc_build_libvpx = !build_with_mozilla
  rtc_libvpx_build_vp9 = !build_with_mozilla
  rtc_build_opus = !build_with_mozilla
  rtc_build_ssl = !build_with_mozilla

  # Enable libevent task queues on platforms that support it.
  if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
      target_cpu == "wasm") {
    rtc_enable_libevent = false
    rtc_build_libevent = false
  } else {
    rtc_enable_libevent = true
    rtc_build_libevent = !build_with_mozilla
  }

  # Excluded in Chromium since its prerequisites don't require Pulse Audio.
  rtc_include_pulse_audio = !build_with_chromium

  # Chromium uses its own IO handling, so the internal ADM is only built for
  # standalone WebRTC.
  rtc_include_internal_audio_device = !build_with_chromium

  # Set this to true to enable the avx2 support in webrtc.
  # TODO: Make sure that AVX2 works also for non-clang compilers.
  if (is_clang == true) {
    rtc_enable_avx2 = true
  } else {
    rtc_enable_avx2 = false
  }

  # Set this to true to build the unit tests.
  # Disabled when building with Chromium or Mozilla.
  rtc_include_tests = !build_with_chromium && !build_with_mozilla

  # Set this to false to skip building code that also requires X11 extensions
  # such as Xdamage, Xfixes.
  rtc_use_x11_extensions = rtc_use_x11

  # Set this to true to fully remove logging from WebRTC.
  rtc_disable_logging = false

  # Set this to true to disable trace events.
  rtc_disable_trace_events = false

  # Set this to true to disable detailed error message and logging for
  # RTC_CHECKs.
  rtc_disable_check_msg = false

  # Set this to true to disable webrtc metrics.
  rtc_disable_metrics = false
}

declare_args() {
  # Enable the dcsctp backend for DataChannels and related unittests
  rtc_build_dcsctp = !build_with_mozilla && rtc_enable_sctp

  # Enable gRPC used for negotiation in multiprocess tests
  rtc_enable_grpc = rtc_enable_protobuf && (is_linux || is_mac)
}

# Make it possible to provide custom locations for some libraries (move these
# up into declare_args should we need to actually use them for the GN build).
rtc_libvpx_dir = "//third_party/libvpx"
rtc_opus_dir = "//third_party/opus"

# Desktop capturer is supported only on Windows, OSX and Linux.
rtc_desktop_capture_supported =
    (is_win && current_os != "winuwp") || is_mac ||
    ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))

###############################################################################
# Templates
#

# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
# chromium.
# We need absolute paths for all configs in templates as they are shared in
# different subdirectories.
webrtc_root = get_path_info(".", "abspath")

# Global configuration that should be applied to all WebRTC targets.
# You normally shouldn't need to include this in your target as it's
# automatically included when using the rtc_* templates.
# It sets defines, include paths and compilation warnings accordingly,
# both for WebRTC stand-alone builds and for the scenario when WebRTC
# native code is built as part of Chromium.
rtc_common_configs = [ webrtc_root + ":common_config" ]

if (is_mac || is_ios) {
  if (filter_include(default_compiler_configs,
                     [ "//build/config/compiler:enable_arc" ]) == []) {
    rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
  }
}

if (build_with_chromium) {
  rtc_use_perfetto = true
}

# Global public configuration that should be applied to all WebRTC targets. You
# normally shouldn't need to include this in your target as it's automatically
# included when using the rtc_* templates. It set the defines, include paths and
# compilation warnings that should be propagated to dependents of the targets
# depending on the target having this config.
rtc_common_inherited_config = webrtc_root + ":common_inherited_config"

# Common configs to remove or add in all rtc targets.
rtc_remove_configs = []
if (!build_with_chromium && is_clang) {
  rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
}
rtc_add_configs = rtc_common_configs
rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]

set_defaults("rtc_test") {
  configs = rtc_add_configs
  public_deps = rtc_common_public_deps  # no-presubmit-check TODO(webrtc:8603)
  suppressed_configs = []
}

set_defaults("rtc_library") {
  configs = rtc_add_configs
  public_deps = rtc_common_public_deps  # no-presubmit-check TODO(webrtc:8603)
  suppressed_configs = []
}

set_defaults("rtc_source_set") {
  configs = rtc_add_configs
  public_deps = rtc_common_public_deps  # no-presubmit-check TODO(webrtc:8603)
  suppressed_configs = []
}

set_defaults("rtc_static_library") {
  configs = rtc_add_configs
  public_deps = rtc_common_public_deps  # no-presubmit-check TODO(webrtc:8603)
  suppressed_configs = []
}

set_defaults("rtc_executable") {
  configs = rtc_add_configs
  public_deps = rtc_common_public_deps  # no-presubmit-check TODO(webrtc:8603)
  suppressed_configs = []
}

set_defaults("rtc_shared_library") {
  configs = rtc_add_configs
  public_deps = rtc_common_public_deps  # no-presubmit-check TODO(webrtc:8603)
  suppressed_configs = []
}

webrtc_default_visibility = [ webrtc_root + "/*" ]
if (build_with_chromium) {
  # Allow Chromium's WebRTC overrides targets to bypass the regular
  # visibility restrictions.
  webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
}

# ---- Poisons ----
#
# The general idea is that some targets declare that they contain some
# kind of poison, which makes it impossible for other targets to
# depend on them (even transitively) unless they declare themselves
# immune to that particular type of poison.
#
# Targets that *contain* poison of type foo should contain the line
#
#   poisonous = [ "foo" ]
#
# and targets that *are immune but arent't themselves poisonous*
# should contain
#
#   allow_poison = [ "foo" ]
#
# This useful in cases where we have some large target or set of
# targets and want to ensure that most other targets do not
# transitively depend on them. For example, almost no high-level
# target should depend on the audio codecs, since we want WebRTC users
# to be able to inject any subset of them and actually end up with a
# binary that doesn't include the codecs they didn't inject.
#
# Test-only targets (`testonly` set to true) and non-public targets
# (`visibility` not containing "*") are automatically immune to all
# types of poison.
#
# Here's the complete list of all types of poison. It must be kept in
# 1:1 correspondence with the set of //:poison_* targets.
#
all_poison_types = [
  # Encoders and decoders for specific audio codecs such as Opus and iSAC.
  "audio_codecs",

  # Default echo detector implementation.
  "default_echo_detector",

  # Implementations of the utilities exposed through `Environment`.
  # Most webrtc classes must use propagated `Environment`. Only few top-level
  # classes are allowed to create `Environment` from individual utilities.
  "environment_construction",

  # Software video codecs (VP8 and VP9 through libvpx).
  "software_video_codecs",
]

absl_include_config = "//third_party/abseil-cpp:absl_include_config"
absl_define_config = "//third_party/abseil-cpp:absl_define_config"

# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
# that are testonly.
absl_flags_config = webrtc_root + ":absl_flags_configs"

# WebRTC wrapper of Chromium's test() template. This template just adds some
# WebRTC only configuration in order to avoid to duplicate it for every WebRTC
# target.
# The parameter `is_xctest` is different from the one in the Chromium's test()
# template (and it is not forwarded to it). In rtc_test(), the argument
# `is_xctest` is used to avoid to take dependencies that are not needed
# in case the test is a real XCTest (using the XCTest framework).
template("rtc_test") {
  test(target_name) {
    forward_variables_from(invoker,
                           "*",
                           [
                             "configs",
                             "is_xctest",
                             "public_configs",
                             "suppressed_configs",
                             "visibility",
                           ])

    # Always override to public because when target_os is Android the `test`
    # template can override it to [ "*" ] and we want to avoid conditional
    # visibility.
    visibility = [ "*" ]
    configs += invoker.configs
    configs -= rtc_remove_configs
    configs -= invoker.suppressed_configs
    public_configs = [
      rtc_common_inherited_config,
      absl_include_config,
      absl_define_config,
      absl_flags_config,
    ]
    if (defined(invoker.public_configs)) {
      public_configs += invoker.public_configs
    }
    if (!build_with_chromium && is_android) {
      android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
      use_raw_android_executable = false
      min_sdk_version = 21
      target_sdk_version = 23
      deps += [
        "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
        webrtc_root + "test:native_test_java",
      ]
    }

    # Build //test:google_test_runner_objc when the test is not a real XCTest.
    if (is_ios && rtc_include_tests) {
      if (!defined(invoker.is_xctest) || !invoker.is_xctest) {
        xctest_module_target = "//test:google_test_runner_objc"
      }
    }

    assert(
        !defined(absl_deps),
        "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")

    # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
    if (build_with_chromium && defined(deps)) {
      absl_dependencies =
          filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ])
      if (absl_dependencies != []) {
        filtered_deps =
            filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ])
        deps = []
        deps = filtered_deps
        deps += [ "//third_party/abseil-cpp:absl" ]
      }
    }

    # TODO(crbug.com/webrtc/13556): Adding the .app folder in the runtime_deps
    # shoulnd't be necessary. this code should be removed and the same solution
    # as Chromium should be used.
    if (is_ios) {
      if (!defined(invoker.data)) {
        data = []
      }
      data += [ "${root_out_dir}/${target_name}.app" ]
    }
  }
}

template("rtc_source_set") {
  source_set(target_name) {
    forward_variables_from(invoker,
                           "*",
                           [
                             "configs",
                             "public_configs",
                             "suppressed_configs",
                             "visibility",
                           ])
    forward_variables_from(invoker, [ "visibility" ])
    if (!defined(visibility)) {
      visibility = webrtc_default_visibility
    }

    # What's your poison?
    if (defined(testonly) && testonly) {
      assert(!defined(poisonous))
      assert(!defined(allow_poison))
    } else {
      if (!defined(poisonous)) {
        poisonous = []
      }
      if (!defined(allow_poison)) {
        allow_poison = []
      }
      if (!defined(assert_no_deps)) {
        assert_no_deps = []
      }
      if (!defined(deps)) {
        deps = []
      }
      foreach(p, poisonous) {
        deps += [ webrtc_root + ":poison_" + p ]
      }
      foreach(poison_type, all_poison_types) {
        allow_dep = true
        foreach(v, visibility) {
          if (v == "*") {
            allow_dep = false
          }
        }
        foreach(p, allow_poison + poisonous) {
          if (p == poison_type) {
            allow_dep = true
          }
        }
        if (!allow_dep) {
          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
        }
      }
    }

    # Chromium should only depend on the WebRTC component in order to
    # avoid to statically link WebRTC in a component build.
    if (build_with_chromium) {
      publicly_visible = false
      foreach(v, visibility) {
        if (v == "*") {
          publicly_visible = true
        }
      }
      if (publicly_visible) {
        visibility = []
        visibility = webrtc_default_visibility
      }
    }

    if (!defined(testonly) || !testonly) {
      configs += rtc_prod_configs
    }

    configs += invoker.configs
    configs += rtc_library_impl_config
    configs -= rtc_remove_configs
    configs -= invoker.suppressed_configs
    public_configs = [
      rtc_common_inherited_config,
      absl_include_config,
      absl_define_config,
    ]
    if (defined(testonly) && testonly) {
      public_configs += [ absl_flags_config ]
    }
    if (defined(invoker.public_configs)) {
      public_configs += invoker.public_configs
    }

    assert(
        !defined(absl_deps),
        "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")

    # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
    if (build_with_chromium && defined(deps)) {
      absl_dependencies =
          filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ])
      if (absl_dependencies != []) {
        filtered_deps =
            filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ])
        deps = []
        deps = filtered_deps
        deps += [ "//third_party/abseil-cpp:absl" ]
      }
    }
  }
}

template("rtc_static_library") {
  static_library(target_name) {
    forward_variables_from(invoker,
                           "*",
                           [
                             "configs",
                             "public_configs",
                             "suppressed_configs",
                             "visibility",
                           ])
    forward_variables_from(invoker, [ "visibility" ])
    if (!defined(visibility)) {
      visibility = webrtc_default_visibility
    }

    # What's your poison?
    if (defined(testonly) && testonly) {
      assert(!defined(poisonous))
      assert(!defined(allow_poison))
    } else {
      if (!defined(poisonous)) {
        poisonous = []
      }
      if (!defined(allow_poison)) {
        allow_poison = []
      }
      if (!defined(assert_no_deps)) {
        assert_no_deps = []
      }
      if (!defined(deps)) {
        deps = []
      }
      foreach(p, poisonous) {
        deps += [ webrtc_root + ":poison_" + p ]
      }
      foreach(poison_type, all_poison_types) {
        allow_dep = true
        foreach(v, visibility) {
          if (v == "*") {
            allow_dep = false
          }
        }
        foreach(p, allow_poison + poisonous) {
          if (p == poison_type) {
            allow_dep = true
          }
        }
        if (!allow_dep) {
          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
        }
      }
    }

    if (!defined(testonly) || !testonly) {
      configs += rtc_prod_configs
    }

    configs += invoker.configs
    configs += rtc_library_impl_config
    configs -= rtc_remove_configs
    configs -= invoker.suppressed_configs
    public_configs = [
      rtc_common_inherited_config,
      absl_include_config,
      absl_define_config,
    ]
    if (defined(testonly) && testonly) {
      public_configs += [ absl_flags_config ]
    }
    if (defined(invoker.public_configs)) {
      public_configs += invoker.public_configs
    }

    assert(
        !defined(absl_deps),
        "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")

    # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
    if (build_with_chromium && defined(deps)) {
      absl_dependencies =
          filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ])
      if (absl_dependencies != []) {
        filtered_deps =
            filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ])
        deps = []
        deps = filtered_deps
        deps += [ "//third_party/abseil-cpp:absl" ]
      }
    }
  }
}

# This template automatically switches the target type between source_set
# and static_library.
#
# This should be the default target type for all the WebRTC targets.
#
# How does it work:
# Since all files in a source_set are linked into a final binary, while files
# in a static library are only linked in if at least one symbol in them is
# referenced, in component builds source_sets are easy to deal with because
# all their object files are passed to the linker to create a shared library.
# In release builds instead, static_libraries are preferred since they allow
# the linker to discard dead code.
# For the same reason, testonly targets will always be expanded to
# source_set in order to be sure that tests are present in the test binary.
template("rtc_library") {
  header_only = true
  if (defined(invoker.sources)) {
    non_header_sources = filter_exclude(invoker.sources,
                                        [
                                          "*.h",
                                          "*.hh",
                                          "*.inc",
                                        ])
    if (non_header_sources != []) {
      header_only = false
    }
  }

  # Header only libraries should use source_set as a static_library with no
  # source files will cause issues with macOS libtool.
  if (header_only || is_component_build ||
      (defined(invoker.testonly) && invoker.testonly)) {
    target_type = "source_set"
  } else {
    target_type = "static_library"
  }
  target(target_type, target_name) {
    forward_variables_from(invoker,
                           "*",
                           [
                             "configs",
                             "public_configs",
                             "suppressed_configs",
                             "visibility",
                           ])
    forward_variables_from(invoker, [ "visibility" ])
    if (!defined(visibility)) {
      visibility = webrtc_default_visibility
    }

    # What's your poison?
    if (defined(testonly) && testonly) {
      assert(!defined(poisonous))
      assert(!defined(allow_poison))
    } else {
      if (!defined(poisonous)) {
        poisonous = []
      }
      if (!defined(allow_poison)) {
        allow_poison = []
      }
      if (!defined(assert_no_deps)) {
        assert_no_deps = []
      }
      if (!defined(deps)) {
        deps = []
      }
      foreach(p, poisonous) {
        deps += [ webrtc_root + ":poison_" + p ]
      }
      foreach(poison_type, all_poison_types) {
        allow_dep = true
        foreach(v, visibility) {
          if (v == "*") {
            allow_dep = false
          }
        }
        foreach(p, allow_poison + poisonous) {
          if (p == poison_type) {
            allow_dep = true
          }
        }
        if (!allow_dep) {
          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
        }
      }
    }

    # Chromium should only depend on the WebRTC component in order to
    # avoid to statically link WebRTC in a component build.
    if (build_with_chromium) {
      publicly_visible = false
      foreach(v, visibility) {
        if (v == "*") {
          publicly_visible = true
        }
      }
      if (publicly_visible) {
        visibility = []
        visibility = webrtc_default_visibility
      }
    }

    if (!defined(testonly) || !testonly) {
      configs += rtc_prod_configs
    }

    configs += invoker.configs
    configs += rtc_library_impl_config
    configs -= rtc_remove_configs
    configs -= invoker.suppressed_configs
    public_configs = [
      rtc_common_inherited_config,
      absl_include_config,
      absl_define_config,
    ]
    if (defined(testonly) && testonly) {
      public_configs += [ absl_flags_config ]
    }
    if (defined(invoker.public_configs)) {
      public_configs += invoker.public_configs
    }

    assert(
        !defined(absl_deps),
        "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.")

    # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true
    if (build_with_chromium && defined(deps)) {
      absl_dependencies =
          filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ])
      if (absl_dependencies != []) {
        filtered_deps =
            filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ])
        deps = []
        deps = filtered_deps
        deps += [ "//third_party/abseil-cpp:absl" ]
      }
    }
  }
}

template("rtc_executable") {
  executable(target_name) {
    forward_variables_from(invoker,
                           "*",
                           [
                             "deps",
                             "configs",
                             "public_configs",
                             "suppressed_configs",
                             "visibility",
                           ])
    forward_variables_from(invoker, [ "visibility" ])
    if (!defined(visibility)) {
      visibility = webrtc_default_visibility
    }
    configs += invoker.configs
    configs -= rtc_remove_configs
    configs -= invoker.suppressed_configs
    deps = invoker.deps

    public_configs = [
      rtc_common_inherited_config,
      absl_include_config,
      absl_define_config,
    ]
    if (defined(testonly) && testonly) {
      public_configs += [ absl_flags_config ]
    }
    if (defined(invoker.public_configs)) {
      public_configs += invoker.public_configs
    }
    if (is_win) {
      deps += [
        # Give executables the default manifest on Windows (a no-op elsewhere).
        "//build/win:default_exe_manifest",
      ]
    }
  }
}

template("rtc_shared_library") {
  shared_library(target_name) {
    forward_variables_from(invoker,
                           "*",
                           [
                             "configs",
                             "public_configs",
                             "suppressed_configs",
                             "visibility",
                           ])
    forward_variables_from(invoker, [ "visibility" ])
    if (!defined(visibility)) {
      visibility = webrtc_default_visibility
    }

    # What's your poison?
    if (defined(testonly) && testonly) {
      assert(!defined(poisonous))
      assert(!defined(allow_poison))
    } else {
      if (!defined(poisonous)) {
        poisonous = []
      }
      if (!defined(allow_poison)) {
        allow_poison = []
      }
      if (!defined(assert_no_deps)) {
        assert_no_deps = []
      }
      if (!defined(deps)) {
        deps = []
      }
      foreach(p, poisonous) {
        deps += [ webrtc_root + ":poison_" + p ]
      }
      foreach(poison_type, all_poison_types) {
        allow_dep = true
        foreach(v, visibility) {
          if (v == "*") {
            allow_dep = false
          }
        }
        foreach(p, allow_poison + poisonous) {
          if (p == poison_type) {
            allow_dep = true
          }
        }
        if (!allow_dep) {
          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
        }
      }
    }

    configs += invoker.configs
    configs -= rtc_remove_configs
    configs -= invoker.suppressed_configs
    public_configs = [
      rtc_common_inherited_config,
      absl_include_config,
      absl_define_config,
    ]
    if (defined(testonly) && testonly) {
      public_configs += [ absl_flags_config ]
    }
    if (defined(invoker.public_configs)) {
      public_configs += invoker.public_configs
    }
  }
}

if (is_mac || is_ios) {
  template("apple_framework_bundle_with_umbrella_header") {
    forward_variables_from(invoker, [ "output_name" ])
    this_target_name = target_name
    umbrella_header_path =
        "$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
    modulemap_path = "$target_gen_dir/Modules/module.modulemap"
    privacy_manifest_path = "$target_gen_dir/$target_name/PrivacyInfo.xcprivacy"

    action_foreach("create_bracket_include_headers_$target_name") {
      script = "//tools_webrtc/apple/copy_framework_header.py"
      sources = invoker.sources
      output_name = invoker.output_name
      outputs = [
        "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
      ]
      args = [
        "--input",
        "{{source}}",
        "--output",
        rebase_path(target_gen_dir, root_build_dir) +
            "/$output_name.framework/WebRTC/{{source_file_part}}",
      ]
    }

    if (is_mac) {
      mac_framework_bundle(target_name) {
        forward_variables_from(invoker, "*", [ "configs" ])
        if (defined(invoker.configs)) {
          configs += invoker.configs
        }

        framework_version = "A"
        framework_contents = [
          "Headers",
          "Modules",
          "Resources",
        ]

        ldflags = [
          "-all_load",
          "-install_name",
          "@rpath/$output_name.framework/$output_name",
        ]

        deps += [
          ":copy_framework_headers_$this_target_name",
          ":copy_modulemap_$this_target_name",
          ":copy_privacy_manifest_$this_target_name",
          ":copy_umbrella_header_$this_target_name",
          ":create_bracket_include_headers_$this_target_name",
          ":modulemap_$this_target_name",
          ":umbrella_header_$this_target_name",
        ]
      }
    }
    if (is_ios) {
      ios_framework_bundle(target_name) {
        forward_variables_from(invoker,
                               "*",
                               [
                                 "configs",
                                 "public_headers",
                               ])
        if (defined(invoker.configs)) {
          configs += invoker.configs
        }
        public_headers = get_target_outputs(
                ":create_bracket_include_headers_$this_target_name")

        deps += [
          ":copy_privacy_manifest_$this_target_name",
          ":copy_umbrella_header_$this_target_name",
          ":create_bracket_include_headers_$this_target_name",
        ]
      }
    }

    if (is_mac || target_environment == "catalyst") {
      # Catalyst frameworks use the same layout as regular Mac frameworks.
      headers_dir = "Versions/A/Headers"

      # The path to the privacy manifest file differs between Mac and iOS.
      # https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/adding_a_privacy_manifest_to_your_app_or_third-party_sdk
      privacy_manifest_out_path = "Versions/A/Resources/PrivacyInfo.xcprivacy"
    } else {
      headers_dir = "Headers"
      privacy_manifest_out_path = "PrivacyInfo.xcprivacy"
    }

    bundle_data("copy_framework_headers_$this_target_name") {
      sources = get_target_outputs(
              ":create_bracket_include_headers_$this_target_name")

      outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
      deps = [ ":create_bracket_include_headers_$this_target_name" ]
    }

    action("modulemap_$this_target_name") {
      script = "//tools_webrtc/ios/generate_modulemap.py"
      args = [
        "--out",
        rebase_path(modulemap_path, root_build_dir),
        "--name",
        output_name,
      ]
      outputs = [ modulemap_path ]
    }

    bundle_data("copy_modulemap_$this_target_name") {
      sources = [ modulemap_path ]
      outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
      deps = [ ":modulemap_$this_target_name" ]
    }

    action("umbrella_header_$this_target_name") {
      sources = get_target_outputs(
              ":create_bracket_include_headers_$this_target_name")

      script = "//tools_webrtc/ios/generate_umbrella_header.py"

      outputs = [ umbrella_header_path ]
      args = [
               "--out",
               rebase_path(umbrella_header_path, root_build_dir),
               "--sources",
             ] + sources
      deps = [ ":create_bracket_include_headers_$this_target_name" ]
    }

    copy("copy_umbrella_header_$target_name") {
      sources = [ umbrella_header_path ]
      outputs =
          [ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ]

      deps = [ ":umbrella_header_$target_name" ]
    }

    action("create_privacy_manifest_$target_name") {
      script = "//tools_webrtc/apple/generate_privacy_manifest.py"

      args = [
        "--output",
        rebase_path(privacy_manifest_path),
      ]

      outputs = [ privacy_manifest_path ]
    }

    copy("copy_privacy_manifest_$target_name") {
      sources = [ privacy_manifest_path ]
      outputs =
          [ "$root_out_dir/$output_name.framework/$privacy_manifest_out_path" ]

      deps = [ ":create_privacy_manifest_$target_name" ]
    }
  }
}

if (is_android) {
  template("rtc_android_library") {
    android_library(target_name) {
      forward_variables_from(invoker,
                             "*",
                             [
                               "configs",
                               "public_configs",
                               "suppressed_configs",
                               "visibility",
                             ])

      errorprone_args = []

      # Treat warnings as errors.
      errorprone_args += [ "-Werror" ]

      # Add any arguments defined by the invoker.
      if (defined(invoker.errorprone_args)) {
        errorprone_args += invoker.errorprone_args
      }

      if (!defined(deps)) {
        deps = []
      }

      no_build_hooks = true
      not_needed([ "android_manifest" ])
    }
  }

  template("rtc_android_apk") {
    android_apk(target_name) {
      forward_variables_from(invoker,
                             "*",
                             [
                               "configs",
                               "public_configs",
                               "suppressed_configs",
                               "visibility",
                             ])

      # Treat warnings as errors.
      errorprone_args = []
      errorprone_args += [ "-Werror" ]

      if (!defined(deps)) {
        deps = []
      }

      no_build_hooks = true
    }
  }

  template("rtc_instrumentation_test_apk") {
    instrumentation_test_apk(target_name) {
      forward_variables_from(invoker,
                             "*",
                             [
                               "configs",
                               "public_configs",
                               "suppressed_configs",
                               "visibility",
                             ])

      # Treat warnings as errors.
      errorprone_args = []
      errorprone_args += [ "-Werror" ]

      if (!defined(deps)) {
        deps = []
      }

      no_build_hooks = true
    }
  }
}
