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