mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 1 | # 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. |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 8 | import("//build/config/arm.gni") |
| 9 | import("//build/config/features.gni") |
| 10 | import("//build/config/mips.gni") |
| 11 | import("//build/config/sanitizers/sanitizers.gni") |
ehmaldonado | 0d729b3 | 2017-02-10 01:38:23 -0800 | [diff] [blame] | 12 | import("//build/config/ui.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 13 | import("//build_overrides/build.gni") |
mbonadei | 9660627 | 2017-03-03 19:41:59 -0800 | [diff] [blame] | 14 | |
| 15 | if (!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 | |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 29 | if (is_ios) { |
| 30 | import("//build/config/ios/rules.gni") |
| 31 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 32 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 33 | if (is_mac) { |
| 34 | import("//build/config/mac/rules.gni") |
| 35 | } |
| 36 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 37 | declare_args() { |
Mirko Bonadei | 31b0b45 | 2018-08-22 10:37:11 +0200 | [diff] [blame] | 38 | # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which |
Mirko Bonadei | 7040090 | 2018-08-21 15:44:28 +0200 | [diff] [blame] | 39 | # will tell the pre-processor to remove the default definition of symbols |
| 40 | # needed to use field_trial. In that case a new implementation needs to be |
| 41 | # provided. |
Mirko Bonadei | 31b0b45 | 2018-08-22 10:37:11 +0200 | [diff] [blame] | 42 | if (build_with_chromium) { |
| 43 | # When WebRTC is built as part of Chromium it should exclude the default |
| 44 | # implementation of field_trial unless it is building for NACL or |
| 45 | # Chromecast. |
| 46 | rtc_exclude_field_trial_default = !is_nacl && !is_chromecast |
| 47 | } else { |
| 48 | rtc_exclude_field_trial_default = false |
| 49 | } |
Mirko Bonadei | 7040090 | 2018-08-21 15:44:28 +0200 | [diff] [blame] | 50 | |
Mirko Bonadei | 906add4 | 2018-09-05 16:03:16 +0200 | [diff] [blame] | 51 | # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which |
| 52 | # will tell the pre-processor to remove the default definition of symbols |
| 53 | # needed to use metrics. In that case a new implementation needs to be |
| 54 | # provided. |
| 55 | rtc_exclude_metrics_default = build_with_chromium |
| 56 | |
Mirko Bonadei | 4515793 | 2018-09-17 11:34:58 +0200 | [diff] [blame] | 57 | # WARNING: This argument doesn't have any effect on the WebRTC build until |
| 58 | # https://webrtc-review.googlesource.com/c/src/+/100640 will land. |
| 59 | # Setting this to true will define |
| 60 | # WEBRTC_EXCLUDE_RUNTIME_ENABLED_FEATURES_DEFAULT which will tell the |
| 61 | # pre-processor to remove the default definition of symbols needed to use |
| 62 | # runtime_enabled_features. In that case a new implementation needs to be |
| 63 | # provided. |
| 64 | if (build_with_chromium) { |
| 65 | # When WebRTC is built as part of Chromium it should exclude the default |
| 66 | # implementation of runtime_enabled_features unless it is building for NACL or |
| 67 | # Chromecast. |
| 68 | rtc_exclude_runtime_enabled_features_default = !is_nacl && !is_chromecast |
| 69 | } else { |
| 70 | rtc_exclude_runtime_enabled_features_default = false |
| 71 | } |
| 72 | |
Benjamin Wright | d6f86e8 | 2018-05-08 13:12:25 -0700 | [diff] [blame] | 73 | # Setting this to false will require the API user to pass in their own |
| 74 | # SSLCertificateVerifier to verify the certificates presented from a |
| 75 | # TLS-TURN server. In return disabling this saves around 100kb in the binary. |
| 76 | rtc_builtin_ssl_root_certificates = true |
| 77 | |
Karl Wiberg | eb254b4 | 2017-11-01 15:08:12 +0100 | [diff] [blame] | 78 | # Include the iLBC audio codec? |
| 79 | rtc_include_ilbc = true |
| 80 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 81 | # Disable this to avoid building the Opus audio codec. |
| 82 | rtc_include_opus = true |
| 83 | |
minyue | 2e03c66 | 2017-02-01 17:31:11 -0800 | [diff] [blame] | 84 | # Enable this if the Opus version upon which WebRTC is built supports direct |
| 85 | # encoding of 120 ms packets. |
minyue-webrtc | 516711c | 2017-07-27 17:45:49 +0200 | [diff] [blame] | 86 | rtc_opus_support_120ms_ptime = true |
minyue | 2e03c66 | 2017-02-01 17:31:11 -0800 | [diff] [blame] | 87 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 88 | # Enable this to let the Opus audio codec change complexity on the fly. |
| 89 | rtc_opus_variable_complexity = false |
| 90 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 91 | # Used to specify an external Jsoncpp include path when not compiling the |
| 92 | # library that comes with WebRTC (i.e. rtc_build_json == 0). |
| 93 | rtc_jsoncpp_root = "//third_party/jsoncpp/source/include" |
| 94 | |
| 95 | # Used to specify an external OpenSSL include path when not compiling the |
| 96 | # library that comes with WebRTC (i.e. rtc_build_ssl == 0). |
| 97 | rtc_ssl_root = "" |
| 98 | |
| 99 | # Selects fixed-point code where possible. |
| 100 | rtc_prefer_fixed_point = false |
| 101 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 102 | # Enable when an external authentication mechanism is used for performing |
| 103 | # packet authentication for RTP packets instead of libsrtp. |
| 104 | rtc_enable_external_auth = build_with_chromium |
| 105 | |
| 106 | # Selects whether debug dumps for the audio processing module |
| 107 | # should be generated. |
| 108 | apm_debug_dump = false |
| 109 | |
| 110 | # Set this to true to enable BWE test logging. |
| 111 | rtc_enable_bwe_test_logging = false |
| 112 | |
Joachim Bauch | 93e9134 | 2017-12-07 01:25:53 +0100 | [diff] [blame] | 113 | # Set this to false to skip building examples. |
| 114 | rtc_build_examples = true |
| 115 | |
| 116 | # Set this to false to skip building tools. |
| 117 | rtc_build_tools = true |
| 118 | |
Joachim Bauch | 75f18fc | 2017-12-20 21:25:47 +0100 | [diff] [blame] | 119 | # Set this to false to skip building code that requires X11. |
| 120 | rtc_use_x11 = use_x11 |
| 121 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 122 | # Enable to use the Mozilla internal settings. |
| 123 | build_with_mozilla = false |
| 124 | |
henrika | 883d00f | 2018-03-16 10:09:49 +0100 | [diff] [blame] | 125 | # Enable use of Android AAudio which requires Android SDK 26 or above and |
| 126 | # NDK r16 or above. |
| 127 | rtc_enable_android_aaudio = false |
| 128 | |
| 129 | # TODO(henrika): can this flag be removed? |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 130 | rtc_enable_android_opensl = false |
| 131 | |
| 132 | # Link-Time Optimizations. |
| 133 | # Executes code generation at link-time instead of compile-time. |
| 134 | # https://gcc.gnu.org/wiki/LinkTimeOptimization |
| 135 | rtc_use_lto = false |
| 136 | |
| 137 | # Set to "func", "block", "edge" for coverage generation. |
| 138 | # At unit test runtime set UBSAN_OPTIONS="coverage=1". |
| 139 | # It is recommend to set include_examples=0. |
| 140 | # Use llvm's sancov -html-report for human readable reports. |
| 141 | # See http://clang.llvm.org/docs/SanitizerCoverage.html . |
| 142 | rtc_sanitize_coverage = "" |
| 143 | |
perkj | 650fdae | 2017-08-25 05:00:11 -0700 | [diff] [blame] | 144 | # Links a default implementation of task queues to targets |
| 145 | # that depend on the target rtc_task_queue. Set to false to |
| 146 | # use an external implementation. |
| 147 | rtc_link_task_queue_impl = true |
| 148 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 149 | if (current_cpu == "arm" || current_cpu == "arm64") { |
| 150 | rtc_prefer_fixed_point = true |
| 151 | } |
| 152 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 153 | # Determines whether NEON code will be built. |
| 154 | rtc_build_with_neon = |
| 155 | (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" |
| 156 | |
| 157 | # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on |
| 158 | # all platforms except Android and iOS. Because FFmpeg can be built |
| 159 | # with/without H.264 support, |ffmpeg_branding| has to separately be set to a |
| 160 | # value that includes H.264, for example "Chrome". If FFmpeg is built without |
Sergey Silkin | fe288eb | 2018-06-25 16:22:38 +0200 | [diff] [blame] | 161 | # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 162 | # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. |
| 163 | # http://www.openh264.org, https://www.ffmpeg.org/ |
Patrik Höglund | 3bb1194 | 2018-03-16 12:36:26 +0000 | [diff] [blame] | 164 | rtc_use_h264 = proprietary_codecs && !is_android && !is_ios |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 165 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 166 | # By default, use normal platform audio support or dummy audio, but don't |
| 167 | # use file-based audio playout and record. |
| 168 | rtc_use_dummy_audio_file_devices = false |
| 169 | |
henrika | 7be7883 | 2017-06-13 17:34:16 +0200 | [diff] [blame] | 170 | # When set to true, replace the audio output with a sinus tone at 440Hz. |
| 171 | # The ADM will ask for audio data from WebRTC but instead of reading real |
| 172 | # audio samples from NetEQ, a sinus tone will be generated and replace the |
| 173 | # real audio samples. |
| 174 | rtc_audio_device_plays_sinus_tone = false |
| 175 | |
Anders Carlsson | dd8c165 | 2018-01-30 10:32:13 +0100 | [diff] [blame] | 176 | # Disable this to build without support for built-in software codecs. |
| 177 | rtc_use_builtin_sw_codecs = true |
Anders Carlsson | 358f2e0 | 2018-06-04 10:24:37 +0200 | [diff] [blame] | 178 | |
| 179 | if (is_ios) { |
| 180 | # Build broadcast extension in AppRTCMobile for iOS. This results in the |
| 181 | # binary only running on iOS 11+, which is why it is disabled by default. |
| 182 | rtc_apprtcmobile_broadcast_extension = false |
| 183 | } |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 184 | |
| 185 | # Determines whether Metal is available on iOS/macOS. |
| 186 | rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64") |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 187 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 188 | |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 189 | if (!build_with_mozilla) { |
| 190 | import("//testing/test.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | # A second declare_args block, so that declarations within it can |
| 194 | # depend on the possibly overridden variables in the first |
| 195 | # declare_args block. |
| 196 | declare_args() { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 197 | # Enables the use of protocol buffers for debug recordings. |
| 198 | rtc_enable_protobuf = !build_with_mozilla |
| 199 | |
| 200 | # Set this to disable building with support for SCTP data channels. |
| 201 | rtc_enable_sctp = !build_with_mozilla |
| 202 | |
| 203 | # Disable these to not build components which can be externally provided. |
| 204 | rtc_build_json = !build_with_mozilla |
| 205 | rtc_build_libsrtp = !build_with_mozilla |
| 206 | rtc_build_libvpx = !build_with_mozilla |
| 207 | rtc_libvpx_build_vp9 = !build_with_mozilla |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 208 | rtc_build_opus = !build_with_mozilla |
| 209 | rtc_build_ssl = !build_with_mozilla |
| 210 | rtc_build_usrsctp = !build_with_mozilla |
| 211 | |
| 212 | # Enable libevent task queues on platforms that support it. |
| 213 | # rtc_link_task_queue_impl must be set to true for this to |
| 214 | # have an effect. |
Wez | 00cecb9 | 2018-02-09 10:41:00 -0800 | [diff] [blame] | 215 | if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 216 | rtc_enable_libevent = false |
| 217 | rtc_build_libevent = false |
| 218 | } else { |
| 219 | rtc_enable_libevent = true |
| 220 | rtc_build_libevent = !build_with_mozilla |
| 221 | } |
| 222 | |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 223 | # Build sources requiring GTK. NOTICE: This is not present in Chrome OS |
| 224 | # build environments, even if available for Chromium builds. |
| 225 | rtc_use_gtk = !build_with_chromium && !build_with_mozilla |
| 226 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 227 | # Excluded in Chromium since its prerequisites don't require Pulse Audio. |
| 228 | rtc_include_pulse_audio = !build_with_chromium |
| 229 | |
| 230 | # Chromium uses its own IO handling, so the internal ADM is only built for |
| 231 | # standalone WebRTC. |
| 232 | rtc_include_internal_audio_device = !build_with_chromium |
| 233 | |
| 234 | # Include tests in standalone checkout. |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 235 | rtc_include_tests = !build_with_chromium && !build_with_mozilla |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | # Make it possible to provide custom locations for some libraries (move these |
| 239 | # up into declare_args should we need to actually use them for the GN build). |
| 240 | rtc_libvpx_dir = "//third_party/libvpx" |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 241 | rtc_opus_dir = "//third_party/opus" |
| 242 | |
| 243 | # Desktop capturer is supported only on Windows, OSX and Linux. |
Joachim Bauch | 75f18fc | 2017-12-20 21:25:47 +0100 | [diff] [blame] | 244 | rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11) |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 245 | |
| 246 | ############################################################################### |
| 247 | # Templates |
| 248 | # |
| 249 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 250 | # Points to // in webrtc stand-alone or to //third_party/webrtc/ in |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 251 | # chromium. |
| 252 | # We need absolute paths for all configs in templates as they are shared in |
| 253 | # different subdirectories. |
| 254 | webrtc_root = get_path_info(".", "abspath") |
| 255 | |
| 256 | # Global configuration that should be applied to all WebRTC targets. |
| 257 | # You normally shouldn't need to include this in your target as it's |
| 258 | # automatically included when using the rtc_* templates. |
| 259 | # It sets defines, include paths and compilation warnings accordingly, |
| 260 | # both for WebRTC stand-alone builds and for the scenario when WebRTC |
| 261 | # native code is built as part of Chromium. |
Will Harris | fc173d0 | 2018-08-29 13:56:00 -0700 | [diff] [blame] | 262 | rtc_common_configs = [ |
| 263 | webrtc_root + ":common_config", |
| 264 | "//build/config/compiler:no_size_t_to_int_warning", |
| 265 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 266 | |
kthelgason | c097710 | 2017-04-24 00:57:16 -0700 | [diff] [blame] | 267 | if (is_mac || is_ios) { |
| 268 | rtc_common_configs += [ "//build/config/compiler:enable_arc" ] |
| 269 | } |
| 270 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 271 | # Global public configuration that should be applied to all WebRTC targets. You |
| 272 | # normally shouldn't need to include this in your target as it's automatically |
| 273 | # included when using the rtc_* templates. It set the defines, include paths and |
| 274 | # compilation warnings that should be propagated to dependents of the targets |
| 275 | # depending on the target having this config. |
| 276 | rtc_common_inherited_config = webrtc_root + ":common_inherited_config" |
| 277 | |
| 278 | # Common configs to remove or add in all rtc targets. |
| 279 | rtc_remove_configs = [] |
| 280 | rtc_add_configs = rtc_common_configs |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 281 | rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 282 | |
| 283 | set_defaults("rtc_test") { |
| 284 | configs = rtc_add_configs |
| 285 | suppressed_configs = [] |
| 286 | } |
| 287 | |
| 288 | set_defaults("rtc_source_set") { |
| 289 | configs = rtc_add_configs |
| 290 | suppressed_configs = [] |
| 291 | } |
| 292 | |
| 293 | set_defaults("rtc_executable") { |
| 294 | configs = rtc_add_configs |
| 295 | suppressed_configs = [] |
| 296 | } |
| 297 | |
| 298 | set_defaults("rtc_static_library") { |
| 299 | configs = rtc_add_configs |
| 300 | suppressed_configs = [] |
| 301 | } |
| 302 | |
| 303 | set_defaults("rtc_shared_library") { |
| 304 | configs = rtc_add_configs |
| 305 | suppressed_configs = [] |
| 306 | } |
| 307 | |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 308 | webrtc_default_visibility = [ webrtc_root + "/*" ] |
| 309 | if (build_with_chromium) { |
| 310 | # Allow Chromium's WebRTC overrides targets to bypass the regular |
| 311 | # visibility restrictions. |
| 312 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] |
| 313 | } |
| 314 | |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 315 | # ---- Poisons ---- |
| 316 | # |
| 317 | # The general idea is that some targets declare that they contain some |
| 318 | # kind of poison, which makes it impossible for other targets to |
| 319 | # depend on them (even transitively) unless they declare themselves |
| 320 | # immune to that particular type of poison. |
| 321 | # |
| 322 | # Targets that *contain* poison of type foo should contain the line |
| 323 | # |
| 324 | # poisonous = [ "foo" ] |
| 325 | # |
| 326 | # and targets that *are immune but arent't themselves poisonous* |
| 327 | # should contain |
| 328 | # |
| 329 | # allow_poison = [ "foo" ] |
| 330 | # |
| 331 | # This useful in cases where we have some large target or set of |
| 332 | # targets and want to ensure that most other targets do not |
| 333 | # transitively depend on them. For example, almost no high-level |
| 334 | # target should depend on the audio codecs, since we want WebRTC users |
| 335 | # to be able to inject any subset of them and actually end up with a |
| 336 | # binary that doesn't include the codecs they didn't inject. |
| 337 | # |
| 338 | # Test-only targets (`testonly` set to true) and non-public targets |
| 339 | # (`visibility` not containing "*") are automatically immune to all |
| 340 | # types of poison. |
| 341 | # |
| 342 | # Here's the complete list of all types of poison. It must be kept in |
| 343 | # 1:1 correspondence with the set of //:poison_* targets. |
| 344 | # |
| 345 | all_poison_types = [ |
| 346 | # Encoders and decoders for specific audio codecs such as Opus and iSAC. |
| 347 | "audio_codecs", |
Anders Carlsson | 1f433e4 | 2018-04-24 16:39:05 +0200 | [diff] [blame] | 348 | |
| 349 | # Software video codecs (VP8 and VP9 through libvpx). |
| 350 | "software_video_codecs", |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 351 | ] |
| 352 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 353 | absl_include_config = "//third_party/abseil-cpp:absl_include_config" |
| 354 | absl_define_config = "//third_party/abseil-cpp:absl_define_config" |
| 355 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 356 | template("rtc_test") { |
| 357 | test(target_name) { |
| 358 | forward_variables_from(invoker, |
| 359 | "*", |
| 360 | [ |
| 361 | "configs", |
| 362 | "public_configs", |
| 363 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 364 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 365 | ]) |
Mirko Bonadei | dd41194 | 2017-11-21 15:35:27 +0100 | [diff] [blame] | 366 | |
| 367 | # Always override to public because when target_os is Android the `test` |
| 368 | # template can override it to [ "*" ] and we want to avoid conditional |
| 369 | # visibility. |
Mirko Bonadei | 2155881 | 2017-11-21 12:47:34 +0100 | [diff] [blame] | 370 | visibility = [ "*" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 371 | configs += invoker.configs |
| 372 | configs -= rtc_remove_configs |
| 373 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 374 | public_configs = [ |
| 375 | rtc_common_inherited_config, |
| 376 | absl_include_config, |
| 377 | absl_define_config, |
| 378 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 379 | if (defined(invoker.public_configs)) { |
| 380 | public_configs += invoker.public_configs |
| 381 | } |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 382 | if (!build_with_chromium && is_android) { |
Jianjun Zhu | 037f3e4 | 2017-08-15 21:48:37 +0800 | [diff] [blame] | 383 | android_manifest = webrtc_root + "test/android/AndroidManifest.xml" |
| 384 | deps += [ webrtc_root + "test:native_test_java" ] |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 385 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 386 | } |
| 387 | } |
| 388 | |
| 389 | template("rtc_source_set") { |
| 390 | source_set(target_name) { |
| 391 | forward_variables_from(invoker, |
| 392 | "*", |
| 393 | [ |
| 394 | "configs", |
| 395 | "public_configs", |
| 396 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 397 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 398 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 399 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 400 | if (!defined(visibility)) { |
| 401 | visibility = webrtc_default_visibility |
| 402 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 403 | |
| 404 | # What's your poison? |
| 405 | if (defined(testonly) && testonly) { |
| 406 | assert(!defined(poisonous)) |
| 407 | assert(!defined(allow_poison)) |
| 408 | } else { |
| 409 | if (!defined(poisonous)) { |
| 410 | poisonous = [] |
| 411 | } |
| 412 | if (!defined(allow_poison)) { |
| 413 | allow_poison = [] |
| 414 | } |
| 415 | if (!defined(assert_no_deps)) { |
| 416 | assert_no_deps = [] |
| 417 | } |
| 418 | if (!defined(deps)) { |
| 419 | deps = [] |
| 420 | } |
| 421 | foreach(p, poisonous) { |
| 422 | deps += [ webrtc_root + ":poison_" + p ] |
| 423 | } |
| 424 | foreach(poison_type, all_poison_types) { |
| 425 | allow_dep = true |
| 426 | foreach(v, visibility) { |
| 427 | if (v == "*") { |
| 428 | allow_dep = false |
| 429 | } |
| 430 | } |
| 431 | foreach(p, allow_poison + poisonous) { |
| 432 | if (p == poison_type) { |
| 433 | allow_dep = true |
| 434 | } |
| 435 | } |
| 436 | if (!allow_dep) { |
| 437 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 442 | if (!defined(testonly) || !testonly) { |
| 443 | configs += rtc_prod_configs |
| 444 | } |
| 445 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 446 | configs += invoker.configs |
| 447 | configs -= rtc_remove_configs |
| 448 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 449 | public_configs = [ |
| 450 | rtc_common_inherited_config, |
| 451 | absl_include_config, |
| 452 | absl_define_config, |
| 453 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 454 | if (defined(invoker.public_configs)) { |
| 455 | public_configs += invoker.public_configs |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | template("rtc_executable") { |
| 461 | executable(target_name) { |
| 462 | forward_variables_from(invoker, |
| 463 | "*", |
| 464 | [ |
| 465 | "deps", |
| 466 | "configs", |
| 467 | "public_configs", |
| 468 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 469 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 470 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 471 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 472 | if (!defined(visibility)) { |
| 473 | visibility = webrtc_default_visibility |
| 474 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 475 | configs += invoker.configs |
| 476 | configs -= rtc_remove_configs |
| 477 | configs -= invoker.suppressed_configs |
Tom Anderson | 9614a31 | 2018-06-11 15:10:34 -0700 | [diff] [blame] | 478 | deps = invoker.deps |
perkj | 650fdae | 2017-08-25 05:00:11 -0700 | [diff] [blame] | 479 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 480 | public_configs = [ |
| 481 | rtc_common_inherited_config, |
| 482 | absl_include_config, |
| 483 | absl_define_config, |
| 484 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 485 | if (defined(invoker.public_configs)) { |
| 486 | public_configs += invoker.public_configs |
| 487 | } |
Mirko Bonadei | 9427f48 | 2018-08-28 14:39:27 +0200 | [diff] [blame] | 488 | if (is_win) { |
| 489 | deps += [ |
| 490 | # Give executables the default manifest on Windows (a no-op elsewhere). |
| 491 | "//build/win:default_exe_manifest", |
| 492 | ] |
| 493 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 494 | } |
| 495 | } |
| 496 | |
| 497 | template("rtc_static_library") { |
| 498 | static_library(target_name) { |
| 499 | forward_variables_from(invoker, |
| 500 | "*", |
| 501 | [ |
| 502 | "configs", |
| 503 | "public_configs", |
| 504 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 505 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 506 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 507 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 508 | if (!defined(visibility)) { |
| 509 | visibility = webrtc_default_visibility |
| 510 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 511 | |
| 512 | # What's your poison? |
| 513 | if (defined(testonly) && testonly) { |
| 514 | assert(!defined(poisonous)) |
| 515 | assert(!defined(allow_poison)) |
| 516 | } else { |
| 517 | if (!defined(poisonous)) { |
| 518 | poisonous = [] |
| 519 | } |
| 520 | if (!defined(allow_poison)) { |
| 521 | allow_poison = [] |
| 522 | } |
| 523 | if (!defined(assert_no_deps)) { |
| 524 | assert_no_deps = [] |
| 525 | } |
| 526 | if (!defined(deps)) { |
| 527 | deps = [] |
| 528 | } |
| 529 | foreach(p, poisonous) { |
| 530 | deps += [ webrtc_root + ":poison_" + p ] |
| 531 | } |
| 532 | foreach(poison_type, all_poison_types) { |
| 533 | allow_dep = true |
| 534 | foreach(v, visibility) { |
| 535 | if (v == "*") { |
| 536 | allow_dep = false |
| 537 | } |
| 538 | } |
| 539 | foreach(p, allow_poison + poisonous) { |
| 540 | if (p == poison_type) { |
| 541 | allow_dep = true |
| 542 | } |
| 543 | } |
| 544 | if (!allow_dep) { |
| 545 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 550 | if (!defined(testonly) || !testonly) { |
| 551 | configs += rtc_prod_configs |
| 552 | } |
| 553 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 554 | configs += invoker.configs |
| 555 | configs -= rtc_remove_configs |
| 556 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 557 | public_configs = [ |
| 558 | rtc_common_inherited_config, |
| 559 | absl_include_config, |
| 560 | absl_define_config, |
| 561 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 562 | if (defined(invoker.public_configs)) { |
| 563 | public_configs += invoker.public_configs |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | template("rtc_shared_library") { |
| 569 | shared_library(target_name) { |
| 570 | forward_variables_from(invoker, |
| 571 | "*", |
| 572 | [ |
| 573 | "configs", |
| 574 | "public_configs", |
| 575 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 576 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 577 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 578 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 579 | if (!defined(visibility)) { |
| 580 | visibility = webrtc_default_visibility |
| 581 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 582 | |
| 583 | # What's your poison? |
| 584 | if (defined(testonly) && testonly) { |
| 585 | assert(!defined(poisonous)) |
| 586 | assert(!defined(allow_poison)) |
| 587 | } else { |
| 588 | if (!defined(poisonous)) { |
| 589 | poisonous = [] |
| 590 | } |
| 591 | if (!defined(allow_poison)) { |
| 592 | allow_poison = [] |
| 593 | } |
| 594 | if (!defined(assert_no_deps)) { |
| 595 | assert_no_deps = [] |
| 596 | } |
| 597 | if (!defined(deps)) { |
| 598 | deps = [] |
| 599 | } |
| 600 | foreach(p, poisonous) { |
| 601 | deps += [ webrtc_root + ":poison_" + p ] |
| 602 | } |
| 603 | foreach(poison_type, all_poison_types) { |
| 604 | allow_dep = true |
| 605 | foreach(v, visibility) { |
| 606 | if (v == "*") { |
| 607 | allow_dep = false |
| 608 | } |
| 609 | } |
| 610 | foreach(p, allow_poison + poisonous) { |
| 611 | if (p == poison_type) { |
| 612 | allow_dep = true |
| 613 | } |
| 614 | } |
| 615 | if (!allow_dep) { |
| 616 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 617 | } |
| 618 | } |
| 619 | } |
| 620 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 621 | configs += invoker.configs |
| 622 | configs -= rtc_remove_configs |
| 623 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 624 | public_configs = [ |
| 625 | rtc_common_inherited_config, |
| 626 | absl_include_config, |
| 627 | absl_define_config, |
| 628 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 629 | if (defined(invoker.public_configs)) { |
| 630 | public_configs += invoker.public_configs |
| 631 | } |
| 632 | } |
| 633 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 634 | |
| 635 | if (is_ios) { |
| 636 | set_defaults("rtc_ios_xctest_test") { |
| 637 | configs = rtc_add_configs |
| 638 | suppressed_configs = [] |
| 639 | } |
| 640 | |
| 641 | template("rtc_ios_xctest_test") { |
| 642 | ios_xctest_test(target_name) { |
| 643 | forward_variables_from(invoker, |
| 644 | "*", |
| 645 | [ |
| 646 | "configs", |
| 647 | "public_configs", |
| 648 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 649 | "visibility", |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 650 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 651 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 652 | if (!defined(visibility)) { |
| 653 | visibility = webrtc_default_visibility |
| 654 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 655 | configs += invoker.configs |
| 656 | configs -= rtc_remove_configs |
| 657 | configs -= invoker.suppressed_configs |
| 658 | public_configs = [ rtc_common_inherited_config ] |
| 659 | if (defined(invoker.public_configs)) { |
| 660 | public_configs += invoker.public_configs |
| 661 | } |
| 662 | } |
| 663 | } |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 664 | |
| 665 | template("ios_framework_bundle_with_umbrella_header") { |
| 666 | forward_variables_from(invoker, [ "output_name" ]) |
| 667 | umbrella_header_path = |
| 668 | "$target_gen_dir/$output_name.framework/Headers/$output_name.h" |
| 669 | |
| 670 | ios_framework_bundle(target_name) { |
| 671 | forward_variables_from(invoker, "*", []) |
| 672 | |
| 673 | deps += [ ":copy_umbrella_header_$target_name" ] |
| 674 | } |
| 675 | |
| 676 | action("umbrella_header_$target_name") { |
| 677 | forward_variables_from(invoker, [ "public_headers" ]) |
| 678 | |
| 679 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 680 | |
| 681 | outputs = [ |
| 682 | umbrella_header_path, |
| 683 | ] |
| 684 | args = [ |
| 685 | "--out", |
| 686 | rebase_path(umbrella_header_path, root_build_dir), |
| 687 | "--sources", |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 688 | ] + public_headers |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 689 | } |
| 690 | |
| 691 | copy("copy_umbrella_header_$target_name") { |
| 692 | sources = [ |
| 693 | umbrella_header_path, |
| 694 | ] |
| 695 | outputs = [ |
| 696 | "$root_out_dir/$output_name.framework/Headers/$output_name.h", |
| 697 | ] |
| 698 | |
| 699 | deps = [ |
| 700 | ":umbrella_header_$target_name", |
| 701 | ] |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | set_defaults("ios_framework_bundle_with_umbrella_header") { |
| 706 | configs = default_shared_library_configs |
| 707 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 708 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 709 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 710 | if (is_mac) { |
| 711 | template("mac_framework_bundle_with_umbrella_header") { |
| 712 | forward_variables_from(invoker, [ "output_name" ]) |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 713 | this_target_name = target_name |
| 714 | umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h" |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 715 | |
| 716 | mac_framework_bundle(target_name) { |
| 717 | forward_variables_from(invoker, "*", []) |
| 718 | |
| 719 | framework_version = "A" |
| 720 | framework_contents = [ "Headers" ] |
| 721 | |
| 722 | ldflags = [ |
| 723 | "-all_load", |
| 724 | "-install_name", |
| 725 | "@rpath/$output_name.framework/$output_name", |
| 726 | ] |
| 727 | |
| 728 | deps += [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 729 | ":copy_framework_headers_$this_target_name", |
| 730 | ":copy_umbrella_header_$this_target_name", |
| 731 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 732 | ] |
| 733 | } |
| 734 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 735 | bundle_data("copy_framework_headers_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 736 | forward_variables_from(invoker, [ "sources" ]) |
| 737 | |
| 738 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 739 | "{{bundle_contents_dir}}/Headers/{{source_file_part}}", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 740 | ] |
| 741 | } |
| 742 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 743 | action("umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 744 | forward_variables_from(invoker, [ "sources" ]) |
| 745 | |
| 746 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 747 | |
| 748 | outputs = [ |
| 749 | umbrella_header_path, |
| 750 | ] |
| 751 | args = [ |
| 752 | "--out", |
| 753 | rebase_path(umbrella_header_path, root_build_dir), |
| 754 | "--sources", |
| 755 | ] + sources |
| 756 | } |
| 757 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 758 | bundle_data("copy_umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 759 | sources = [ |
| 760 | umbrella_header_path, |
| 761 | ] |
| 762 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 763 | "{{bundle_contents_dir}}/Headers/$output_name.h", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 764 | ] |
| 765 | |
| 766 | deps = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 767 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 768 | ] |
| 769 | } |
| 770 | } |
| 771 | } |
| 772 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 773 | if (is_android) { |
| 774 | template("rtc_android_library") { |
| 775 | android_library(target_name) { |
| 776 | forward_variables_from(invoker, |
| 777 | "*", |
| 778 | [ |
| 779 | "configs", |
| 780 | "public_configs", |
| 781 | "suppressed_configs", |
| 782 | "visibility", |
| 783 | ]) |
| 784 | |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 785 | javac_args = [] |
| 786 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 787 | # Treat warnings as errors. |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 788 | javac_args += [ "-Werror" ] |
| 789 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 790 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 791 | if (!build_with_chromium) { |
| 792 | javac_args += [ |
| 793 | "-Xep:ParameterNotNullable:ERROR", |
| 794 | "-Xep:FieldMissingNullable:ERROR", |
| 795 | "-Xep:ReturnMissingNullable:ERROR", |
| 796 | ] |
| 797 | } |
| 798 | |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 799 | # Add any arguments defined by the invoker. |
| 800 | if (defined(invoker.javac_args)) { |
| 801 | javac_args += invoker.javac_args |
| 802 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 803 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 804 | if (!defined(deps)) { |
| 805 | deps = [] |
| 806 | } |
| 807 | deps += [ "//third_party/jsr-305:jsr_305_javalib" ] |
| 808 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 809 | no_build_hooks = true |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | template("rtc_android_apk") { |
| 814 | android_apk(target_name) { |
| 815 | forward_variables_from(invoker, |
| 816 | "*", |
| 817 | [ |
| 818 | "configs", |
| 819 | "public_configs", |
| 820 | "suppressed_configs", |
| 821 | "visibility", |
| 822 | ]) |
| 823 | |
| 824 | # Treat warnings as errors. |
| 825 | javac_args = [ "-Werror" ] |
| 826 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 827 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 828 | if (!build_with_chromium) { |
| 829 | javac_args += [ |
| 830 | "-Xep:ParameterNotNullable:ERROR", |
| 831 | "-Xep:FieldMissingNullable:ERROR", |
| 832 | "-Xep:ReturnMissingNullable:ERROR", |
| 833 | ] |
| 834 | } |
| 835 | |
| 836 | if (!defined(deps)) { |
| 837 | deps = [] |
| 838 | } |
| 839 | deps += [ "//third_party/jsr-305:jsr_305_javalib" ] |
| 840 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 841 | no_build_hooks = true |
| 842 | } |
| 843 | } |
| 844 | |
| 845 | template("rtc_instrumentation_test_apk") { |
| 846 | instrumentation_test_apk(target_name) { |
| 847 | forward_variables_from(invoker, |
| 848 | "*", |
| 849 | [ |
| 850 | "configs", |
| 851 | "public_configs", |
| 852 | "suppressed_configs", |
| 853 | "visibility", |
| 854 | ]) |
| 855 | |
| 856 | # Treat warnings as errors. |
| 857 | javac_args = [ "-Werror" ] |
| 858 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 859 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 860 | if (!build_with_chromium) { |
| 861 | javac_args += [ |
| 862 | "-Xep:ParameterNotNullable:ERROR", |
| 863 | "-Xep:FieldMissingNullable:ERROR", |
| 864 | "-Xep:ReturnMissingNullable:ERROR", |
| 865 | ] |
| 866 | } |
| 867 | |
| 868 | if (!defined(deps)) { |
| 869 | deps = [] |
| 870 | } |
| 871 | deps += [ "//third_party/jsr-305:jsr_305_javalib" ] |
| 872 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 873 | no_build_hooks = true |
| 874 | } |
| 875 | } |
| 876 | } |