blob: 66f8b11cde9ec2335cd2114c852425a7d08e1fce [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")
ehmaldonado0d729b32017-02-10 01:38:23 -080012import("//build/config/ui.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080013import("//build_overrides/build.gni")
mbonadei96606272017-03-03 19:41:59 -080014
15if (!build_with_chromium && is_component_build) {
16 print("The Gn argument `is_component_build` is currently " +
17 "ignored for WebRTC builds.")
18 print("Component builds are supported by Chromium and the argument " +
19 "`is_component_build` makes it possible to create shared libraries " +
20 "instead of static libraries.")
21 print("If an app depends on WebRTC it makes sense to just depend on the " +
22 "WebRTC static library, so there is no difference between " +
23 "`is_component_build=true` and `is_component_build=false`.")
24 print(
25 "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md")
26 assert(!is_component_build, "Component builds are not supported in WebRTC.")
27}
28
kthelgason4065a572017-02-14 04:58:56 -080029if (is_ios) {
30 import("//build/config/ios/rules.gni")
31}
mbonadei9aa3f0a2017-01-24 06:58:22 -080032
33declare_args() {
Karl Wibergeb254b42017-11-01 15:08:12 +010034 # Include the iLBC audio codec?
35 rtc_include_ilbc = true
36
mbonadei9aa3f0a2017-01-24 06:58:22 -080037 # Disable this to avoid building the Opus audio codec.
38 rtc_include_opus = true
39
minyue2e03c662017-02-01 17:31:11 -080040 # Enable this if the Opus version upon which WebRTC is built supports direct
41 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 17:45:49 +020042 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-01 17:31:11 -080043
mbonadei9aa3f0a2017-01-24 06:58:22 -080044 # Enable this to let the Opus audio codec change complexity on the fly.
45 rtc_opus_variable_complexity = false
46
mbonadei9aa3f0a2017-01-24 06:58:22 -080047 # Used to specify an external Jsoncpp include path when not compiling the
48 # library that comes with WebRTC (i.e. rtc_build_json == 0).
49 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
50
51 # Used to specify an external OpenSSL include path when not compiling the
52 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
53 rtc_ssl_root = ""
54
55 # Selects fixed-point code where possible.
56 rtc_prefer_fixed_point = false
57
mbonadei9aa3f0a2017-01-24 06:58:22 -080058 # Disable the code for the intelligibility enhancer by default.
59 rtc_enable_intelligibility_enhancer = false
60
61 # Enable when an external authentication mechanism is used for performing
62 # packet authentication for RTP packets instead of libsrtp.
63 rtc_enable_external_auth = build_with_chromium
64
65 # Selects whether debug dumps for the audio processing module
66 # should be generated.
67 apm_debug_dump = false
68
69 # Set this to true to enable BWE test logging.
70 rtc_enable_bwe_test_logging = false
71
Joachim Bauch93e91342017-12-07 01:25:53 +010072 # Set this to false to skip building examples.
73 rtc_build_examples = true
74
75 # Set this to false to skip building tools.
76 rtc_build_tools = true
77
Joachim Bauch75f18fc2017-12-20 21:25:47 +010078 # Set this to false to skip building code that requires X11.
79 rtc_use_x11 = use_x11
80
mbonadei9aa3f0a2017-01-24 06:58:22 -080081 # Enable to use the Mozilla internal settings.
82 build_with_mozilla = false
83
henrika883d00f2018-03-16 10:09:49 +010084 # Enable use of Android AAudio which requires Android SDK 26 or above and
85 # NDK r16 or above.
86 rtc_enable_android_aaudio = false
87
88 # TODO(henrika): can this flag be removed?
mbonadei9aa3f0a2017-01-24 06:58:22 -080089 rtc_enable_android_opensl = false
90
91 # Link-Time Optimizations.
92 # Executes code generation at link-time instead of compile-time.
93 # https://gcc.gnu.org/wiki/LinkTimeOptimization
94 rtc_use_lto = false
95
96 # Set to "func", "block", "edge" for coverage generation.
97 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
98 # It is recommend to set include_examples=0.
99 # Use llvm's sancov -html-report for human readable reports.
100 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
101 rtc_sanitize_coverage = ""
102
perkj650fdae2017-08-25 05:00:11 -0700103 # Links a default implementation of task queues to targets
104 # that depend on the target rtc_task_queue. Set to false to
105 # use an external implementation.
106 rtc_link_task_queue_impl = true
107
mbonadei9aa3f0a2017-01-24 06:58:22 -0800108 if (current_cpu == "arm" || current_cpu == "arm64") {
109 rtc_prefer_fixed_point = true
110 }
111
mbonadei9aa3f0a2017-01-24 06:58:22 -0800112 # Determines whether NEON code will be built.
113 rtc_build_with_neon =
114 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
115
116 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
117 # all platforms except Android and iOS. Because FFmpeg can be built
118 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
119 # value that includes H.264, for example "Chrome". If FFmpeg is built without
120 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See
121 # also: |rtc_initialize_ffmpeg|.
122 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
123 # http://www.openh264.org, https://www.ffmpeg.org/
Patrik Höglund3bb11942018-03-16 12:36:26 +0000124 rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
mbonadei9aa3f0a2017-01-24 06:58:22 -0800125
mbonadei9aa3f0a2017-01-24 06:58:22 -0800126 # By default, use normal platform audio support or dummy audio, but don't
127 # use file-based audio playout and record.
128 rtc_use_dummy_audio_file_devices = false
129
henrika7be78832017-06-13 17:34:16 +0200130 # When set to true, replace the audio output with a sinus tone at 440Hz.
131 # The ADM will ask for audio data from WebRTC but instead of reading real
132 # audio samples from NetEQ, a sinus tone will be generated and replace the
133 # real audio samples.
134 rtc_audio_device_plays_sinus_tone = false
135
mbonadei9aa3f0a2017-01-24 06:58:22 -0800136 # When set to true, test targets will declare the files needed to run memcheck
137 # as data dependencies. This is to enable memcheck execution on swarming bots.
138 rtc_use_memcheck = false
139
140 # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done
141 # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must
142 # only be initialized once. Projects that initialize FFmpeg externally, such
143 # as Chromium, must turn this flag off so that WebRTC does not also
144 # initialize.
145 rtc_initialize_ffmpeg = !build_with_chromium
Anders Carlssondd8c1652018-01-30 10:32:13 +0100146
147 # Disable this to build without support for built-in software codecs.
148 rtc_use_builtin_sw_codecs = true
Dan Minor9c686132018-01-15 10:20:00 -0500149}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800150
Dan Minor9c686132018-01-15 10:20:00 -0500151if (!build_with_mozilla) {
152 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800153}
154
155# A second declare_args block, so that declarations within it can
156# depend on the possibly overridden variables in the first
157# declare_args block.
158declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500159 # Enables the use of protocol buffers for debug recordings.
160 rtc_enable_protobuf = !build_with_mozilla
161
162 # Set this to disable building with support for SCTP data channels.
163 rtc_enable_sctp = !build_with_mozilla
164
165 # Disable these to not build components which can be externally provided.
166 rtc_build_json = !build_with_mozilla
167 rtc_build_libsrtp = !build_with_mozilla
168 rtc_build_libvpx = !build_with_mozilla
169 rtc_libvpx_build_vp9 = !build_with_mozilla
170 rtc_build_openmax_dl = !build_with_mozilla
171 rtc_build_opus = !build_with_mozilla
172 rtc_build_ssl = !build_with_mozilla
173 rtc_build_usrsctp = !build_with_mozilla
174
175 # Enable libevent task queues on platforms that support it.
176 # rtc_link_task_queue_impl must be set to true for this to
177 # have an effect.
Wez00cecb92018-02-09 10:41:00 -0800178 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) {
Dan Minor9c686132018-01-15 10:20:00 -0500179 rtc_enable_libevent = false
180 rtc_build_libevent = false
181 } else {
182 rtc_enable_libevent = true
183 rtc_build_libevent = !build_with_mozilla
184 }
185
186 if (!is_ios && (current_cpu != "arm" || arm_version >= 7) &&
187 current_cpu != "mips64el" && !build_with_mozilla) {
188 rtc_use_openmax_dl = true
189 } else {
190 rtc_use_openmax_dl = false
191 }
192
193 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
194 # build environments, even if available for Chromium builds.
195 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
196
mbonadei9aa3f0a2017-01-24 06:58:22 -0800197 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
198 rtc_include_pulse_audio = !build_with_chromium
199
200 # Chromium uses its own IO handling, so the internal ADM is only built for
201 # standalone WebRTC.
202 rtc_include_internal_audio_device = !build_with_chromium
203
204 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500205 rtc_include_tests = !build_with_chromium && !build_with_mozilla
mbonadei9aa3f0a2017-01-24 06:58:22 -0800206}
207
208# Make it possible to provide custom locations for some libraries (move these
209# up into declare_args should we need to actually use them for the GN build).
210rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800211rtc_opus_dir = "//third_party/opus"
212
213# Desktop capturer is supported only on Windows, OSX and Linux.
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100214rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800215
216###############################################################################
217# Templates
218#
219
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200220# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800221# chromium.
222# We need absolute paths for all configs in templates as they are shared in
223# different subdirectories.
224webrtc_root = get_path_info(".", "abspath")
225
226# Global configuration that should be applied to all WebRTC targets.
227# You normally shouldn't need to include this in your target as it's
228# automatically included when using the rtc_* templates.
229# It sets defines, include paths and compilation warnings accordingly,
230# both for WebRTC stand-alone builds and for the scenario when WebRTC
231# native code is built as part of Chromium.
232rtc_common_configs = [ webrtc_root + ":common_config" ]
233
kthelgasonc0977102017-04-24 00:57:16 -0700234if (is_mac || is_ios) {
235 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
236}
237
mbonadei9aa3f0a2017-01-24 06:58:22 -0800238# Global public configuration that should be applied to all WebRTC targets. You
239# normally shouldn't need to include this in your target as it's automatically
240# included when using the rtc_* templates. It set the defines, include paths and
241# compilation warnings that should be propagated to dependents of the targets
242# depending on the target having this config.
243rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
244
245# Common configs to remove or add in all rtc targets.
246rtc_remove_configs = []
247rtc_add_configs = rtc_common_configs
248
249set_defaults("rtc_test") {
250 configs = rtc_add_configs
251 suppressed_configs = []
252}
253
254set_defaults("rtc_source_set") {
255 configs = rtc_add_configs
256 suppressed_configs = []
257}
258
259set_defaults("rtc_executable") {
260 configs = rtc_add_configs
261 suppressed_configs = []
262}
263
264set_defaults("rtc_static_library") {
265 configs = rtc_add_configs
266 suppressed_configs = []
267}
268
269set_defaults("rtc_shared_library") {
270 configs = rtc_add_configs
271 suppressed_configs = []
272}
273
Per Kjellandera7f2d842018-01-10 15:54:53 +0000274webrtc_default_visibility = [ webrtc_root + "/*" ]
275if (build_with_chromium) {
276 # Allow Chromium's WebRTC overrides targets to bypass the regular
277 # visibility restrictions.
278 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
279}
280
Mirko Bonadei9d8f3852018-04-16 19:59:11 -0700281absl_include_config = "//third_party/abseil-cpp:absl_include_config"
282absl_define_config = "//third_party/abseil-cpp:absl_define_config"
283
mbonadei9aa3f0a2017-01-24 06:58:22 -0800284template("rtc_test") {
285 test(target_name) {
286 forward_variables_from(invoker,
287 "*",
288 [
289 "configs",
290 "public_configs",
291 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200292 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800293 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100294
295 # Always override to public because when target_os is Android the `test`
296 # template can override it to [ "*" ] and we want to avoid conditional
297 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100298 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800299 configs += invoker.configs
300 configs -= rtc_remove_configs
301 configs -= invoker.suppressed_configs
Mirko Bonadei9d8f3852018-04-16 19:59:11 -0700302 public_configs = [
303 rtc_common_inherited_config,
304 absl_include_config,
305 absl_define_config,
306 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800307 if (defined(invoker.public_configs)) {
308 public_configs += invoker.public_configs
309 }
sakald7fdb802017-05-26 01:51:53 -0700310 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800311 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
312 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700313 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800314 }
315}
316
317template("rtc_source_set") {
318 source_set(target_name) {
319 forward_variables_from(invoker,
320 "*",
321 [
322 "configs",
323 "public_configs",
324 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200325 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800326 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200327 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000328 if (!defined(visibility)) {
329 visibility = webrtc_default_visibility
330 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800331 configs += invoker.configs
332 configs -= rtc_remove_configs
333 configs -= invoker.suppressed_configs
Mirko Bonadei9d8f3852018-04-16 19:59:11 -0700334 public_configs = [
335 rtc_common_inherited_config,
336 absl_include_config,
337 absl_define_config,
338 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800339 if (defined(invoker.public_configs)) {
340 public_configs += invoker.public_configs
341 }
342 }
343}
344
345template("rtc_executable") {
346 executable(target_name) {
347 forward_variables_from(invoker,
348 "*",
349 [
350 "deps",
351 "configs",
352 "public_configs",
353 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200354 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800355 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200356 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000357 if (!defined(visibility)) {
358 visibility = webrtc_default_visibility
359 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800360 configs += invoker.configs
361 configs -= rtc_remove_configs
362 configs -= invoker.suppressed_configs
363 deps = [
thomasanderson7f52f082017-05-18 23:51:46 -0700364 "//build/config:exe_and_shlib_deps",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800365 ]
366 deps += invoker.deps
perkj650fdae2017-08-25 05:00:11 -0700367
Mirko Bonadei9d8f3852018-04-16 19:59:11 -0700368 public_configs = [
369 rtc_common_inherited_config,
370 absl_include_config,
371 absl_define_config,
372 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800373 if (defined(invoker.public_configs)) {
374 public_configs += invoker.public_configs
375 }
376 }
377}
378
379template("rtc_static_library") {
380 static_library(target_name) {
381 forward_variables_from(invoker,
382 "*",
383 [
384 "configs",
385 "public_configs",
386 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200387 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800388 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200389 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000390 if (!defined(visibility)) {
391 visibility = webrtc_default_visibility
392 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800393 configs += invoker.configs
394 configs -= rtc_remove_configs
395 configs -= invoker.suppressed_configs
Mirko Bonadei9d8f3852018-04-16 19:59:11 -0700396 public_configs = [
397 rtc_common_inherited_config,
398 absl_include_config,
399 absl_define_config,
400 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800401 if (defined(invoker.public_configs)) {
402 public_configs += invoker.public_configs
403 }
404 }
405}
406
407template("rtc_shared_library") {
408 shared_library(target_name) {
409 forward_variables_from(invoker,
410 "*",
411 [
412 "configs",
413 "public_configs",
414 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200415 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800416 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200417 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000418 if (!defined(visibility)) {
419 visibility = webrtc_default_visibility
420 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800421 configs += invoker.configs
422 configs -= rtc_remove_configs
423 configs -= invoker.suppressed_configs
Mirko Bonadei9d8f3852018-04-16 19:59:11 -0700424 public_configs = [
425 rtc_common_inherited_config,
426 absl_include_config,
427 absl_define_config,
428 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800429 if (defined(invoker.public_configs)) {
430 public_configs += invoker.public_configs
431 }
432 }
433}
kthelgason4065a572017-02-14 04:58:56 -0800434
435if (is_ios) {
436 set_defaults("rtc_ios_xctest_test") {
437 configs = rtc_add_configs
438 suppressed_configs = []
439 }
440
441 template("rtc_ios_xctest_test") {
442 ios_xctest_test(target_name) {
443 forward_variables_from(invoker,
444 "*",
445 [
446 "configs",
447 "public_configs",
448 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200449 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800450 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200451 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000452 if (!defined(visibility)) {
453 visibility = webrtc_default_visibility
454 }
kthelgason4065a572017-02-14 04:58:56 -0800455 configs += invoker.configs
456 configs -= rtc_remove_configs
457 configs -= invoker.suppressed_configs
458 public_configs = [ rtc_common_inherited_config ]
459 if (defined(invoker.public_configs)) {
460 public_configs += invoker.public_configs
461 }
462 }
463 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100464
465 template("ios_framework_bundle_with_umbrella_header") {
466 forward_variables_from(invoker, [ "output_name" ])
467 umbrella_header_path =
468 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
469
470 ios_framework_bundle(target_name) {
471 forward_variables_from(invoker, "*", [])
472
473 deps += [ ":copy_umbrella_header_$target_name" ]
474 }
475
476 action("umbrella_header_$target_name") {
477 forward_variables_from(invoker, [ "public_headers" ])
478
479 script = "//tools_webrtc/ios/generate_umbrella_header.py"
480
481 outputs = [
482 umbrella_header_path,
483 ]
484 args = [
485 "--out",
486 rebase_path(umbrella_header_path, root_build_dir),
487 "--sources",
488 ] + rebase_path(public_headers, "objc/Framework/Headers/")
489 }
490
491 copy("copy_umbrella_header_$target_name") {
492 sources = [
493 umbrella_header_path,
494 ]
495 outputs = [
496 "$root_out_dir/$output_name.framework/Headers/$output_name.h",
497 ]
498
499 deps = [
500 ":umbrella_header_$target_name",
501 ]
502 }
503 }
504
505 set_defaults("ios_framework_bundle_with_umbrella_header") {
506 configs = default_shared_library_configs
507 }
kthelgason4065a572017-02-14 04:58:56 -0800508}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000509
510if (is_android) {
511 template("rtc_android_library") {
512 android_library(target_name) {
513 forward_variables_from(invoker,
514 "*",
515 [
516 "configs",
517 "public_configs",
518 "suppressed_configs",
519 "visibility",
520 ])
521
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100522 javac_args = []
523
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000524 # Treat warnings as errors.
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100525 javac_args += [ "-Werror" ]
526
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200527 # TODO(crbug.com/824679): Find out why this fails in Chromium
528 if (!build_with_chromium) {
529 javac_args += [
530 "-Xep:ParameterNotNullable:ERROR",
531 "-Xep:FieldMissingNullable:ERROR",
532 "-Xep:ReturnMissingNullable:ERROR",
533 ]
534 }
535
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100536 # Add any arguments defined by the invoker.
537 if (defined(invoker.javac_args)) {
538 javac_args += invoker.javac_args
539 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000540
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200541 if (!defined(deps)) {
542 deps = []
543 }
544 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
545
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000546 no_build_hooks = true
547 }
548 }
549
550 template("rtc_android_apk") {
551 android_apk(target_name) {
552 forward_variables_from(invoker,
553 "*",
554 [
555 "configs",
556 "public_configs",
557 "suppressed_configs",
558 "visibility",
559 ])
560
561 # Treat warnings as errors.
562 javac_args = [ "-Werror" ]
563
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200564 # TODO(crbug.com/824679): Find out why this fails in Chromium
565 if (!build_with_chromium) {
566 javac_args += [
567 "-Xep:ParameterNotNullable:ERROR",
568 "-Xep:FieldMissingNullable:ERROR",
569 "-Xep:ReturnMissingNullable:ERROR",
570 ]
571 }
572
573 if (!defined(deps)) {
574 deps = []
575 }
576 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
577
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000578 no_build_hooks = true
579 }
580 }
581
582 template("rtc_instrumentation_test_apk") {
583 instrumentation_test_apk(target_name) {
584 forward_variables_from(invoker,
585 "*",
586 [
587 "configs",
588 "public_configs",
589 "suppressed_configs",
590 "visibility",
591 ])
592
593 # Treat warnings as errors.
594 javac_args = [ "-Werror" ]
595
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200596 # TODO(crbug.com/824679): Find out why this fails in Chromium
597 if (!build_with_chromium) {
598 javac_args += [
599 "-Xep:ParameterNotNullable:ERROR",
600 "-Xep:FieldMissingNullable:ERROR",
601 "-Xep:ReturnMissingNullable:ERROR",
602 ]
603 }
604
605 if (!defined(deps)) {
606 deps = []
607 }
608 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
609
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000610 no_build_hooks = true
611 }
612 }
613}