blob: ca8acdbf259fb29e401e9661958ca58f38d73de2 [file] [log] [blame]
mbonadei9aa3f0a2017-01-24 06:58:22 -08001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
mbonadei9aa3f0a2017-01-24 06:58:22 -08008import("//build/config/arm.gni")
9import("//build/config/features.gni")
10import("//build/config/mips.gni")
11import("//build/config/sanitizers/sanitizers.gni")
Tomas Popela318da512018-11-13 06:32:23 +010012import("//build/config/sysroot.gni")
ehmaldonado0d729b32017-02-10 01:38:23 -080013import("//build/config/ui.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080014import("//build_overrides/build.gni")
mbonadei96606272017-03-03 19:41:59 -080015
16if (!build_with_chromium && is_component_build) {
17 print("The Gn argument `is_component_build` is currently " +
18 "ignored for WebRTC builds.")
19 print("Component builds are supported by Chromium and the argument " +
20 "`is_component_build` makes it possible to create shared libraries " +
21 "instead of static libraries.")
22 print("If an app depends on WebRTC it makes sense to just depend on the " +
23 "WebRTC static library, so there is no difference between " +
24 "`is_component_build=true` and `is_component_build=false`.")
25 print(
26 "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md")
27 assert(!is_component_build, "Component builds are not supported in WebRTC.")
28}
29
kthelgason4065a572017-02-14 04:58:56 -080030if (is_ios) {
31 import("//build/config/ios/rules.gni")
32}
mbonadei9aa3f0a2017-01-24 06:58:22 -080033
Anders Carlsson37bbf792018-09-05 16:29:27 +020034if (is_mac) {
35 import("//build/config/mac/rules.gni")
36}
37
mbonadei9aa3f0a2017-01-24 06:58:22 -080038declare_args() {
Mirko Bonadei028248c2018-10-10 12:19:02 +020039 # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
40 # expand to code that will manage symbols visibility.
41 rtc_enable_symbol_export = false
42
Mirko Bonadei31b0b452018-08-22 10:37:11 +020043 # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
Mirko Bonadei70400902018-08-21 15:44:28 +020044 # will tell the pre-processor to remove the default definition of symbols
45 # needed to use field_trial. In that case a new implementation needs to be
46 # provided.
Mirko Bonadei31b0b452018-08-22 10:37:11 +020047 if (build_with_chromium) {
48 # When WebRTC is built as part of Chromium it should exclude the default
49 # implementation of field_trial unless it is building for NACL or
50 # Chromecast.
51 rtc_exclude_field_trial_default = !is_nacl && !is_chromecast
52 } else {
53 rtc_exclude_field_trial_default = false
54 }
Mirko Bonadei70400902018-08-21 15:44:28 +020055
Mirko Bonadei906add42018-09-05 16:03:16 +020056 # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
57 # will tell the pre-processor to remove the default definition of symbols
58 # needed to use metrics. In that case a new implementation needs to be
59 # provided.
60 rtc_exclude_metrics_default = build_with_chromium
61
Benjamin Wrightd6f86e82018-05-08 13:12:25 -070062 # Setting this to false will require the API user to pass in their own
63 # SSLCertificateVerifier to verify the certificates presented from a
64 # TLS-TURN server. In return disabling this saves around 100kb in the binary.
65 rtc_builtin_ssl_root_certificates = true
66
Karl Wibergeb254b42017-11-01 15:08:12 +010067 # Include the iLBC audio codec?
Olga Sharonova5fbd7582020-07-09 09:50:42 +000068 rtc_include_ilbc = true
Karl Wibergeb254b42017-11-01 15:08:12 +010069
mbonadei9aa3f0a2017-01-24 06:58:22 -080070 # Disable this to avoid building the Opus audio codec.
71 rtc_include_opus = true
72
minyue2e03c662017-02-01 17:31:11 -080073 # Enable this if the Opus version upon which WebRTC is built supports direct
74 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 17:45:49 +020075 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-01 17:31:11 -080076
mbonadei9aa3f0a2017-01-24 06:58:22 -080077 # Enable this to let the Opus audio codec change complexity on the fly.
78 rtc_opus_variable_complexity = false
79
mbonadei9aa3f0a2017-01-24 06:58:22 -080080 # Used to specify an external Jsoncpp include path when not compiling the
81 # library that comes with WebRTC (i.e. rtc_build_json == 0).
82 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
83
84 # Used to specify an external OpenSSL include path when not compiling the
85 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
86 rtc_ssl_root = ""
87
mbonadei9aa3f0a2017-01-24 06:58:22 -080088 # Enable when an external authentication mechanism is used for performing
89 # packet authentication for RTP packets instead of libsrtp.
90 rtc_enable_external_auth = build_with_chromium
91
92 # Selects whether debug dumps for the audio processing module
93 # should be generated.
94 apm_debug_dump = false
95
Per Åhgrencc73ed32020-04-26 23:56:17 +020096 # Selects whether the audio processing module should be excluded.
97 rtc_exclude_audio_processing_module = false
98
mbonadei9aa3f0a2017-01-24 06:58:22 -080099 # Set this to true to enable BWE test logging.
100 rtc_enable_bwe_test_logging = false
101
Joachim Bauch93e91342017-12-07 01:25:53 +0100102 # Set this to false to skip building examples.
103 rtc_build_examples = true
104
105 # Set this to false to skip building tools.
106 rtc_build_tools = true
107
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100108 # Set this to false to skip building code that requires X11.
109 rtc_use_x11 = use_x11
110
Tomas Popela318da512018-11-13 06:32:23 +0100111 # Set this to use PipeWire on the Wayland display server.
Tomas Popela762543f2018-12-12 14:37:51 +0100112 # By default it's only enabled on desktop Linux (excludes ChromeOS) and
113 # only when using the sysroot as PipeWire is not available in older and
114 # supported Ubuntu and Debian distributions.
Mirko Bonadei5c1a5652020-05-12 06:14:31 +0000115 rtc_use_pipewire = is_desktop_linux && use_sysroot
Tomas Popela762543f2018-12-12 14:37:51 +0100116
117 # Set this to link PipeWire directly instead of using the dlopen.
118 rtc_link_pipewire = false
Tomas Popela318da512018-11-13 06:32:23 +0100119
mbonadei9aa3f0a2017-01-24 06:58:22 -0800120 # Enable to use the Mozilla internal settings.
121 build_with_mozilla = false
122
Philipp Hanckee95ebda2020-09-17 16:13:20 +0200123 # Experimental: enable use of Android AAudio which requires Android SDK 26 or above
124 # and NDK r16 or above.
henrika883d00f2018-03-16 10:09:49 +0100125 rtc_enable_android_aaudio = false
126
mbonadei9aa3f0a2017-01-24 06:58:22 -0800127 # Set to "func", "block", "edge" for coverage generation.
128 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
129 # It is recommend to set include_examples=0.
130 # Use llvm's sancov -html-report for human readable reports.
131 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
132 rtc_sanitize_coverage = ""
133
Philipp Hanckeaeac9f82020-09-11 11:58:18 +0200134 # Selects fixed-point code where possible.
135 rtc_prefer_fixed_point = false
mbonadei9aa3f0a2017-01-24 06:58:22 -0800136 if (current_cpu == "arm" || current_cpu == "arm64") {
137 rtc_prefer_fixed_point = true
138 }
139
mbonadei9aa3f0a2017-01-24 06:58:22 -0800140 # Determines whether NEON code will be built.
141 rtc_build_with_neon =
142 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
143
144 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
145 # all platforms except Android and iOS. Because FFmpeg can be built
146 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
147 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Sergey Silkinfe288eb2018-06-25 16:22:38 +0200148 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize.
mbonadei9aa3f0a2017-01-24 06:58:22 -0800149 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
150 # http://www.openh264.org, https://www.ffmpeg.org/
Mirko Bonadeiee0a85c2019-01-15 10:47:18 +0100151 #
152 # Enabling H264 when building with MSVC is currently not supported, see
153 # bugs.webrtc.org/9213#c13 for more info.
154 rtc_use_h264 =
155 proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800156
Markus Handell8e75bd42020-06-05 11:47:40 +0200157 # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
158 rtc_use_absl_mutex = false
159
mbonadei9aa3f0a2017-01-24 06:58:22 -0800160 # By default, use normal platform audio support or dummy audio, but don't
161 # use file-based audio playout and record.
162 rtc_use_dummy_audio_file_devices = false
163
henrika7be78832017-06-13 17:34:16 +0200164 # When set to true, replace the audio output with a sinus tone at 440Hz.
165 # The ADM will ask for audio data from WebRTC but instead of reading real
166 # audio samples from NetEQ, a sinus tone will be generated and replace the
167 # real audio samples.
168 rtc_audio_device_plays_sinus_tone = false
169
Anders Carlsson358f2e02018-06-04 10:24:37 +0200170 if (is_ios) {
171 # Build broadcast extension in AppRTCMobile for iOS. This results in the
172 # binary only running on iOS 11+, which is why it is disabled by default.
173 rtc_apprtcmobile_broadcast_extension = false
174 }
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200175
176 # Determines whether Metal is available on iOS/macOS.
177 rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64")
Jiawei Ou08745302019-02-12 11:36:13 -0800178
179 # When set to false, builtin audio encoder/decoder factories and all the
180 # audio codecs they depend on will not be included in libwebrtc.{a|lib}
181 # (they will still be included in libjingle_peerconnection_so.so and
182 # WebRTC.framework)
183 rtc_include_builtin_audio_codecs = true
184
185 # When set to false, builtin video encoder/decoder factories and all the
186 # video codecs they depends on will not be included in libwebrtc.{a|lib}
187 # (they will still be included in libjingle_peerconnection_so.so and
188 # WebRTC.framework)
189 rtc_include_builtin_video_codecs = true
Mirko Bonadei20574f42019-03-28 07:50:07 +0100190
191 # When set to true and in a standalone build, it will undefine UNICODE and
192 # _UNICODE (which are always defined globally by the Chromium Windows
193 # toolchain).
194 # This is only needed for testing purposes, WebRTC wants to be sure it
195 # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
196 # wide character functions.
197 rtc_win_undef_unicode = false
Dan Minor9c686132018-01-15 10:20:00 -0500198}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800199
Dan Minor9c686132018-01-15 10:20:00 -0500200if (!build_with_mozilla) {
201 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800202}
203
204# A second declare_args block, so that declarations within it can
205# depend on the possibly overridden variables in the first
206# declare_args block.
207declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500208 # Enables the use of protocol buffers for debug recordings.
209 rtc_enable_protobuf = !build_with_mozilla
210
211 # Set this to disable building with support for SCTP data channels.
212 rtc_enable_sctp = !build_with_mozilla
213
214 # Disable these to not build components which can be externally provided.
215 rtc_build_json = !build_with_mozilla
216 rtc_build_libsrtp = !build_with_mozilla
217 rtc_build_libvpx = !build_with_mozilla
218 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500219 rtc_build_opus = !build_with_mozilla
220 rtc_build_ssl = !build_with_mozilla
221 rtc_build_usrsctp = !build_with_mozilla
222
223 # Enable libevent task queues on platforms that support it.
Mirko Bonadei775c02e2019-06-19 19:05:00 +0200224 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
225 target_cpu == "wasm") {
Dan Minor9c686132018-01-15 10:20:00 -0500226 rtc_enable_libevent = false
227 rtc_build_libevent = false
228 } else {
229 rtc_enable_libevent = true
230 rtc_build_libevent = !build_with_mozilla
231 }
232
Dan Minor9c686132018-01-15 10:20:00 -0500233 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
234 # build environments, even if available for Chromium builds.
235 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
236
mbonadei9aa3f0a2017-01-24 06:58:22 -0800237 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
238 rtc_include_pulse_audio = !build_with_chromium
239
240 # Chromium uses its own IO handling, so the internal ADM is only built for
241 # standalone WebRTC.
242 rtc_include_internal_audio_device = !build_with_chromium
243
Zhaoliang Ma72e43212020-08-17 17:13:41 +0800244 # Set this to true to enable the avx2 support in webrtc.
Per Åhgrena0ad0bb2020-09-25 12:02:32 +0200245 # TODO: Make sure that AVX2 works also for non-clang compilers.
246 if (is_clang == true) {
247 rtc_enable_avx2 = true
248 } else {
249 rtc_enable_avx2 = false
250 }
Zhaoliang Ma72e43212020-08-17 17:13:41 +0800251
mbonadei9aa3f0a2017-01-24 06:58:22 -0800252 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500253 rtc_include_tests = !build_with_chromium && !build_with_mozilla
Oleh Prypin240b8932019-06-07 13:27:07 +0200254
255 # Set this to false to skip building code that also requires X11 extensions
256 # such as Xdamage, Xfixes.
257 rtc_use_x11_extensions = rtc_use_x11
Artem Titov6a4a1462019-11-26 16:24:46 +0100258
259 # Set this to true to fully remove logging from WebRTC.
260 rtc_disable_logging = false
Doudou Kisabaka2dec4962019-11-28 14:24:31 +0100261
262 # Set this to true to disable trace events.
263 rtc_disable_trace_events = false
Artem Titov9dc209a2019-11-28 17:09:30 +0100264
265 # Set this to true to disable detailed error message and logging for
266 # RTC_CHECKs.
267 rtc_disable_check_msg = false
Ying Wangef3998f2019-12-09 13:06:53 +0100268
269 # Set this to true to disable webrtc metrics.
Mirko Bonadei3c4fda22019-12-10 15:02:53 +0100270 rtc_disable_metrics = false
sazaaa42ecd2020-04-01 15:24:40 +0200271
272 # Set this to true to exclude the transient suppressor in the audio processing
273 # module from the build.
274 rtc_exclude_transient_suppressor = false
mbonadei9aa3f0a2017-01-24 06:58:22 -0800275}
276
277# Make it possible to provide custom locations for some libraries (move these
278# up into declare_args should we need to actually use them for the GN build).
279rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800280rtc_opus_dir = "//third_party/opus"
281
282# Desktop capturer is supported only on Windows, OSX and Linux.
Oleh Prypin240b8932019-06-07 13:27:07 +0200283rtc_desktop_capture_supported =
284 (is_win && current_os != "winuwp") || is_mac ||
Hidehiko Abef264e702020-09-10 18:10:11 +0900285 ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
mbonadei9aa3f0a2017-01-24 06:58:22 -0800286
287###############################################################################
288# Templates
289#
290
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200291# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800292# chromium.
293# We need absolute paths for all configs in templates as they are shared in
294# different subdirectories.
295webrtc_root = get_path_info(".", "abspath")
296
297# Global configuration that should be applied to all WebRTC targets.
298# You normally shouldn't need to include this in your target as it's
299# automatically included when using the rtc_* templates.
300# It sets defines, include paths and compilation warnings accordingly,
301# both for WebRTC stand-alone builds and for the scenario when WebRTC
302# native code is built as part of Chromium.
Will Harrisfc173d02018-08-29 13:56:00 -0700303rtc_common_configs = [
304 webrtc_root + ":common_config",
305 "//build/config/compiler:no_size_t_to_int_warning",
306]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800307
kthelgasonc0977102017-04-24 00:57:16 -0700308if (is_mac || is_ios) {
309 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
310}
311
mbonadei9aa3f0a2017-01-24 06:58:22 -0800312# Global public configuration that should be applied to all WebRTC targets. You
313# normally shouldn't need to include this in your target as it's automatically
314# included when using the rtc_* templates. It set the defines, include paths and
315# compilation warnings that should be propagated to dependents of the targets
316# depending on the target having this config.
317rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
318
319# Common configs to remove or add in all rtc targets.
320rtc_remove_configs = []
Mirko Bonadeifc52b912019-03-01 10:32:56 +0100321if (!build_with_chromium && is_clang) {
322 rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
323}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800324rtc_add_configs = rtc_common_configs
Mirko Bonadei96ede162018-09-06 13:45:44 +0200325rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200326rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800327
328set_defaults("rtc_test") {
329 configs = rtc_add_configs
330 suppressed_configs = []
331}
332
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200333set_defaults("rtc_library") {
334 configs = rtc_add_configs
335 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200336 absl_deps = []
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200337}
338
mbonadei9aa3f0a2017-01-24 06:58:22 -0800339set_defaults("rtc_source_set") {
340 configs = rtc_add_configs
341 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200342 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800343}
344
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200345set_defaults("rtc_static_library") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800346 configs = rtc_add_configs
347 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200348 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800349}
350
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200351set_defaults("rtc_executable") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800352 configs = rtc_add_configs
353 suppressed_configs = []
354}
355
356set_defaults("rtc_shared_library") {
357 configs = rtc_add_configs
358 suppressed_configs = []
359}
360
Per Kjellandera7f2d842018-01-10 15:54:53 +0000361webrtc_default_visibility = [ webrtc_root + "/*" ]
362if (build_with_chromium) {
363 # Allow Chromium's WebRTC overrides targets to bypass the regular
364 # visibility restrictions.
365 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
366}
367
Karl Wibergbb23c832018-04-22 19:55:00 +0200368# ---- Poisons ----
369#
370# The general idea is that some targets declare that they contain some
371# kind of poison, which makes it impossible for other targets to
372# depend on them (even transitively) unless they declare themselves
373# immune to that particular type of poison.
374#
375# Targets that *contain* poison of type foo should contain the line
376#
377# poisonous = [ "foo" ]
378#
379# and targets that *are immune but arent't themselves poisonous*
380# should contain
381#
382# allow_poison = [ "foo" ]
383#
384# This useful in cases where we have some large target or set of
385# targets and want to ensure that most other targets do not
386# transitively depend on them. For example, almost no high-level
387# target should depend on the audio codecs, since we want WebRTC users
388# to be able to inject any subset of them and actually end up with a
389# binary that doesn't include the codecs they didn't inject.
390#
391# Test-only targets (`testonly` set to true) and non-public targets
392# (`visibility` not containing "*") are automatically immune to all
393# types of poison.
394#
395# Here's the complete list of all types of poison. It must be kept in
396# 1:1 correspondence with the set of //:poison_* targets.
397#
398all_poison_types = [
399 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
400 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200401
Danil Chapovalov41300af2019-07-10 12:44:43 +0200402 # Default task queue implementation.
403 "default_task_queue",
Sam Zackrisson492fdf42019-10-25 10:45:58 +0200404
405 # JSON parsing should not be needed in the "slim and modular" WebRTC.
406 "rtc_json",
407
408 # Software video codecs (VP8 and VP9 through libvpx).
409 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200410]
411
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000412absl_include_config = "//third_party/abseil-cpp:absl_include_config"
413absl_define_config = "//third_party/abseil-cpp:absl_define_config"
414
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200415# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
416# that are testonly.
417absl_flags_config = webrtc_root + ":absl_flags_configs"
418
mbonadei9aa3f0a2017-01-24 06:58:22 -0800419template("rtc_test") {
420 test(target_name) {
421 forward_variables_from(invoker,
422 "*",
423 [
424 "configs",
425 "public_configs",
426 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200427 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800428 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100429
430 # Always override to public because when target_os is Android the `test`
431 # template can override it to [ "*" ] and we want to avoid conditional
432 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100433 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800434 configs += invoker.configs
435 configs -= rtc_remove_configs
436 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000437 public_configs = [
438 rtc_common_inherited_config,
439 absl_include_config,
440 absl_define_config,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200441 absl_flags_config,
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000442 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800443 if (defined(invoker.public_configs)) {
444 public_configs += invoker.public_configs
445 }
sakald7fdb802017-05-26 01:51:53 -0700446 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800447 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
Jeremy Leconteb19cfee2020-06-25 22:57:49 +0200448 min_sdk_version = 21
Mirko Bonadeibd393b22020-07-10 23:00:41 +0200449 target_sdk_version = 23
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800450 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700451 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800452 }
453}
454
455template("rtc_source_set") {
456 source_set(target_name) {
457 forward_variables_from(invoker,
458 "*",
459 [
460 "configs",
461 "public_configs",
462 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200463 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800464 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200465 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000466 if (!defined(visibility)) {
467 visibility = webrtc_default_visibility
468 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200469
470 # What's your poison?
471 if (defined(testonly) && testonly) {
472 assert(!defined(poisonous))
473 assert(!defined(allow_poison))
474 } else {
475 if (!defined(poisonous)) {
476 poisonous = []
477 }
478 if (!defined(allow_poison)) {
479 allow_poison = []
480 }
481 if (!defined(assert_no_deps)) {
482 assert_no_deps = []
483 }
484 if (!defined(deps)) {
485 deps = []
486 }
487 foreach(p, poisonous) {
488 deps += [ webrtc_root + ":poison_" + p ]
489 }
490 foreach(poison_type, all_poison_types) {
491 allow_dep = true
492 foreach(v, visibility) {
493 if (v == "*") {
494 allow_dep = false
495 }
496 }
497 foreach(p, allow_poison + poisonous) {
498 if (p == poison_type) {
499 allow_dep = true
500 }
501 }
502 if (!allow_dep) {
503 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
504 }
505 }
506 }
507
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100508 # Chromium should only depend on the WebRTC component in order to
509 # avoid to statically link WebRTC in a component build.
510 if (build_with_chromium) {
511 publicly_visible = false
512 foreach(v, visibility) {
513 if (v == "*") {
514 publicly_visible = true
515 }
516 }
517 if (publicly_visible) {
518 visibility = []
519 visibility = webrtc_default_visibility
520 }
521 }
522
Mirko Bonadei96ede162018-09-06 13:45:44 +0200523 if (!defined(testonly) || !testonly) {
524 configs += rtc_prod_configs
525 }
526
mbonadei9aa3f0a2017-01-24 06:58:22 -0800527 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200528 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800529 configs -= rtc_remove_configs
530 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000531 public_configs = [
532 rtc_common_inherited_config,
533 absl_include_config,
534 absl_define_config,
535 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200536 if (defined(testonly) && testonly) {
537 public_configs += [ absl_flags_config ]
538 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800539 if (defined(invoker.public_configs)) {
540 public_configs += invoker.public_configs
541 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200542
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200543 # If absl_deps is [], no action is needed. If not [], then it needs to be
544 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200545 # otherwise it just needs to be added to deps.
546 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200547 if (!defined(deps)) {
548 deps = []
549 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200550 if (build_with_chromium) {
551 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200552 } else {
553 deps += absl_deps
554 }
555 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800556 }
557}
558
mbonadei9aa3f0a2017-01-24 06:58:22 -0800559template("rtc_static_library") {
560 static_library(target_name) {
561 forward_variables_from(invoker,
562 "*",
563 [
564 "configs",
565 "public_configs",
566 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200567 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800568 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200569 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000570 if (!defined(visibility)) {
571 visibility = webrtc_default_visibility
572 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200573
574 # What's your poison?
575 if (defined(testonly) && testonly) {
576 assert(!defined(poisonous))
577 assert(!defined(allow_poison))
578 } else {
579 if (!defined(poisonous)) {
580 poisonous = []
581 }
582 if (!defined(allow_poison)) {
583 allow_poison = []
584 }
585 if (!defined(assert_no_deps)) {
586 assert_no_deps = []
587 }
588 if (!defined(deps)) {
589 deps = []
590 }
591 foreach(p, poisonous) {
592 deps += [ webrtc_root + ":poison_" + p ]
593 }
594 foreach(poison_type, all_poison_types) {
595 allow_dep = true
596 foreach(v, visibility) {
597 if (v == "*") {
598 allow_dep = false
599 }
600 }
601 foreach(p, allow_poison + poisonous) {
602 if (p == poison_type) {
603 allow_dep = true
604 }
605 }
606 if (!allow_dep) {
607 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
608 }
609 }
610 }
611
Mirko Bonadei96ede162018-09-06 13:45:44 +0200612 if (!defined(testonly) || !testonly) {
613 configs += rtc_prod_configs
614 }
615
mbonadei9aa3f0a2017-01-24 06:58:22 -0800616 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200617 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800618 configs -= rtc_remove_configs
619 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000620 public_configs = [
621 rtc_common_inherited_config,
622 absl_include_config,
623 absl_define_config,
624 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200625 if (defined(testonly) && testonly) {
626 public_configs += [ absl_flags_config ]
627 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800628 if (defined(invoker.public_configs)) {
629 public_configs += invoker.public_configs
630 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200631
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200632 # If absl_deps is [], no action is needed. If not [], then it needs to be
633 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200634 # otherwise it just needs to be added to deps.
635 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200636 if (!defined(deps)) {
637 deps = []
638 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200639 if (build_with_chromium) {
640 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200641 } else {
642 deps += absl_deps
643 }
644 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800645 }
646}
647
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200648# This template automatically switches the target type between source_set
649# and static_library.
650#
651# This should be the default target type for all the WebRTC targets with
652# one exception. Do not use this template for header only targets, in that case
653# rtc_source_set must be used in order to avoid build errors (e.g. libtool
654# complains if the output .a file is empty).
655#
656# How does it work:
657# Since all files in a source_set are linked into a final binary, while files
658# in a static library are only linked in if at least one symbol in them is
659# referenced, in component builds source_sets are easy to deal with because
660# all their object files are passed to the linker to create a shared library.
661# In release builds instead, static_libraries are preferred since they allow
662# the linker to discard dead code.
663# For the same reason, testonly targets will always be expanded to
664# source_set in order to be sure that tests are present in the test binary.
665template("rtc_library") {
666 if (is_component_build || (defined(invoker.testonly) && invoker.testonly)) {
667 target_type = "source_set"
668 } else {
669 target_type = "static_library"
670 }
671 target(target_type, target_name) {
672 forward_variables_from(invoker,
673 "*",
674 [
675 "configs",
676 "public_configs",
677 "suppressed_configs",
678 "visibility",
679 ])
680 forward_variables_from(invoker, [ "visibility" ])
681 if (!defined(visibility)) {
682 visibility = webrtc_default_visibility
683 }
684
685 # What's your poison?
686 if (defined(testonly) && testonly) {
687 assert(!defined(poisonous))
688 assert(!defined(allow_poison))
689 } else {
690 if (!defined(poisonous)) {
691 poisonous = []
692 }
693 if (!defined(allow_poison)) {
694 allow_poison = []
695 }
696 if (!defined(assert_no_deps)) {
697 assert_no_deps = []
698 }
699 if (!defined(deps)) {
700 deps = []
701 }
702 foreach(p, poisonous) {
703 deps += [ webrtc_root + ":poison_" + p ]
704 }
705 foreach(poison_type, all_poison_types) {
706 allow_dep = true
707 foreach(v, visibility) {
708 if (v == "*") {
709 allow_dep = false
710 }
711 }
712 foreach(p, allow_poison + poisonous) {
713 if (p == poison_type) {
714 allow_dep = true
715 }
716 }
717 if (!allow_dep) {
718 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
719 }
720 }
721 }
722
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100723 # Chromium should only depend on the WebRTC component in order to
724 # avoid to statically link WebRTC in a component build.
725 if (build_with_chromium) {
726 publicly_visible = false
727 foreach(v, visibility) {
728 if (v == "*") {
729 publicly_visible = true
730 }
731 }
732 if (publicly_visible) {
733 visibility = []
734 visibility = webrtc_default_visibility
735 }
736 }
737
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200738 if (!defined(testonly) || !testonly) {
739 configs += rtc_prod_configs
740 }
741
742 configs += invoker.configs
743 configs += rtc_library_impl_config
744 configs -= rtc_remove_configs
745 configs -= invoker.suppressed_configs
746 public_configs = [
747 rtc_common_inherited_config,
748 absl_include_config,
749 absl_define_config,
750 ]
751 if (defined(testonly) && testonly) {
752 public_configs += [ absl_flags_config ]
753 }
754 if (defined(invoker.public_configs)) {
755 public_configs += invoker.public_configs
756 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200757
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200758 # If absl_deps is [], no action is needed. If not [], then it needs to be
759 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200760 # otherwise it just needs to be added to deps.
761 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200762 if (!defined(deps)) {
763 deps = []
764 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200765 if (build_with_chromium) {
766 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200767 } else {
768 deps += absl_deps
769 }
770 }
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200771 }
772}
773
774template("rtc_executable") {
775 executable(target_name) {
776 forward_variables_from(invoker,
777 "*",
778 [
779 "deps",
780 "configs",
781 "public_configs",
782 "suppressed_configs",
783 "visibility",
784 ])
785 forward_variables_from(invoker, [ "visibility" ])
786 if (!defined(visibility)) {
787 visibility = webrtc_default_visibility
788 }
789 configs += invoker.configs
790 configs -= rtc_remove_configs
791 configs -= invoker.suppressed_configs
792 deps = invoker.deps
793
794 public_configs = [
795 rtc_common_inherited_config,
796 absl_include_config,
797 absl_define_config,
798 ]
799 if (defined(testonly) && testonly) {
800 public_configs += [ absl_flags_config ]
801 }
802 if (defined(invoker.public_configs)) {
803 public_configs += invoker.public_configs
804 }
805 if (is_win) {
806 deps += [
807 # Give executables the default manifest on Windows (a no-op elsewhere).
808 "//build/win:default_exe_manifest",
809 ]
810 }
811 }
812}
813
mbonadei9aa3f0a2017-01-24 06:58:22 -0800814template("rtc_shared_library") {
815 shared_library(target_name) {
816 forward_variables_from(invoker,
817 "*",
818 [
819 "configs",
820 "public_configs",
821 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200822 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800823 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200824 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000825 if (!defined(visibility)) {
826 visibility = webrtc_default_visibility
827 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200828
829 # What's your poison?
830 if (defined(testonly) && testonly) {
831 assert(!defined(poisonous))
832 assert(!defined(allow_poison))
833 } else {
834 if (!defined(poisonous)) {
835 poisonous = []
836 }
837 if (!defined(allow_poison)) {
838 allow_poison = []
839 }
840 if (!defined(assert_no_deps)) {
841 assert_no_deps = []
842 }
843 if (!defined(deps)) {
844 deps = []
845 }
846 foreach(p, poisonous) {
847 deps += [ webrtc_root + ":poison_" + p ]
848 }
849 foreach(poison_type, all_poison_types) {
850 allow_dep = true
851 foreach(v, visibility) {
852 if (v == "*") {
853 allow_dep = false
854 }
855 }
856 foreach(p, allow_poison + poisonous) {
857 if (p == poison_type) {
858 allow_dep = true
859 }
860 }
861 if (!allow_dep) {
862 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
863 }
864 }
865 }
866
mbonadei9aa3f0a2017-01-24 06:58:22 -0800867 configs += invoker.configs
868 configs -= rtc_remove_configs
869 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000870 public_configs = [
871 rtc_common_inherited_config,
872 absl_include_config,
873 absl_define_config,
874 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200875 if (defined(testonly) && testonly) {
876 public_configs += [ absl_flags_config ]
877 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800878 if (defined(invoker.public_configs)) {
879 public_configs += invoker.public_configs
880 }
881 }
882}
kthelgason4065a572017-02-14 04:58:56 -0800883
884if (is_ios) {
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400885 # TODO: Generate module.modulemap file to enable use in Swift
886 # projects. See "mac_framework_bundle_with_umbrella_header".
Anders Carlssondc6b4772018-01-15 13:31:03 +0100887 template("ios_framework_bundle_with_umbrella_header") {
888 forward_variables_from(invoker, [ "output_name" ])
889 umbrella_header_path =
890 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
891
892 ios_framework_bundle(target_name) {
893 forward_variables_from(invoker, "*", [])
894
895 deps += [ ":copy_umbrella_header_$target_name" ]
896 }
897
898 action("umbrella_header_$target_name") {
899 forward_variables_from(invoker, [ "public_headers" ])
900
901 script = "//tools_webrtc/ios/generate_umbrella_header.py"
902
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100903 outputs = [ umbrella_header_path ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100904 args = [
905 "--out",
906 rebase_path(umbrella_header_path, root_build_dir),
907 "--sources",
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200908 ] + public_headers
Anders Carlssondc6b4772018-01-15 13:31:03 +0100909 }
910
911 copy("copy_umbrella_header_$target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100912 sources = [ umbrella_header_path ]
913 outputs =
914 [ "$root_out_dir/$output_name.framework/Headers/$output_name.h" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100915
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100916 deps = [ ":umbrella_header_$target_name" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100917 }
918 }
919
920 set_defaults("ios_framework_bundle_with_umbrella_header") {
921 configs = default_shared_library_configs
922 }
kthelgason4065a572017-02-14 04:58:56 -0800923}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000924
Anders Carlsson37bbf792018-09-05 16:29:27 +0200925if (is_mac) {
926 template("mac_framework_bundle_with_umbrella_header") {
927 forward_variables_from(invoker, [ "output_name" ])
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200928 this_target_name = target_name
929 umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400930 modulemap_path = "$target_gen_dir/Modules/module.modulemap"
Anders Carlsson37bbf792018-09-05 16:29:27 +0200931
932 mac_framework_bundle(target_name) {
Thomas Anderson6fde78c2019-01-23 10:40:29 -0800933 forward_variables_from(invoker, "*", [ "configs" ])
934 if (defined(invoker.configs)) {
935 configs += invoker.configs
936 }
Anders Carlsson37bbf792018-09-05 16:29:27 +0200937
938 framework_version = "A"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400939 framework_contents = [
940 "Headers",
941 "Modules",
942 "Resources",
943 ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200944
945 ldflags = [
946 "-all_load",
947 "-install_name",
948 "@rpath/$output_name.framework/$output_name",
949 ]
950
951 deps += [
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200952 ":copy_framework_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400953 ":copy_modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200954 ":copy_umbrella_header_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400955 ":modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200956 ":umbrella_header_$this_target_name",
Anders Carlsson37bbf792018-09-05 16:29:27 +0200957 ]
958 }
959
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200960 bundle_data("copy_framework_headers_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +0200961 forward_variables_from(invoker, [ "sources" ])
962
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100963 outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200964 }
965
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400966 action("modulemap_$this_target_name") {
967 script = "//tools_webrtc/ios/generate_modulemap.py"
968 args = [
969 "--out",
970 rebase_path(modulemap_path, root_build_dir),
971 "--name",
972 output_name,
973 ]
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100974 outputs = [ modulemap_path ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400975 }
976
977 bundle_data("copy_modulemap_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100978 sources = [ modulemap_path ]
979 outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
980 deps = [ ":modulemap_$this_target_name" ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400981 }
982
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200983 action("umbrella_header_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +0200984 forward_variables_from(invoker, [ "sources" ])
985
986 script = "//tools_webrtc/ios/generate_umbrella_header.py"
987
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100988 outputs = [ umbrella_header_path ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200989 args = [
990 "--out",
991 rebase_path(umbrella_header_path, root_build_dir),
992 "--sources",
993 ] + sources
994 }
995
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200996 bundle_data("copy_umbrella_header_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100997 sources = [ umbrella_header_path ]
998 outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200999
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001000 deps = [ ":umbrella_header_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001001 }
1002 }
1003}
1004
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001005if (is_android) {
1006 template("rtc_android_library") {
1007 android_library(target_name) {
1008 forward_variables_from(invoker,
1009 "*",
1010 [
1011 "configs",
1012 "public_configs",
1013 "suppressed_configs",
1014 "visibility",
1015 ])
1016
Oleh Prypin05aee742018-11-23 17:29:44 +01001017 errorprone_args = []
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001018
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001019 # Treat warnings as errors.
Oleh Prypin05aee742018-11-23 17:29:44 +01001020 errorprone_args += [ "-Werror" ]
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001021
1022 # Add any arguments defined by the invoker.
Oleh Prypin05aee742018-11-23 17:29:44 +01001023 if (defined(invoker.errorprone_args)) {
1024 errorprone_args += invoker.errorprone_args
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001025 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001026
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001027 if (!defined(deps)) {
1028 deps = []
1029 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001030
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001031 no_build_hooks = true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +02001032 not_needed([ "android_manifest" ])
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001033 }
1034 }
1035
1036 template("rtc_android_apk") {
1037 android_apk(target_name) {
1038 forward_variables_from(invoker,
1039 "*",
1040 [
1041 "configs",
1042 "public_configs",
1043 "suppressed_configs",
1044 "visibility",
1045 ])
1046
1047 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001048 errorprone_args = []
1049 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001050
1051 if (!defined(deps)) {
1052 deps = []
1053 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001054
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001055 no_build_hooks = true
1056 }
1057 }
1058
1059 template("rtc_instrumentation_test_apk") {
1060 instrumentation_test_apk(target_name) {
1061 forward_variables_from(invoker,
1062 "*",
1063 [
1064 "configs",
1065 "public_configs",
1066 "suppressed_configs",
1067 "visibility",
1068 ])
1069
1070 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001071 errorprone_args = []
1072 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001073
1074 if (!defined(deps)) {
1075 deps = []
1076 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001077
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001078 no_build_hooks = true
1079 }
1080 }
1081}