blob: cbd37ef96bc7df165416c2bf09437b0e566d5c94 [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?
68 rtc_include_ilbc = true
69
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
88 # Selects fixed-point code where possible.
89 rtc_prefer_fixed_point = false
90
mbonadei9aa3f0a2017-01-24 06:58:22 -080091 # Enable when an external authentication mechanism is used for performing
92 # packet authentication for RTP packets instead of libsrtp.
93 rtc_enable_external_auth = build_with_chromium
94
95 # Selects whether debug dumps for the audio processing module
96 # should be generated.
97 apm_debug_dump = false
98
Per Åhgrencc73ed32020-04-26 23:56:17 +020099 # Selects whether the audio processing module should be excluded.
100 rtc_exclude_audio_processing_module = false
101
mbonadei9aa3f0a2017-01-24 06:58:22 -0800102 # Set this to true to enable BWE test logging.
103 rtc_enable_bwe_test_logging = false
104
Joachim Bauch93e91342017-12-07 01:25:53 +0100105 # Set this to false to skip building examples.
106 rtc_build_examples = true
107
108 # Set this to false to skip building tools.
109 rtc_build_tools = true
110
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100111 # Set this to false to skip building code that requires X11.
112 rtc_use_x11 = use_x11
113
Tomas Popela318da512018-11-13 06:32:23 +0100114 # Set this to use PipeWire on the Wayland display server.
Tomas Popela762543f2018-12-12 14:37:51 +0100115 # By default it's only enabled on desktop Linux (excludes ChromeOS) and
116 # only when using the sysroot as PipeWire is not available in older and
117 # supported Ubuntu and Debian distributions.
Mirko Bonadei5c1a5652020-05-12 06:14:31 +0000118 rtc_use_pipewire = is_desktop_linux && use_sysroot
Tomas Popela762543f2018-12-12 14:37:51 +0100119
120 # Set this to link PipeWire directly instead of using the dlopen.
121 rtc_link_pipewire = false
Tomas Popela318da512018-11-13 06:32:23 +0100122
mbonadei9aa3f0a2017-01-24 06:58:22 -0800123 # Enable to use the Mozilla internal settings.
124 build_with_mozilla = false
125
henrika883d00f2018-03-16 10:09:49 +0100126 # Enable use of Android AAudio which requires Android SDK 26 or above and
127 # NDK r16 or above.
128 rtc_enable_android_aaudio = false
129
mbonadei9aa3f0a2017-01-24 06:58:22 -0800130 # Set to "func", "block", "edge" for coverage generation.
131 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
132 # It is recommend to set include_examples=0.
133 # Use llvm's sancov -html-report for human readable reports.
134 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
135 rtc_sanitize_coverage = ""
136
mbonadei9aa3f0a2017-01-24 06:58:22 -0800137 if (current_cpu == "arm" || current_cpu == "arm64") {
138 rtc_prefer_fixed_point = true
139 }
140
mbonadei9aa3f0a2017-01-24 06:58:22 -0800141 # Determines whether NEON code will be built.
142 rtc_build_with_neon =
143 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
144
145 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
146 # all platforms except Android and iOS. Because FFmpeg can be built
147 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
148 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Sergey Silkinfe288eb2018-06-25 16:22:38 +0200149 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize.
mbonadei9aa3f0a2017-01-24 06:58:22 -0800150 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
151 # http://www.openh264.org, https://www.ffmpeg.org/
Mirko Bonadeiee0a85c2019-01-15 10:47:18 +0100152 #
153 # Enabling H264 when building with MSVC is currently not supported, see
154 # bugs.webrtc.org/9213#c13 for more info.
155 rtc_use_h264 =
156 proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800157
Markus Handell8e75bd42020-06-05 11:47:40 +0200158 # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
159 rtc_use_absl_mutex = false
160
mbonadei9aa3f0a2017-01-24 06:58:22 -0800161 # By default, use normal platform audio support or dummy audio, but don't
162 # use file-based audio playout and record.
163 rtc_use_dummy_audio_file_devices = false
164
henrika7be78832017-06-13 17:34:16 +0200165 # When set to true, replace the audio output with a sinus tone at 440Hz.
166 # The ADM will ask for audio data from WebRTC but instead of reading real
167 # audio samples from NetEQ, a sinus tone will be generated and replace the
168 # real audio samples.
169 rtc_audio_device_plays_sinus_tone = false
170
Anders Carlsson358f2e02018-06-04 10:24:37 +0200171 if (is_ios) {
172 # Build broadcast extension in AppRTCMobile for iOS. This results in the
173 # binary only running on iOS 11+, which is why it is disabled by default.
174 rtc_apprtcmobile_broadcast_extension = false
175 }
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200176
177 # Determines whether Metal is available on iOS/macOS.
178 rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64")
Jiawei Ou08745302019-02-12 11:36:13 -0800179
180 # When set to false, builtin audio encoder/decoder factories and all the
181 # audio codecs they depend on will not be included in libwebrtc.{a|lib}
182 # (they will still be included in libjingle_peerconnection_so.so and
183 # WebRTC.framework)
184 rtc_include_builtin_audio_codecs = true
185
186 # When set to false, builtin video encoder/decoder factories and all the
187 # video codecs they depends on will not be included in libwebrtc.{a|lib}
188 # (they will still be included in libjingle_peerconnection_so.so and
189 # WebRTC.framework)
190 rtc_include_builtin_video_codecs = true
Mirko Bonadei20574f42019-03-28 07:50:07 +0100191
192 # When set to true and in a standalone build, it will undefine UNICODE and
193 # _UNICODE (which are always defined globally by the Chromium Windows
194 # toolchain).
195 # This is only needed for testing purposes, WebRTC wants to be sure it
196 # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
197 # wide character functions.
198 rtc_win_undef_unicode = false
Dan Minor9c686132018-01-15 10:20:00 -0500199}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800200
Dan Minor9c686132018-01-15 10:20:00 -0500201if (!build_with_mozilla) {
202 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800203}
204
205# A second declare_args block, so that declarations within it can
206# depend on the possibly overridden variables in the first
207# declare_args block.
208declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500209 # Enables the use of protocol buffers for debug recordings.
210 rtc_enable_protobuf = !build_with_mozilla
211
212 # Set this to disable building with support for SCTP data channels.
213 rtc_enable_sctp = !build_with_mozilla
214
215 # Disable these to not build components which can be externally provided.
216 rtc_build_json = !build_with_mozilla
217 rtc_build_libsrtp = !build_with_mozilla
218 rtc_build_libvpx = !build_with_mozilla
219 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500220 rtc_build_opus = !build_with_mozilla
221 rtc_build_ssl = !build_with_mozilla
222 rtc_build_usrsctp = !build_with_mozilla
223
224 # Enable libevent task queues on platforms that support it.
Mirko Bonadei775c02e2019-06-19 19:05:00 +0200225 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
226 target_cpu == "wasm") {
Dan Minor9c686132018-01-15 10:20:00 -0500227 rtc_enable_libevent = false
228 rtc_build_libevent = false
229 } else {
230 rtc_enable_libevent = true
231 rtc_build_libevent = !build_with_mozilla
232 }
233
Dan Minor9c686132018-01-15 10:20:00 -0500234 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
235 # build environments, even if available for Chromium builds.
236 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
237
mbonadei9aa3f0a2017-01-24 06:58:22 -0800238 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
239 rtc_include_pulse_audio = !build_with_chromium
240
241 # Chromium uses its own IO handling, so the internal ADM is only built for
242 # standalone WebRTC.
243 rtc_include_internal_audio_device = !build_with_chromium
244
245 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500246 rtc_include_tests = !build_with_chromium && !build_with_mozilla
Oleh Prypin240b8932019-06-07 13:27:07 +0200247
248 # Set this to false to skip building code that also requires X11 extensions
249 # such as Xdamage, Xfixes.
250 rtc_use_x11_extensions = rtc_use_x11
Artem Titov6a4a1462019-11-26 16:24:46 +0100251
252 # Set this to true to fully remove logging from WebRTC.
253 rtc_disable_logging = false
Doudou Kisabaka2dec4962019-11-28 14:24:31 +0100254
255 # Set this to true to disable trace events.
256 rtc_disable_trace_events = false
Artem Titov9dc209a2019-11-28 17:09:30 +0100257
258 # Set this to true to disable detailed error message and logging for
259 # RTC_CHECKs.
260 rtc_disable_check_msg = false
Ying Wangef3998f2019-12-09 13:06:53 +0100261
262 # Set this to true to disable webrtc metrics.
Mirko Bonadei3c4fda22019-12-10 15:02:53 +0100263 rtc_disable_metrics = false
sazaaa42ecd2020-04-01 15:24:40 +0200264
265 # Set this to true to exclude the transient suppressor in the audio processing
266 # module from the build.
267 rtc_exclude_transient_suppressor = false
mbonadei9aa3f0a2017-01-24 06:58:22 -0800268}
269
270# Make it possible to provide custom locations for some libraries (move these
271# up into declare_args should we need to actually use them for the GN build).
272rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800273rtc_opus_dir = "//third_party/opus"
274
275# Desktop capturer is supported only on Windows, OSX and Linux.
Oleh Prypin240b8932019-06-07 13:27:07 +0200276rtc_desktop_capture_supported =
277 (is_win && current_os != "winuwp") || is_mac ||
278 (is_linux && (rtc_use_x11_extensions || rtc_use_pipewire))
mbonadei9aa3f0a2017-01-24 06:58:22 -0800279
280###############################################################################
281# Templates
282#
283
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200284# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800285# chromium.
286# We need absolute paths for all configs in templates as they are shared in
287# different subdirectories.
288webrtc_root = get_path_info(".", "abspath")
289
290# Global configuration that should be applied to all WebRTC targets.
291# You normally shouldn't need to include this in your target as it's
292# automatically included when using the rtc_* templates.
293# It sets defines, include paths and compilation warnings accordingly,
294# both for WebRTC stand-alone builds and for the scenario when WebRTC
295# native code is built as part of Chromium.
Will Harrisfc173d02018-08-29 13:56:00 -0700296rtc_common_configs = [
297 webrtc_root + ":common_config",
298 "//build/config/compiler:no_size_t_to_int_warning",
299]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800300
kthelgasonc0977102017-04-24 00:57:16 -0700301if (is_mac || is_ios) {
302 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
303}
304
mbonadei9aa3f0a2017-01-24 06:58:22 -0800305# Global public configuration that should be applied to all WebRTC targets. You
306# normally shouldn't need to include this in your target as it's automatically
307# included when using the rtc_* templates. It set the defines, include paths and
308# compilation warnings that should be propagated to dependents of the targets
309# depending on the target having this config.
310rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
311
312# Common configs to remove or add in all rtc targets.
313rtc_remove_configs = []
Mirko Bonadeifc52b912019-03-01 10:32:56 +0100314if (!build_with_chromium && is_clang) {
315 rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
316}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800317rtc_add_configs = rtc_common_configs
Mirko Bonadei96ede162018-09-06 13:45:44 +0200318rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200319rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800320
321set_defaults("rtc_test") {
322 configs = rtc_add_configs
323 suppressed_configs = []
324}
325
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200326set_defaults("rtc_library") {
327 configs = rtc_add_configs
328 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200329 absl_deps = []
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200330}
331
mbonadei9aa3f0a2017-01-24 06:58:22 -0800332set_defaults("rtc_source_set") {
333 configs = rtc_add_configs
334 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200335 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800336}
337
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200338set_defaults("rtc_static_library") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800339 configs = rtc_add_configs
340 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200341 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800342}
343
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200344set_defaults("rtc_executable") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800345 configs = rtc_add_configs
346 suppressed_configs = []
347}
348
349set_defaults("rtc_shared_library") {
350 configs = rtc_add_configs
351 suppressed_configs = []
352}
353
Per Kjellandera7f2d842018-01-10 15:54:53 +0000354webrtc_default_visibility = [ webrtc_root + "/*" ]
355if (build_with_chromium) {
356 # Allow Chromium's WebRTC overrides targets to bypass the regular
357 # visibility restrictions.
358 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
359}
360
Karl Wibergbb23c832018-04-22 19:55:00 +0200361# ---- Poisons ----
362#
363# The general idea is that some targets declare that they contain some
364# kind of poison, which makes it impossible for other targets to
365# depend on them (even transitively) unless they declare themselves
366# immune to that particular type of poison.
367#
368# Targets that *contain* poison of type foo should contain the line
369#
370# poisonous = [ "foo" ]
371#
372# and targets that *are immune but arent't themselves poisonous*
373# should contain
374#
375# allow_poison = [ "foo" ]
376#
377# This useful in cases where we have some large target or set of
378# targets and want to ensure that most other targets do not
379# transitively depend on them. For example, almost no high-level
380# target should depend on the audio codecs, since we want WebRTC users
381# to be able to inject any subset of them and actually end up with a
382# binary that doesn't include the codecs they didn't inject.
383#
384# Test-only targets (`testonly` set to true) and non-public targets
385# (`visibility` not containing "*") are automatically immune to all
386# types of poison.
387#
388# Here's the complete list of all types of poison. It must be kept in
389# 1:1 correspondence with the set of //:poison_* targets.
390#
391all_poison_types = [
392 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
393 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200394
Danil Chapovalov41300af2019-07-10 12:44:43 +0200395 # Default task queue implementation.
396 "default_task_queue",
Sam Zackrisson492fdf42019-10-25 10:45:58 +0200397
398 # JSON parsing should not be needed in the "slim and modular" WebRTC.
399 "rtc_json",
400
401 # Software video codecs (VP8 and VP9 through libvpx).
402 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200403]
404
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000405absl_include_config = "//third_party/abseil-cpp:absl_include_config"
406absl_define_config = "//third_party/abseil-cpp:absl_define_config"
407
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200408# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
409# that are testonly.
410absl_flags_config = webrtc_root + ":absl_flags_configs"
411
mbonadei9aa3f0a2017-01-24 06:58:22 -0800412template("rtc_test") {
413 test(target_name) {
414 forward_variables_from(invoker,
415 "*",
416 [
417 "configs",
418 "public_configs",
419 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200420 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800421 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100422
423 # Always override to public because when target_os is Android the `test`
424 # template can override it to [ "*" ] and we want to avoid conditional
425 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100426 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800427 configs += invoker.configs
428 configs -= rtc_remove_configs
429 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000430 public_configs = [
431 rtc_common_inherited_config,
432 absl_include_config,
433 absl_define_config,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200434 absl_flags_config,
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000435 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800436 if (defined(invoker.public_configs)) {
437 public_configs += invoker.public_configs
438 }
sakald7fdb802017-05-26 01:51:53 -0700439 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800440 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
Oleh Prypina79abd42019-06-25 23:19:17 +0200441 min_sdk_version = 16
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800442 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700443 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800444 }
445}
446
447template("rtc_source_set") {
448 source_set(target_name) {
449 forward_variables_from(invoker,
450 "*",
451 [
452 "configs",
453 "public_configs",
454 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200455 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800456 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200457 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000458 if (!defined(visibility)) {
459 visibility = webrtc_default_visibility
460 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200461
462 # What's your poison?
463 if (defined(testonly) && testonly) {
464 assert(!defined(poisonous))
465 assert(!defined(allow_poison))
466 } else {
467 if (!defined(poisonous)) {
468 poisonous = []
469 }
470 if (!defined(allow_poison)) {
471 allow_poison = []
472 }
473 if (!defined(assert_no_deps)) {
474 assert_no_deps = []
475 }
476 if (!defined(deps)) {
477 deps = []
478 }
479 foreach(p, poisonous) {
480 deps += [ webrtc_root + ":poison_" + p ]
481 }
482 foreach(poison_type, all_poison_types) {
483 allow_dep = true
484 foreach(v, visibility) {
485 if (v == "*") {
486 allow_dep = false
487 }
488 }
489 foreach(p, allow_poison + poisonous) {
490 if (p == poison_type) {
491 allow_dep = true
492 }
493 }
494 if (!allow_dep) {
495 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
496 }
497 }
498 }
499
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100500 # Chromium should only depend on the WebRTC component in order to
501 # avoid to statically link WebRTC in a component build.
502 if (build_with_chromium) {
503 publicly_visible = false
504 foreach(v, visibility) {
505 if (v == "*") {
506 publicly_visible = true
507 }
508 }
509 if (publicly_visible) {
510 visibility = []
511 visibility = webrtc_default_visibility
512 }
513 }
514
Mirko Bonadei96ede162018-09-06 13:45:44 +0200515 if (!defined(testonly) || !testonly) {
516 configs += rtc_prod_configs
517 }
518
mbonadei9aa3f0a2017-01-24 06:58:22 -0800519 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200520 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800521 configs -= rtc_remove_configs
522 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000523 public_configs = [
524 rtc_common_inherited_config,
525 absl_include_config,
526 absl_define_config,
527 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200528 if (defined(testonly) && testonly) {
529 public_configs += [ absl_flags_config ]
530 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800531 if (defined(invoker.public_configs)) {
532 public_configs += invoker.public_configs
533 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200534
535 # If absl_deps if [], no action is needed. If not [], then if needs to be
536 # converted to //third_party/abseil-cpp:absl if is_component_build=true
537 # otherwise it just needs to be added to deps.
538 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200539 if (!defined(deps)) {
540 deps = []
541 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200542 if (is_component_build && build_with_chromium) {
543 # TODO(crbug.com/1046390): Enable when the Abseil component will be
544 # available.
545 # deps += [ "//third_party/abseil-cpp:absl" ]
546 deps += absl_deps # Remove when the line above is enabled.
547 } else {
548 deps += absl_deps
549 }
550 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800551 }
552}
553
mbonadei9aa3f0a2017-01-24 06:58:22 -0800554template("rtc_static_library") {
555 static_library(target_name) {
556 forward_variables_from(invoker,
557 "*",
558 [
559 "configs",
560 "public_configs",
561 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200562 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800563 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200564 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000565 if (!defined(visibility)) {
566 visibility = webrtc_default_visibility
567 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200568
569 # What's your poison?
570 if (defined(testonly) && testonly) {
571 assert(!defined(poisonous))
572 assert(!defined(allow_poison))
573 } else {
574 if (!defined(poisonous)) {
575 poisonous = []
576 }
577 if (!defined(allow_poison)) {
578 allow_poison = []
579 }
580 if (!defined(assert_no_deps)) {
581 assert_no_deps = []
582 }
583 if (!defined(deps)) {
584 deps = []
585 }
586 foreach(p, poisonous) {
587 deps += [ webrtc_root + ":poison_" + p ]
588 }
589 foreach(poison_type, all_poison_types) {
590 allow_dep = true
591 foreach(v, visibility) {
592 if (v == "*") {
593 allow_dep = false
594 }
595 }
596 foreach(p, allow_poison + poisonous) {
597 if (p == poison_type) {
598 allow_dep = true
599 }
600 }
601 if (!allow_dep) {
602 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
603 }
604 }
605 }
606
Mirko Bonadei96ede162018-09-06 13:45:44 +0200607 if (!defined(testonly) || !testonly) {
608 configs += rtc_prod_configs
609 }
610
mbonadei9aa3f0a2017-01-24 06:58:22 -0800611 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200612 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800613 configs -= rtc_remove_configs
614 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000615 public_configs = [
616 rtc_common_inherited_config,
617 absl_include_config,
618 absl_define_config,
619 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200620 if (defined(testonly) && testonly) {
621 public_configs += [ absl_flags_config ]
622 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800623 if (defined(invoker.public_configs)) {
624 public_configs += invoker.public_configs
625 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200626
627 # If absl_deps if [], no action is needed. If not [], then if needs to be
628 # converted to //third_party/abseil-cpp:absl if is_component_build=true
629 # otherwise it just needs to be added to deps.
630 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200631 if (!defined(deps)) {
632 deps = []
633 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200634 if (is_component_build && build_with_chromium) {
635 # TODO(crbug.com/1046390): Enable when the Abseil component will be
636 # available.
637 # deps += [ "//third_party/abseil-cpp:absl" ]
638 deps += absl_deps # Remove when the line above is enabled.
639 } else {
640 deps += absl_deps
641 }
642 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800643 }
644}
645
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200646# This template automatically switches the target type between source_set
647# and static_library.
648#
649# This should be the default target type for all the WebRTC targets with
650# one exception. Do not use this template for header only targets, in that case
651# rtc_source_set must be used in order to avoid build errors (e.g. libtool
652# complains if the output .a file is empty).
653#
654# How does it work:
655# Since all files in a source_set are linked into a final binary, while files
656# in a static library are only linked in if at least one symbol in them is
657# referenced, in component builds source_sets are easy to deal with because
658# all their object files are passed to the linker to create a shared library.
659# In release builds instead, static_libraries are preferred since they allow
660# the linker to discard dead code.
661# For the same reason, testonly targets will always be expanded to
662# source_set in order to be sure that tests are present in the test binary.
663template("rtc_library") {
664 if (is_component_build || (defined(invoker.testonly) && invoker.testonly)) {
665 target_type = "source_set"
666 } else {
667 target_type = "static_library"
668 }
669 target(target_type, target_name) {
670 forward_variables_from(invoker,
671 "*",
672 [
673 "configs",
674 "public_configs",
675 "suppressed_configs",
676 "visibility",
677 ])
678 forward_variables_from(invoker, [ "visibility" ])
679 if (!defined(visibility)) {
680 visibility = webrtc_default_visibility
681 }
682
683 # What's your poison?
684 if (defined(testonly) && testonly) {
685 assert(!defined(poisonous))
686 assert(!defined(allow_poison))
687 } else {
688 if (!defined(poisonous)) {
689 poisonous = []
690 }
691 if (!defined(allow_poison)) {
692 allow_poison = []
693 }
694 if (!defined(assert_no_deps)) {
695 assert_no_deps = []
696 }
697 if (!defined(deps)) {
698 deps = []
699 }
700 foreach(p, poisonous) {
701 deps += [ webrtc_root + ":poison_" + p ]
702 }
703 foreach(poison_type, all_poison_types) {
704 allow_dep = true
705 foreach(v, visibility) {
706 if (v == "*") {
707 allow_dep = false
708 }
709 }
710 foreach(p, allow_poison + poisonous) {
711 if (p == poison_type) {
712 allow_dep = true
713 }
714 }
715 if (!allow_dep) {
716 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
717 }
718 }
719 }
720
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100721 # Chromium should only depend on the WebRTC component in order to
722 # avoid to statically link WebRTC in a component build.
723 if (build_with_chromium) {
724 publicly_visible = false
725 foreach(v, visibility) {
726 if (v == "*") {
727 publicly_visible = true
728 }
729 }
730 if (publicly_visible) {
731 visibility = []
732 visibility = webrtc_default_visibility
733 }
734 }
735
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200736 if (!defined(testonly) || !testonly) {
737 configs += rtc_prod_configs
738 }
739
740 configs += invoker.configs
741 configs += rtc_library_impl_config
742 configs -= rtc_remove_configs
743 configs -= invoker.suppressed_configs
744 public_configs = [
745 rtc_common_inherited_config,
746 absl_include_config,
747 absl_define_config,
748 ]
749 if (defined(testonly) && testonly) {
750 public_configs += [ absl_flags_config ]
751 }
752 if (defined(invoker.public_configs)) {
753 public_configs += invoker.public_configs
754 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200755
756 # If absl_deps if [], no action is needed. If not [], then if needs to be
757 # converted to //third_party/abseil-cpp:absl if is_component_build=true
758 # otherwise it just needs to be added to deps.
759 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200760 if (!defined(deps)) {
761 deps = []
762 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200763 if (is_component_build && build_with_chromium) {
764 # TODO(crbug.com/1046390): Enable when the Abseil component will be
765 # available.
766 # deps += [ "//third_party/abseil-cpp:absl" ]
767 deps += absl_deps # Remove when the line above is enabled.
768 } 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) {
886 set_defaults("rtc_ios_xctest_test") {
887 configs = rtc_add_configs
888 suppressed_configs = []
889 }
890
891 template("rtc_ios_xctest_test") {
892 ios_xctest_test(target_name) {
893 forward_variables_from(invoker,
894 "*",
895 [
896 "configs",
897 "public_configs",
898 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200899 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800900 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200901 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000902 if (!defined(visibility)) {
903 visibility = webrtc_default_visibility
904 }
kthelgason4065a572017-02-14 04:58:56 -0800905 configs += invoker.configs
906 configs -= rtc_remove_configs
907 configs -= invoker.suppressed_configs
908 public_configs = [ rtc_common_inherited_config ]
909 if (defined(invoker.public_configs)) {
910 public_configs += invoker.public_configs
911 }
912 }
913 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100914
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400915 # TODO: Generate module.modulemap file to enable use in Swift
916 # projects. See "mac_framework_bundle_with_umbrella_header".
Anders Carlssondc6b4772018-01-15 13:31:03 +0100917 template("ios_framework_bundle_with_umbrella_header") {
918 forward_variables_from(invoker, [ "output_name" ])
919 umbrella_header_path =
920 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
921
922 ios_framework_bundle(target_name) {
923 forward_variables_from(invoker, "*", [])
924
925 deps += [ ":copy_umbrella_header_$target_name" ]
926 }
927
928 action("umbrella_header_$target_name") {
929 forward_variables_from(invoker, [ "public_headers" ])
930
931 script = "//tools_webrtc/ios/generate_umbrella_header.py"
932
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100933 outputs = [ umbrella_header_path ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100934 args = [
935 "--out",
936 rebase_path(umbrella_header_path, root_build_dir),
937 "--sources",
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200938 ] + public_headers
Anders Carlssondc6b4772018-01-15 13:31:03 +0100939 }
940
941 copy("copy_umbrella_header_$target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100942 sources = [ umbrella_header_path ]
943 outputs =
944 [ "$root_out_dir/$output_name.framework/Headers/$output_name.h" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100945
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100946 deps = [ ":umbrella_header_$target_name" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100947 }
948 }
949
950 set_defaults("ios_framework_bundle_with_umbrella_header") {
951 configs = default_shared_library_configs
952 }
kthelgason4065a572017-02-14 04:58:56 -0800953}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000954
Anders Carlsson37bbf792018-09-05 16:29:27 +0200955if (is_mac) {
956 template("mac_framework_bundle_with_umbrella_header") {
957 forward_variables_from(invoker, [ "output_name" ])
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200958 this_target_name = target_name
959 umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400960 modulemap_path = "$target_gen_dir/Modules/module.modulemap"
Anders Carlsson37bbf792018-09-05 16:29:27 +0200961
962 mac_framework_bundle(target_name) {
Thomas Anderson6fde78c2019-01-23 10:40:29 -0800963 forward_variables_from(invoker, "*", [ "configs" ])
964 if (defined(invoker.configs)) {
965 configs += invoker.configs
966 }
Anders Carlsson37bbf792018-09-05 16:29:27 +0200967
968 framework_version = "A"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400969 framework_contents = [
970 "Headers",
971 "Modules",
972 "Resources",
973 ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200974
975 ldflags = [
976 "-all_load",
977 "-install_name",
978 "@rpath/$output_name.framework/$output_name",
979 ]
980
981 deps += [
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200982 ":copy_framework_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400983 ":copy_modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200984 ":copy_umbrella_header_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400985 ":modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200986 ":umbrella_header_$this_target_name",
Anders Carlsson37bbf792018-09-05 16:29:27 +0200987 ]
988 }
989
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200990 bundle_data("copy_framework_headers_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +0200991 forward_variables_from(invoker, [ "sources" ])
992
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100993 outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200994 }
995
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400996 action("modulemap_$this_target_name") {
997 script = "//tools_webrtc/ios/generate_modulemap.py"
998 args = [
999 "--out",
1000 rebase_path(modulemap_path, root_build_dir),
1001 "--name",
1002 output_name,
1003 ]
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001004 outputs = [ modulemap_path ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -04001005 }
1006
1007 bundle_data("copy_modulemap_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001008 sources = [ modulemap_path ]
1009 outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
1010 deps = [ ":modulemap_$this_target_name" ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -04001011 }
1012
Anders Carlsson95c56ee2018-09-06 15:48:17 +02001013 action("umbrella_header_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +02001014 forward_variables_from(invoker, [ "sources" ])
1015
1016 script = "//tools_webrtc/ios/generate_umbrella_header.py"
1017
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001018 outputs = [ umbrella_header_path ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001019 args = [
1020 "--out",
1021 rebase_path(umbrella_header_path, root_build_dir),
1022 "--sources",
1023 ] + sources
1024 }
1025
Anders Carlsson95c56ee2018-09-06 15:48:17 +02001026 bundle_data("copy_umbrella_header_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001027 sources = [ umbrella_header_path ]
1028 outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001029
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001030 deps = [ ":umbrella_header_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001031 }
1032 }
1033}
1034
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001035if (is_android) {
1036 template("rtc_android_library") {
1037 android_library(target_name) {
1038 forward_variables_from(invoker,
1039 "*",
1040 [
1041 "configs",
1042 "public_configs",
1043 "suppressed_configs",
1044 "visibility",
1045 ])
1046
Oleh Prypin05aee742018-11-23 17:29:44 +01001047 errorprone_args = []
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001048
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001049 # Treat warnings as errors.
Oleh Prypin05aee742018-11-23 17:29:44 +01001050 errorprone_args += [ "-Werror" ]
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001051
1052 # Add any arguments defined by the invoker.
Oleh Prypin05aee742018-11-23 17:29:44 +01001053 if (defined(invoker.errorprone_args)) {
1054 errorprone_args += invoker.errorprone_args
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001055 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001056
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001057 if (!defined(deps)) {
1058 deps = []
1059 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001060
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001061 no_build_hooks = true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +02001062 not_needed([ "android_manifest" ])
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001063 }
1064 }
1065
1066 template("rtc_android_apk") {
1067 android_apk(target_name) {
1068 forward_variables_from(invoker,
1069 "*",
1070 [
1071 "configs",
1072 "public_configs",
1073 "suppressed_configs",
1074 "visibility",
1075 ])
1076
1077 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001078 errorprone_args = []
1079 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001080
Andrey Logvin0c3062e2020-06-09 13:25:46 +00001081 # Use WebRTC-specific android lint suppressions file.
1082 lint_suppressions_file = "//tools_webrtc/android/suppressions.xml"
1083
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001084 if (!defined(deps)) {
1085 deps = []
1086 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001087
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001088 no_build_hooks = true
1089 }
1090 }
1091
1092 template("rtc_instrumentation_test_apk") {
1093 instrumentation_test_apk(target_name) {
1094 forward_variables_from(invoker,
1095 "*",
1096 [
1097 "configs",
1098 "public_configs",
1099 "suppressed_configs",
1100 "visibility",
1101 ])
1102
1103 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001104 errorprone_args = []
1105 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001106
1107 if (!defined(deps)) {
1108 deps = []
1109 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001110
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001111 no_build_hooks = true
1112 }
1113 }
1114}