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" ] |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame^] | 282 | rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 283 | |
| 284 | set_defaults("rtc_test") { |
| 285 | configs = rtc_add_configs |
| 286 | suppressed_configs = [] |
| 287 | } |
| 288 | |
| 289 | set_defaults("rtc_source_set") { |
| 290 | configs = rtc_add_configs |
| 291 | suppressed_configs = [] |
| 292 | } |
| 293 | |
| 294 | set_defaults("rtc_executable") { |
| 295 | configs = rtc_add_configs |
| 296 | suppressed_configs = [] |
| 297 | } |
| 298 | |
| 299 | set_defaults("rtc_static_library") { |
| 300 | configs = rtc_add_configs |
| 301 | suppressed_configs = [] |
| 302 | } |
| 303 | |
| 304 | set_defaults("rtc_shared_library") { |
| 305 | configs = rtc_add_configs |
| 306 | suppressed_configs = [] |
| 307 | } |
| 308 | |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 309 | webrtc_default_visibility = [ webrtc_root + "/*" ] |
| 310 | if (build_with_chromium) { |
| 311 | # Allow Chromium's WebRTC overrides targets to bypass the regular |
| 312 | # visibility restrictions. |
| 313 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] |
| 314 | } |
| 315 | |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 316 | # ---- Poisons ---- |
| 317 | # |
| 318 | # The general idea is that some targets declare that they contain some |
| 319 | # kind of poison, which makes it impossible for other targets to |
| 320 | # depend on them (even transitively) unless they declare themselves |
| 321 | # immune to that particular type of poison. |
| 322 | # |
| 323 | # Targets that *contain* poison of type foo should contain the line |
| 324 | # |
| 325 | # poisonous = [ "foo" ] |
| 326 | # |
| 327 | # and targets that *are immune but arent't themselves poisonous* |
| 328 | # should contain |
| 329 | # |
| 330 | # allow_poison = [ "foo" ] |
| 331 | # |
| 332 | # This useful in cases where we have some large target or set of |
| 333 | # targets and want to ensure that most other targets do not |
| 334 | # transitively depend on them. For example, almost no high-level |
| 335 | # target should depend on the audio codecs, since we want WebRTC users |
| 336 | # to be able to inject any subset of them and actually end up with a |
| 337 | # binary that doesn't include the codecs they didn't inject. |
| 338 | # |
| 339 | # Test-only targets (`testonly` set to true) and non-public targets |
| 340 | # (`visibility` not containing "*") are automatically immune to all |
| 341 | # types of poison. |
| 342 | # |
| 343 | # Here's the complete list of all types of poison. It must be kept in |
| 344 | # 1:1 correspondence with the set of //:poison_* targets. |
| 345 | # |
| 346 | all_poison_types = [ |
| 347 | # Encoders and decoders for specific audio codecs such as Opus and iSAC. |
| 348 | "audio_codecs", |
Anders Carlsson | 1f433e4 | 2018-04-24 16:39:05 +0200 | [diff] [blame] | 349 | |
| 350 | # Software video codecs (VP8 and VP9 through libvpx). |
| 351 | "software_video_codecs", |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 352 | ] |
| 353 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 354 | absl_include_config = "//third_party/abseil-cpp:absl_include_config" |
| 355 | absl_define_config = "//third_party/abseil-cpp:absl_define_config" |
| 356 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 357 | template("rtc_test") { |
| 358 | test(target_name) { |
| 359 | forward_variables_from(invoker, |
| 360 | "*", |
| 361 | [ |
| 362 | "configs", |
| 363 | "public_configs", |
| 364 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 365 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 366 | ]) |
Mirko Bonadei | dd41194 | 2017-11-21 15:35:27 +0100 | [diff] [blame] | 367 | |
| 368 | # Always override to public because when target_os is Android the `test` |
| 369 | # template can override it to [ "*" ] and we want to avoid conditional |
| 370 | # visibility. |
Mirko Bonadei | 2155881 | 2017-11-21 12:47:34 +0100 | [diff] [blame] | 371 | visibility = [ "*" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 372 | configs += invoker.configs |
| 373 | configs -= rtc_remove_configs |
| 374 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 375 | public_configs = [ |
| 376 | rtc_common_inherited_config, |
| 377 | absl_include_config, |
| 378 | absl_define_config, |
| 379 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 380 | if (defined(invoker.public_configs)) { |
| 381 | public_configs += invoker.public_configs |
| 382 | } |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 383 | if (!build_with_chromium && is_android) { |
Jianjun Zhu | 037f3e4 | 2017-08-15 21:48:37 +0800 | [diff] [blame] | 384 | android_manifest = webrtc_root + "test/android/AndroidManifest.xml" |
| 385 | deps += [ webrtc_root + "test:native_test_java" ] |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 386 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 387 | } |
| 388 | } |
| 389 | |
| 390 | template("rtc_source_set") { |
| 391 | source_set(target_name) { |
| 392 | forward_variables_from(invoker, |
| 393 | "*", |
| 394 | [ |
| 395 | "configs", |
| 396 | "public_configs", |
| 397 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 398 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 399 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 400 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 401 | if (!defined(visibility)) { |
| 402 | visibility = webrtc_default_visibility |
| 403 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 404 | |
| 405 | # What's your poison? |
| 406 | if (defined(testonly) && testonly) { |
| 407 | assert(!defined(poisonous)) |
| 408 | assert(!defined(allow_poison)) |
| 409 | } else { |
| 410 | if (!defined(poisonous)) { |
| 411 | poisonous = [] |
| 412 | } |
| 413 | if (!defined(allow_poison)) { |
| 414 | allow_poison = [] |
| 415 | } |
| 416 | if (!defined(assert_no_deps)) { |
| 417 | assert_no_deps = [] |
| 418 | } |
| 419 | if (!defined(deps)) { |
| 420 | deps = [] |
| 421 | } |
| 422 | foreach(p, poisonous) { |
| 423 | deps += [ webrtc_root + ":poison_" + p ] |
| 424 | } |
| 425 | foreach(poison_type, all_poison_types) { |
| 426 | allow_dep = true |
| 427 | foreach(v, visibility) { |
| 428 | if (v == "*") { |
| 429 | allow_dep = false |
| 430 | } |
| 431 | } |
| 432 | foreach(p, allow_poison + poisonous) { |
| 433 | if (p == poison_type) { |
| 434 | allow_dep = true |
| 435 | } |
| 436 | } |
| 437 | if (!allow_dep) { |
| 438 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 443 | if (!defined(testonly) || !testonly) { |
| 444 | configs += rtc_prod_configs |
| 445 | } |
| 446 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 447 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame^] | 448 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 449 | configs -= rtc_remove_configs |
| 450 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 451 | public_configs = [ |
| 452 | rtc_common_inherited_config, |
| 453 | absl_include_config, |
| 454 | absl_define_config, |
| 455 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 456 | if (defined(invoker.public_configs)) { |
| 457 | public_configs += invoker.public_configs |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | template("rtc_executable") { |
| 463 | executable(target_name) { |
| 464 | forward_variables_from(invoker, |
| 465 | "*", |
| 466 | [ |
| 467 | "deps", |
| 468 | "configs", |
| 469 | "public_configs", |
| 470 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 471 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 472 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 473 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 474 | if (!defined(visibility)) { |
| 475 | visibility = webrtc_default_visibility |
| 476 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 477 | configs += invoker.configs |
| 478 | configs -= rtc_remove_configs |
| 479 | configs -= invoker.suppressed_configs |
Tom Anderson | 9614a31 | 2018-06-11 15:10:34 -0700 | [diff] [blame] | 480 | deps = invoker.deps |
perkj | 650fdae | 2017-08-25 05:00:11 -0700 | [diff] [blame] | 481 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 482 | public_configs = [ |
| 483 | rtc_common_inherited_config, |
| 484 | absl_include_config, |
| 485 | absl_define_config, |
| 486 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 487 | if (defined(invoker.public_configs)) { |
| 488 | public_configs += invoker.public_configs |
| 489 | } |
Mirko Bonadei | 9427f48 | 2018-08-28 14:39:27 +0200 | [diff] [blame] | 490 | if (is_win) { |
| 491 | deps += [ |
| 492 | # Give executables the default manifest on Windows (a no-op elsewhere). |
| 493 | "//build/win:default_exe_manifest", |
| 494 | ] |
| 495 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 496 | } |
| 497 | } |
| 498 | |
| 499 | template("rtc_static_library") { |
| 500 | static_library(target_name) { |
| 501 | forward_variables_from(invoker, |
| 502 | "*", |
| 503 | [ |
| 504 | "configs", |
| 505 | "public_configs", |
| 506 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 507 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 508 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 509 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 510 | if (!defined(visibility)) { |
| 511 | visibility = webrtc_default_visibility |
| 512 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 513 | |
| 514 | # What's your poison? |
| 515 | if (defined(testonly) && testonly) { |
| 516 | assert(!defined(poisonous)) |
| 517 | assert(!defined(allow_poison)) |
| 518 | } else { |
| 519 | if (!defined(poisonous)) { |
| 520 | poisonous = [] |
| 521 | } |
| 522 | if (!defined(allow_poison)) { |
| 523 | allow_poison = [] |
| 524 | } |
| 525 | if (!defined(assert_no_deps)) { |
| 526 | assert_no_deps = [] |
| 527 | } |
| 528 | if (!defined(deps)) { |
| 529 | deps = [] |
| 530 | } |
| 531 | foreach(p, poisonous) { |
| 532 | deps += [ webrtc_root + ":poison_" + p ] |
| 533 | } |
| 534 | foreach(poison_type, all_poison_types) { |
| 535 | allow_dep = true |
| 536 | foreach(v, visibility) { |
| 537 | if (v == "*") { |
| 538 | allow_dep = false |
| 539 | } |
| 540 | } |
| 541 | foreach(p, allow_poison + poisonous) { |
| 542 | if (p == poison_type) { |
| 543 | allow_dep = true |
| 544 | } |
| 545 | } |
| 546 | if (!allow_dep) { |
| 547 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 548 | } |
| 549 | } |
| 550 | } |
| 551 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 552 | if (!defined(testonly) || !testonly) { |
| 553 | configs += rtc_prod_configs |
| 554 | } |
| 555 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 556 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame^] | 557 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 558 | configs -= rtc_remove_configs |
| 559 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 560 | public_configs = [ |
| 561 | rtc_common_inherited_config, |
| 562 | absl_include_config, |
| 563 | absl_define_config, |
| 564 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 565 | if (defined(invoker.public_configs)) { |
| 566 | public_configs += invoker.public_configs |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | template("rtc_shared_library") { |
| 572 | shared_library(target_name) { |
| 573 | forward_variables_from(invoker, |
| 574 | "*", |
| 575 | [ |
| 576 | "configs", |
| 577 | "public_configs", |
| 578 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 579 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 580 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 581 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 582 | if (!defined(visibility)) { |
| 583 | visibility = webrtc_default_visibility |
| 584 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 585 | |
| 586 | # What's your poison? |
| 587 | if (defined(testonly) && testonly) { |
| 588 | assert(!defined(poisonous)) |
| 589 | assert(!defined(allow_poison)) |
| 590 | } else { |
| 591 | if (!defined(poisonous)) { |
| 592 | poisonous = [] |
| 593 | } |
| 594 | if (!defined(allow_poison)) { |
| 595 | allow_poison = [] |
| 596 | } |
| 597 | if (!defined(assert_no_deps)) { |
| 598 | assert_no_deps = [] |
| 599 | } |
| 600 | if (!defined(deps)) { |
| 601 | deps = [] |
| 602 | } |
| 603 | foreach(p, poisonous) { |
| 604 | deps += [ webrtc_root + ":poison_" + p ] |
| 605 | } |
| 606 | foreach(poison_type, all_poison_types) { |
| 607 | allow_dep = true |
| 608 | foreach(v, visibility) { |
| 609 | if (v == "*") { |
| 610 | allow_dep = false |
| 611 | } |
| 612 | } |
| 613 | foreach(p, allow_poison + poisonous) { |
| 614 | if (p == poison_type) { |
| 615 | allow_dep = true |
| 616 | } |
| 617 | } |
| 618 | if (!allow_dep) { |
| 619 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 624 | configs += invoker.configs |
| 625 | configs -= rtc_remove_configs |
| 626 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 627 | public_configs = [ |
| 628 | rtc_common_inherited_config, |
| 629 | absl_include_config, |
| 630 | absl_define_config, |
| 631 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 632 | if (defined(invoker.public_configs)) { |
| 633 | public_configs += invoker.public_configs |
| 634 | } |
| 635 | } |
| 636 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 637 | |
| 638 | if (is_ios) { |
| 639 | set_defaults("rtc_ios_xctest_test") { |
| 640 | configs = rtc_add_configs |
| 641 | suppressed_configs = [] |
| 642 | } |
| 643 | |
| 644 | template("rtc_ios_xctest_test") { |
| 645 | ios_xctest_test(target_name) { |
| 646 | forward_variables_from(invoker, |
| 647 | "*", |
| 648 | [ |
| 649 | "configs", |
| 650 | "public_configs", |
| 651 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 652 | "visibility", |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 653 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 654 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 655 | if (!defined(visibility)) { |
| 656 | visibility = webrtc_default_visibility |
| 657 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 658 | configs += invoker.configs |
| 659 | configs -= rtc_remove_configs |
| 660 | configs -= invoker.suppressed_configs |
| 661 | public_configs = [ rtc_common_inherited_config ] |
| 662 | if (defined(invoker.public_configs)) { |
| 663 | public_configs += invoker.public_configs |
| 664 | } |
| 665 | } |
| 666 | } |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 667 | |
| 668 | template("ios_framework_bundle_with_umbrella_header") { |
| 669 | forward_variables_from(invoker, [ "output_name" ]) |
| 670 | umbrella_header_path = |
| 671 | "$target_gen_dir/$output_name.framework/Headers/$output_name.h" |
| 672 | |
| 673 | ios_framework_bundle(target_name) { |
| 674 | forward_variables_from(invoker, "*", []) |
| 675 | |
| 676 | deps += [ ":copy_umbrella_header_$target_name" ] |
| 677 | } |
| 678 | |
| 679 | action("umbrella_header_$target_name") { |
| 680 | forward_variables_from(invoker, [ "public_headers" ]) |
| 681 | |
| 682 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 683 | |
| 684 | outputs = [ |
| 685 | umbrella_header_path, |
| 686 | ] |
| 687 | args = [ |
| 688 | "--out", |
| 689 | rebase_path(umbrella_header_path, root_build_dir), |
| 690 | "--sources", |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 691 | ] + public_headers |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 692 | } |
| 693 | |
| 694 | copy("copy_umbrella_header_$target_name") { |
| 695 | sources = [ |
| 696 | umbrella_header_path, |
| 697 | ] |
| 698 | outputs = [ |
| 699 | "$root_out_dir/$output_name.framework/Headers/$output_name.h", |
| 700 | ] |
| 701 | |
| 702 | deps = [ |
| 703 | ":umbrella_header_$target_name", |
| 704 | ] |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | set_defaults("ios_framework_bundle_with_umbrella_header") { |
| 709 | configs = default_shared_library_configs |
| 710 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 711 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 712 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 713 | if (is_mac) { |
| 714 | template("mac_framework_bundle_with_umbrella_header") { |
| 715 | forward_variables_from(invoker, [ "output_name" ]) |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 716 | this_target_name = target_name |
| 717 | umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h" |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 718 | |
| 719 | mac_framework_bundle(target_name) { |
| 720 | forward_variables_from(invoker, "*", []) |
| 721 | |
| 722 | framework_version = "A" |
| 723 | framework_contents = [ "Headers" ] |
| 724 | |
| 725 | ldflags = [ |
| 726 | "-all_load", |
| 727 | "-install_name", |
| 728 | "@rpath/$output_name.framework/$output_name", |
| 729 | ] |
| 730 | |
| 731 | deps += [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 732 | ":copy_framework_headers_$this_target_name", |
| 733 | ":copy_umbrella_header_$this_target_name", |
| 734 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 735 | ] |
| 736 | } |
| 737 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 738 | bundle_data("copy_framework_headers_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 739 | forward_variables_from(invoker, [ "sources" ]) |
| 740 | |
| 741 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 742 | "{{bundle_contents_dir}}/Headers/{{source_file_part}}", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 743 | ] |
| 744 | } |
| 745 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 746 | action("umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 747 | forward_variables_from(invoker, [ "sources" ]) |
| 748 | |
| 749 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 750 | |
| 751 | outputs = [ |
| 752 | umbrella_header_path, |
| 753 | ] |
| 754 | args = [ |
| 755 | "--out", |
| 756 | rebase_path(umbrella_header_path, root_build_dir), |
| 757 | "--sources", |
| 758 | ] + sources |
| 759 | } |
| 760 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 761 | bundle_data("copy_umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 762 | sources = [ |
| 763 | umbrella_header_path, |
| 764 | ] |
| 765 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 766 | "{{bundle_contents_dir}}/Headers/$output_name.h", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 767 | ] |
| 768 | |
| 769 | deps = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 770 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 771 | ] |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 776 | if (is_android) { |
| 777 | template("rtc_android_library") { |
| 778 | android_library(target_name) { |
| 779 | forward_variables_from(invoker, |
| 780 | "*", |
| 781 | [ |
| 782 | "configs", |
| 783 | "public_configs", |
| 784 | "suppressed_configs", |
| 785 | "visibility", |
| 786 | ]) |
| 787 | |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 788 | javac_args = [] |
| 789 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 790 | # Treat warnings as errors. |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 791 | javac_args += [ "-Werror" ] |
| 792 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 793 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 794 | if (!build_with_chromium) { |
| 795 | javac_args += [ |
| 796 | "-Xep:ParameterNotNullable:ERROR", |
| 797 | "-Xep:FieldMissingNullable:ERROR", |
| 798 | "-Xep:ReturnMissingNullable:ERROR", |
| 799 | ] |
| 800 | } |
| 801 | |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 802 | # Add any arguments defined by the invoker. |
| 803 | if (defined(invoker.javac_args)) { |
| 804 | javac_args += invoker.javac_args |
| 805 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 806 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 807 | if (!defined(deps)) { |
| 808 | deps = [] |
| 809 | } |
| 810 | deps += [ "//third_party/jsr-305:jsr_305_javalib" ] |
| 811 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 812 | no_build_hooks = true |
| 813 | } |
| 814 | } |
| 815 | |
| 816 | template("rtc_android_apk") { |
| 817 | android_apk(target_name) { |
| 818 | forward_variables_from(invoker, |
| 819 | "*", |
| 820 | [ |
| 821 | "configs", |
| 822 | "public_configs", |
| 823 | "suppressed_configs", |
| 824 | "visibility", |
| 825 | ]) |
| 826 | |
| 827 | # Treat warnings as errors. |
| 828 | javac_args = [ "-Werror" ] |
| 829 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 830 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 831 | if (!build_with_chromium) { |
| 832 | javac_args += [ |
| 833 | "-Xep:ParameterNotNullable:ERROR", |
| 834 | "-Xep:FieldMissingNullable:ERROR", |
| 835 | "-Xep:ReturnMissingNullable:ERROR", |
| 836 | ] |
| 837 | } |
| 838 | |
| 839 | if (!defined(deps)) { |
| 840 | deps = [] |
| 841 | } |
| 842 | deps += [ "//third_party/jsr-305:jsr_305_javalib" ] |
| 843 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 844 | no_build_hooks = true |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | template("rtc_instrumentation_test_apk") { |
| 849 | instrumentation_test_apk(target_name) { |
| 850 | forward_variables_from(invoker, |
| 851 | "*", |
| 852 | [ |
| 853 | "configs", |
| 854 | "public_configs", |
| 855 | "suppressed_configs", |
| 856 | "visibility", |
| 857 | ]) |
| 858 | |
| 859 | # Treat warnings as errors. |
| 860 | javac_args = [ "-Werror" ] |
| 861 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 862 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 863 | if (!build_with_chromium) { |
| 864 | javac_args += [ |
| 865 | "-Xep:ParameterNotNullable:ERROR", |
| 866 | "-Xep:FieldMissingNullable:ERROR", |
| 867 | "-Xep:ReturnMissingNullable:ERROR", |
| 868 | ] |
| 869 | } |
| 870 | |
| 871 | if (!defined(deps)) { |
| 872 | deps = [] |
| 873 | } |
| 874 | deps += [ "//third_party/jsr-305:jsr_305_javalib" ] |
| 875 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 876 | no_build_hooks = true |
| 877 | } |
| 878 | } |
| 879 | } |