blob: 23d31b65dc6c904f2081f953fc3fc2641b6f387f [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
Austin Orion25b0dee2020-10-01 13:47:54 -0700198
199 # When set to true, a capturer implementation that uses the
200 # Windows.Graphics.Capture APIs will be available for use. These APIs are
201 # available in the Win 10 SDK v10.0.19041.
202 rtc_enable_win_wgc = false
Dan Minor9c686132018-01-15 10:20:00 -0500203}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800204
Dan Minor9c686132018-01-15 10:20:00 -0500205if (!build_with_mozilla) {
206 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800207}
208
209# A second declare_args block, so that declarations within it can
210# depend on the possibly overridden variables in the first
211# declare_args block.
212declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500213 # Enables the use of protocol buffers for debug recordings.
214 rtc_enable_protobuf = !build_with_mozilla
215
216 # Set this to disable building with support for SCTP data channels.
217 rtc_enable_sctp = !build_with_mozilla
218
219 # Disable these to not build components which can be externally provided.
220 rtc_build_json = !build_with_mozilla
221 rtc_build_libsrtp = !build_with_mozilla
222 rtc_build_libvpx = !build_with_mozilla
223 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500224 rtc_build_opus = !build_with_mozilla
225 rtc_build_ssl = !build_with_mozilla
226 rtc_build_usrsctp = !build_with_mozilla
227
228 # Enable libevent task queues on platforms that support it.
Mirko Bonadei775c02e2019-06-19 19:05:00 +0200229 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
230 target_cpu == "wasm") {
Dan Minor9c686132018-01-15 10:20:00 -0500231 rtc_enable_libevent = false
232 rtc_build_libevent = false
233 } else {
234 rtc_enable_libevent = true
235 rtc_build_libevent = !build_with_mozilla
236 }
237
Dan Minor9c686132018-01-15 10:20:00 -0500238 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
239 # build environments, even if available for Chromium builds.
240 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
241
mbonadei9aa3f0a2017-01-24 06:58:22 -0800242 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
243 rtc_include_pulse_audio = !build_with_chromium
244
245 # Chromium uses its own IO handling, so the internal ADM is only built for
246 # standalone WebRTC.
247 rtc_include_internal_audio_device = !build_with_chromium
248
Zhaoliang Ma72e43212020-08-17 17:13:41 +0800249 # Set this to true to enable the avx2 support in webrtc.
Andrey Logvin082fac72020-10-01 13:38:51 +0000250 # TODO(bugs.webrtc.org/11663): Default this to true and eventually remove.
251 rtc_enable_avx2 = false
Zhaoliang Ma72e43212020-08-17 17:13:41 +0800252
mbonadei9aa3f0a2017-01-24 06:58:22 -0800253 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500254 rtc_include_tests = !build_with_chromium && !build_with_mozilla
Oleh Prypin240b8932019-06-07 13:27:07 +0200255
256 # Set this to false to skip building code that also requires X11 extensions
257 # such as Xdamage, Xfixes.
258 rtc_use_x11_extensions = rtc_use_x11
Artem Titov6a4a1462019-11-26 16:24:46 +0100259
260 # Set this to true to fully remove logging from WebRTC.
261 rtc_disable_logging = false
Doudou Kisabaka2dec4962019-11-28 14:24:31 +0100262
263 # Set this to true to disable trace events.
264 rtc_disable_trace_events = false
Artem Titov9dc209a2019-11-28 17:09:30 +0100265
266 # Set this to true to disable detailed error message and logging for
267 # RTC_CHECKs.
268 rtc_disable_check_msg = false
Ying Wangef3998f2019-12-09 13:06:53 +0100269
270 # Set this to true to disable webrtc metrics.
Mirko Bonadei3c4fda22019-12-10 15:02:53 +0100271 rtc_disable_metrics = false
sazaaa42ecd2020-04-01 15:24:40 +0200272
273 # Set this to true to exclude the transient suppressor in the audio processing
274 # module from the build.
275 rtc_exclude_transient_suppressor = false
mbonadei9aa3f0a2017-01-24 06:58:22 -0800276}
277
278# Make it possible to provide custom locations for some libraries (move these
279# up into declare_args should we need to actually use them for the GN build).
280rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800281rtc_opus_dir = "//third_party/opus"
282
283# Desktop capturer is supported only on Windows, OSX and Linux.
Oleh Prypin240b8932019-06-07 13:27:07 +0200284rtc_desktop_capture_supported =
285 (is_win && current_os != "winuwp") || is_mac ||
Hidehiko Abef264e702020-09-10 18:10:11 +0900286 ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
mbonadei9aa3f0a2017-01-24 06:58:22 -0800287
288###############################################################################
289# Templates
290#
291
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200292# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800293# chromium.
294# We need absolute paths for all configs in templates as they are shared in
295# different subdirectories.
296webrtc_root = get_path_info(".", "abspath")
297
298# Global configuration that should be applied to all WebRTC targets.
299# You normally shouldn't need to include this in your target as it's
300# automatically included when using the rtc_* templates.
301# It sets defines, include paths and compilation warnings accordingly,
302# both for WebRTC stand-alone builds and for the scenario when WebRTC
303# native code is built as part of Chromium.
Will Harrisfc173d02018-08-29 13:56:00 -0700304rtc_common_configs = [
305 webrtc_root + ":common_config",
306 "//build/config/compiler:no_size_t_to_int_warning",
307]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800308
kthelgasonc0977102017-04-24 00:57:16 -0700309if (is_mac || is_ios) {
310 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
311}
312
mbonadei9aa3f0a2017-01-24 06:58:22 -0800313# Global public configuration that should be applied to all WebRTC targets. You
314# normally shouldn't need to include this in your target as it's automatically
315# included when using the rtc_* templates. It set the defines, include paths and
316# compilation warnings that should be propagated to dependents of the targets
317# depending on the target having this config.
318rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
319
320# Common configs to remove or add in all rtc targets.
321rtc_remove_configs = []
Mirko Bonadeifc52b912019-03-01 10:32:56 +0100322if (!build_with_chromium && is_clang) {
323 rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
324}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800325rtc_add_configs = rtc_common_configs
Mirko Bonadei96ede162018-09-06 13:45:44 +0200326rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200327rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800328
329set_defaults("rtc_test") {
330 configs = rtc_add_configs
331 suppressed_configs = []
332}
333
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200334set_defaults("rtc_library") {
335 configs = rtc_add_configs
336 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200337 absl_deps = []
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200338}
339
mbonadei9aa3f0a2017-01-24 06:58:22 -0800340set_defaults("rtc_source_set") {
341 configs = rtc_add_configs
342 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200343 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800344}
345
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200346set_defaults("rtc_static_library") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800347 configs = rtc_add_configs
348 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200349 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800350}
351
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200352set_defaults("rtc_executable") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800353 configs = rtc_add_configs
354 suppressed_configs = []
355}
356
357set_defaults("rtc_shared_library") {
358 configs = rtc_add_configs
359 suppressed_configs = []
360}
361
Per Kjellandera7f2d842018-01-10 15:54:53 +0000362webrtc_default_visibility = [ webrtc_root + "/*" ]
363if (build_with_chromium) {
364 # Allow Chromium's WebRTC overrides targets to bypass the regular
365 # visibility restrictions.
366 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
367}
368
Karl Wibergbb23c832018-04-22 19:55:00 +0200369# ---- Poisons ----
370#
371# The general idea is that some targets declare that they contain some
372# kind of poison, which makes it impossible for other targets to
373# depend on them (even transitively) unless they declare themselves
374# immune to that particular type of poison.
375#
376# Targets that *contain* poison of type foo should contain the line
377#
378# poisonous = [ "foo" ]
379#
380# and targets that *are immune but arent't themselves poisonous*
381# should contain
382#
383# allow_poison = [ "foo" ]
384#
385# This useful in cases where we have some large target or set of
386# targets and want to ensure that most other targets do not
387# transitively depend on them. For example, almost no high-level
388# target should depend on the audio codecs, since we want WebRTC users
389# to be able to inject any subset of them and actually end up with a
390# binary that doesn't include the codecs they didn't inject.
391#
392# Test-only targets (`testonly` set to true) and non-public targets
393# (`visibility` not containing "*") are automatically immune to all
394# types of poison.
395#
396# Here's the complete list of all types of poison. It must be kept in
397# 1:1 correspondence with the set of //:poison_* targets.
398#
399all_poison_types = [
400 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
401 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200402
Danil Chapovalov41300af2019-07-10 12:44:43 +0200403 # Default task queue implementation.
404 "default_task_queue",
Sam Zackrisson492fdf42019-10-25 10:45:58 +0200405
406 # JSON parsing should not be needed in the "slim and modular" WebRTC.
407 "rtc_json",
408
409 # Software video codecs (VP8 and VP9 through libvpx).
410 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200411]
412
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000413absl_include_config = "//third_party/abseil-cpp:absl_include_config"
414absl_define_config = "//third_party/abseil-cpp:absl_define_config"
415
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200416# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
417# that are testonly.
418absl_flags_config = webrtc_root + ":absl_flags_configs"
419
mbonadei9aa3f0a2017-01-24 06:58:22 -0800420template("rtc_test") {
421 test(target_name) {
422 forward_variables_from(invoker,
423 "*",
424 [
425 "configs",
426 "public_configs",
427 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200428 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800429 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100430
431 # Always override to public because when target_os is Android the `test`
432 # template can override it to [ "*" ] and we want to avoid conditional
433 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100434 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800435 configs += invoker.configs
436 configs -= rtc_remove_configs
437 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000438 public_configs = [
439 rtc_common_inherited_config,
440 absl_include_config,
441 absl_define_config,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200442 absl_flags_config,
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000443 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800444 if (defined(invoker.public_configs)) {
445 public_configs += invoker.public_configs
446 }
sakald7fdb802017-05-26 01:51:53 -0700447 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800448 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
Jeremy Leconteb19cfee2020-06-25 22:57:49 +0200449 min_sdk_version = 21
Mirko Bonadeibd393b22020-07-10 23:00:41 +0200450 target_sdk_version = 23
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800451 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700452 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800453 }
454}
455
456template("rtc_source_set") {
457 source_set(target_name) {
458 forward_variables_from(invoker,
459 "*",
460 [
461 "configs",
462 "public_configs",
463 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200464 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800465 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200466 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000467 if (!defined(visibility)) {
468 visibility = webrtc_default_visibility
469 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200470
471 # What's your poison?
472 if (defined(testonly) && testonly) {
473 assert(!defined(poisonous))
474 assert(!defined(allow_poison))
475 } else {
476 if (!defined(poisonous)) {
477 poisonous = []
478 }
479 if (!defined(allow_poison)) {
480 allow_poison = []
481 }
482 if (!defined(assert_no_deps)) {
483 assert_no_deps = []
484 }
485 if (!defined(deps)) {
486 deps = []
487 }
488 foreach(p, poisonous) {
489 deps += [ webrtc_root + ":poison_" + p ]
490 }
491 foreach(poison_type, all_poison_types) {
492 allow_dep = true
493 foreach(v, visibility) {
494 if (v == "*") {
495 allow_dep = false
496 }
497 }
498 foreach(p, allow_poison + poisonous) {
499 if (p == poison_type) {
500 allow_dep = true
501 }
502 }
503 if (!allow_dep) {
504 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
505 }
506 }
507 }
508
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100509 # Chromium should only depend on the WebRTC component in order to
510 # avoid to statically link WebRTC in a component build.
511 if (build_with_chromium) {
512 publicly_visible = false
513 foreach(v, visibility) {
514 if (v == "*") {
515 publicly_visible = true
516 }
517 }
518 if (publicly_visible) {
519 visibility = []
520 visibility = webrtc_default_visibility
521 }
522 }
523
Mirko Bonadei96ede162018-09-06 13:45:44 +0200524 if (!defined(testonly) || !testonly) {
525 configs += rtc_prod_configs
526 }
527
mbonadei9aa3f0a2017-01-24 06:58:22 -0800528 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200529 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800530 configs -= rtc_remove_configs
531 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000532 public_configs = [
533 rtc_common_inherited_config,
534 absl_include_config,
535 absl_define_config,
536 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200537 if (defined(testonly) && testonly) {
538 public_configs += [ absl_flags_config ]
539 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800540 if (defined(invoker.public_configs)) {
541 public_configs += invoker.public_configs
542 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200543
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200544 # If absl_deps is [], no action is needed. If not [], then it needs to be
545 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200546 # otherwise it just needs to be added to deps.
547 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200548 if (!defined(deps)) {
549 deps = []
550 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200551 if (build_with_chromium) {
552 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200553 } else {
554 deps += absl_deps
555 }
556 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800557 }
558}
559
mbonadei9aa3f0a2017-01-24 06:58:22 -0800560template("rtc_static_library") {
561 static_library(target_name) {
562 forward_variables_from(invoker,
563 "*",
564 [
565 "configs",
566 "public_configs",
567 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200568 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800569 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200570 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000571 if (!defined(visibility)) {
572 visibility = webrtc_default_visibility
573 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200574
575 # What's your poison?
576 if (defined(testonly) && testonly) {
577 assert(!defined(poisonous))
578 assert(!defined(allow_poison))
579 } else {
580 if (!defined(poisonous)) {
581 poisonous = []
582 }
583 if (!defined(allow_poison)) {
584 allow_poison = []
585 }
586 if (!defined(assert_no_deps)) {
587 assert_no_deps = []
588 }
589 if (!defined(deps)) {
590 deps = []
591 }
592 foreach(p, poisonous) {
593 deps += [ webrtc_root + ":poison_" + p ]
594 }
595 foreach(poison_type, all_poison_types) {
596 allow_dep = true
597 foreach(v, visibility) {
598 if (v == "*") {
599 allow_dep = false
600 }
601 }
602 foreach(p, allow_poison + poisonous) {
603 if (p == poison_type) {
604 allow_dep = true
605 }
606 }
607 if (!allow_dep) {
608 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
609 }
610 }
611 }
612
Mirko Bonadei96ede162018-09-06 13:45:44 +0200613 if (!defined(testonly) || !testonly) {
614 configs += rtc_prod_configs
615 }
616
mbonadei9aa3f0a2017-01-24 06:58:22 -0800617 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200618 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800619 configs -= rtc_remove_configs
620 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000621 public_configs = [
622 rtc_common_inherited_config,
623 absl_include_config,
624 absl_define_config,
625 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200626 if (defined(testonly) && testonly) {
627 public_configs += [ absl_flags_config ]
628 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800629 if (defined(invoker.public_configs)) {
630 public_configs += invoker.public_configs
631 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200632
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200633 # If absl_deps is [], no action is needed. If not [], then it needs to be
634 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200635 # otherwise it just needs to be added to deps.
636 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200637 if (!defined(deps)) {
638 deps = []
639 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200640 if (build_with_chromium) {
641 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200642 } else {
643 deps += absl_deps
644 }
645 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800646 }
647}
648
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200649# This template automatically switches the target type between source_set
650# and static_library.
651#
652# This should be the default target type for all the WebRTC targets with
653# one exception. Do not use this template for header only targets, in that case
654# rtc_source_set must be used in order to avoid build errors (e.g. libtool
655# complains if the output .a file is empty).
656#
657# How does it work:
658# Since all files in a source_set are linked into a final binary, while files
659# in a static library are only linked in if at least one symbol in them is
660# referenced, in component builds source_sets are easy to deal with because
661# all their object files are passed to the linker to create a shared library.
662# In release builds instead, static_libraries are preferred since they allow
663# the linker to discard dead code.
664# For the same reason, testonly targets will always be expanded to
665# source_set in order to be sure that tests are present in the test binary.
666template("rtc_library") {
667 if (is_component_build || (defined(invoker.testonly) && invoker.testonly)) {
668 target_type = "source_set"
669 } else {
670 target_type = "static_library"
671 }
672 target(target_type, target_name) {
673 forward_variables_from(invoker,
674 "*",
675 [
676 "configs",
677 "public_configs",
678 "suppressed_configs",
679 "visibility",
680 ])
681 forward_variables_from(invoker, [ "visibility" ])
682 if (!defined(visibility)) {
683 visibility = webrtc_default_visibility
684 }
685
686 # What's your poison?
687 if (defined(testonly) && testonly) {
688 assert(!defined(poisonous))
689 assert(!defined(allow_poison))
690 } else {
691 if (!defined(poisonous)) {
692 poisonous = []
693 }
694 if (!defined(allow_poison)) {
695 allow_poison = []
696 }
697 if (!defined(assert_no_deps)) {
698 assert_no_deps = []
699 }
700 if (!defined(deps)) {
701 deps = []
702 }
703 foreach(p, poisonous) {
704 deps += [ webrtc_root + ":poison_" + p ]
705 }
706 foreach(poison_type, all_poison_types) {
707 allow_dep = true
708 foreach(v, visibility) {
709 if (v == "*") {
710 allow_dep = false
711 }
712 }
713 foreach(p, allow_poison + poisonous) {
714 if (p == poison_type) {
715 allow_dep = true
716 }
717 }
718 if (!allow_dep) {
719 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
720 }
721 }
722 }
723
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100724 # Chromium should only depend on the WebRTC component in order to
725 # avoid to statically link WebRTC in a component build.
726 if (build_with_chromium) {
727 publicly_visible = false
728 foreach(v, visibility) {
729 if (v == "*") {
730 publicly_visible = true
731 }
732 }
733 if (publicly_visible) {
734 visibility = []
735 visibility = webrtc_default_visibility
736 }
737 }
738
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200739 if (!defined(testonly) || !testonly) {
740 configs += rtc_prod_configs
741 }
742
743 configs += invoker.configs
744 configs += rtc_library_impl_config
745 configs -= rtc_remove_configs
746 configs -= invoker.suppressed_configs
747 public_configs = [
748 rtc_common_inherited_config,
749 absl_include_config,
750 absl_define_config,
751 ]
752 if (defined(testonly) && testonly) {
753 public_configs += [ absl_flags_config ]
754 }
755 if (defined(invoker.public_configs)) {
756 public_configs += invoker.public_configs
757 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200758
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200759 # If absl_deps is [], no action is needed. If not [], then it needs to be
760 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200761 # otherwise it just needs to be added to deps.
762 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200763 if (!defined(deps)) {
764 deps = []
765 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200766 if (build_with_chromium) {
767 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200768 } else {
769 deps += absl_deps
770 }
771 }
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200772 }
773}
774
775template("rtc_executable") {
776 executable(target_name) {
777 forward_variables_from(invoker,
778 "*",
779 [
780 "deps",
781 "configs",
782 "public_configs",
783 "suppressed_configs",
784 "visibility",
785 ])
786 forward_variables_from(invoker, [ "visibility" ])
787 if (!defined(visibility)) {
788 visibility = webrtc_default_visibility
789 }
790 configs += invoker.configs
791 configs -= rtc_remove_configs
792 configs -= invoker.suppressed_configs
793 deps = invoker.deps
794
795 public_configs = [
796 rtc_common_inherited_config,
797 absl_include_config,
798 absl_define_config,
799 ]
800 if (defined(testonly) && testonly) {
801 public_configs += [ absl_flags_config ]
802 }
803 if (defined(invoker.public_configs)) {
804 public_configs += invoker.public_configs
805 }
806 if (is_win) {
807 deps += [
808 # Give executables the default manifest on Windows (a no-op elsewhere).
809 "//build/win:default_exe_manifest",
810 ]
811 }
812 }
813}
814
mbonadei9aa3f0a2017-01-24 06:58:22 -0800815template("rtc_shared_library") {
816 shared_library(target_name) {
817 forward_variables_from(invoker,
818 "*",
819 [
820 "configs",
821 "public_configs",
822 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200823 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800824 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200825 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000826 if (!defined(visibility)) {
827 visibility = webrtc_default_visibility
828 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200829
830 # What's your poison?
831 if (defined(testonly) && testonly) {
832 assert(!defined(poisonous))
833 assert(!defined(allow_poison))
834 } else {
835 if (!defined(poisonous)) {
836 poisonous = []
837 }
838 if (!defined(allow_poison)) {
839 allow_poison = []
840 }
841 if (!defined(assert_no_deps)) {
842 assert_no_deps = []
843 }
844 if (!defined(deps)) {
845 deps = []
846 }
847 foreach(p, poisonous) {
848 deps += [ webrtc_root + ":poison_" + p ]
849 }
850 foreach(poison_type, all_poison_types) {
851 allow_dep = true
852 foreach(v, visibility) {
853 if (v == "*") {
854 allow_dep = false
855 }
856 }
857 foreach(p, allow_poison + poisonous) {
858 if (p == poison_type) {
859 allow_dep = true
860 }
861 }
862 if (!allow_dep) {
863 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
864 }
865 }
866 }
867
mbonadei9aa3f0a2017-01-24 06:58:22 -0800868 configs += invoker.configs
869 configs -= rtc_remove_configs
870 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000871 public_configs = [
872 rtc_common_inherited_config,
873 absl_include_config,
874 absl_define_config,
875 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200876 if (defined(testonly) && testonly) {
877 public_configs += [ absl_flags_config ]
878 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800879 if (defined(invoker.public_configs)) {
880 public_configs += invoker.public_configs
881 }
882 }
883}
kthelgason4065a572017-02-14 04:58:56 -0800884
885if (is_ios) {
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400886 # TODO: Generate module.modulemap file to enable use in Swift
887 # projects. See "mac_framework_bundle_with_umbrella_header".
Anders Carlssondc6b4772018-01-15 13:31:03 +0100888 template("ios_framework_bundle_with_umbrella_header") {
889 forward_variables_from(invoker, [ "output_name" ])
890 umbrella_header_path =
891 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
892
893 ios_framework_bundle(target_name) {
894 forward_variables_from(invoker, "*", [])
895
896 deps += [ ":copy_umbrella_header_$target_name" ]
897 }
898
899 action("umbrella_header_$target_name") {
900 forward_variables_from(invoker, [ "public_headers" ])
901
902 script = "//tools_webrtc/ios/generate_umbrella_header.py"
903
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100904 outputs = [ umbrella_header_path ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100905 args = [
906 "--out",
907 rebase_path(umbrella_header_path, root_build_dir),
908 "--sources",
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200909 ] + public_headers
Anders Carlssondc6b4772018-01-15 13:31:03 +0100910 }
911
912 copy("copy_umbrella_header_$target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100913 sources = [ umbrella_header_path ]
914 outputs =
915 [ "$root_out_dir/$output_name.framework/Headers/$output_name.h" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100916
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100917 deps = [ ":umbrella_header_$target_name" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100918 }
919 }
920
921 set_defaults("ios_framework_bundle_with_umbrella_header") {
922 configs = default_shared_library_configs
923 }
kthelgason4065a572017-02-14 04:58:56 -0800924}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000925
Anders Carlsson37bbf792018-09-05 16:29:27 +0200926if (is_mac) {
927 template("mac_framework_bundle_with_umbrella_header") {
928 forward_variables_from(invoker, [ "output_name" ])
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200929 this_target_name = target_name
930 umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400931 modulemap_path = "$target_gen_dir/Modules/module.modulemap"
Anders Carlsson37bbf792018-09-05 16:29:27 +0200932
933 mac_framework_bundle(target_name) {
Thomas Anderson6fde78c2019-01-23 10:40:29 -0800934 forward_variables_from(invoker, "*", [ "configs" ])
935 if (defined(invoker.configs)) {
936 configs += invoker.configs
937 }
Anders Carlsson37bbf792018-09-05 16:29:27 +0200938
939 framework_version = "A"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400940 framework_contents = [
941 "Headers",
942 "Modules",
943 "Resources",
944 ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200945
946 ldflags = [
947 "-all_load",
948 "-install_name",
949 "@rpath/$output_name.framework/$output_name",
950 ]
951
952 deps += [
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200953 ":copy_framework_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400954 ":copy_modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200955 ":copy_umbrella_header_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400956 ":modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200957 ":umbrella_header_$this_target_name",
Anders Carlsson37bbf792018-09-05 16:29:27 +0200958 ]
959 }
960
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200961 bundle_data("copy_framework_headers_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +0200962 forward_variables_from(invoker, [ "sources" ])
963
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100964 outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200965 }
966
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400967 action("modulemap_$this_target_name") {
968 script = "//tools_webrtc/ios/generate_modulemap.py"
969 args = [
970 "--out",
971 rebase_path(modulemap_path, root_build_dir),
972 "--name",
973 output_name,
974 ]
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100975 outputs = [ modulemap_path ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400976 }
977
978 bundle_data("copy_modulemap_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100979 sources = [ modulemap_path ]
980 outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
981 deps = [ ":modulemap_$this_target_name" ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400982 }
983
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200984 action("umbrella_header_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +0200985 forward_variables_from(invoker, [ "sources" ])
986
987 script = "//tools_webrtc/ios/generate_umbrella_header.py"
988
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100989 outputs = [ umbrella_header_path ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200990 args = [
991 "--out",
992 rebase_path(umbrella_header_path, root_build_dir),
993 "--sources",
994 ] + sources
995 }
996
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200997 bundle_data("copy_umbrella_header_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100998 sources = [ umbrella_header_path ]
999 outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001000
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001001 deps = [ ":umbrella_header_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001002 }
1003 }
1004}
1005
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001006if (is_android) {
1007 template("rtc_android_library") {
1008 android_library(target_name) {
1009 forward_variables_from(invoker,
1010 "*",
1011 [
1012 "configs",
1013 "public_configs",
1014 "suppressed_configs",
1015 "visibility",
1016 ])
1017
Oleh Prypin05aee742018-11-23 17:29:44 +01001018 errorprone_args = []
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001019
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001020 # Treat warnings as errors.
Oleh Prypin05aee742018-11-23 17:29:44 +01001021 errorprone_args += [ "-Werror" ]
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001022
1023 # Add any arguments defined by the invoker.
Oleh Prypin05aee742018-11-23 17:29:44 +01001024 if (defined(invoker.errorprone_args)) {
1025 errorprone_args += invoker.errorprone_args
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001026 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001027
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001028 if (!defined(deps)) {
1029 deps = []
1030 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001031
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001032 no_build_hooks = true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +02001033 not_needed([ "android_manifest" ])
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001034 }
1035 }
1036
1037 template("rtc_android_apk") {
1038 android_apk(target_name) {
1039 forward_variables_from(invoker,
1040 "*",
1041 [
1042 "configs",
1043 "public_configs",
1044 "suppressed_configs",
1045 "visibility",
1046 ])
1047
1048 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001049 errorprone_args = []
1050 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001051
1052 if (!defined(deps)) {
1053 deps = []
1054 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001055
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001056 no_build_hooks = true
1057 }
1058 }
1059
1060 template("rtc_instrumentation_test_apk") {
1061 instrumentation_test_apk(target_name) {
1062 forward_variables_from(invoker,
1063 "*",
1064 [
1065 "configs",
1066 "public_configs",
1067 "suppressed_configs",
1068 "visibility",
1069 ])
1070
1071 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001072 errorprone_args = []
1073 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001074
1075 if (!defined(deps)) {
1076 deps = []
1077 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001078
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001079 no_build_hooks = true
1080 }
1081 }
1082}