Setting is_component_build to false by default

Webrtc does not support component builds so we want to override
the chromium default value (which can be true on debug builds if the
os is different from iOS).

Please note that the user can set this value to true in two ways:

 - using --args (e.g.: gn gen out/default --args='is_component_build=true'
 - changing the value in the args.gn file

But in both cases the value will be ignored because we don't use the
'component' template but we rely directly on 'rtc_static_library' and
'rtc_shared_library'.

BUG=webrtc:6975
NOTRY=True

Review-Url: https://codereview.webrtc.org/2728643003
Cr-Commit-Position: refs/heads/master@{#17020}
diff --git a/.gn b/.gn
index 2070fa8..547ca84 100644
--- a/.gn
+++ b/.gn
@@ -51,3 +51,14 @@
 # to force additional review for new uses of exec_script, which is strongly
 # discouraged except for gypi_to_gn calls.
 exec_script_whitelist = build_dotfile_settings.exec_script_whitelist
+
+default_args = {
+  # Webrtc does not support component builds because we are not using the
+  # template "component" but we rely directly on "rtc_static_library" and
+  # "rtc_shared_library". This means that we cannot use the chromium default
+  # value for this argument.
+  # This also means that the user can override this value using --args or
+  # the args.gn file but this setting will be ignored because we don't support
+  # component builds.
+  is_component_build = false
+}
diff --git a/tools-webrtc/mb/mb_config.pyl b/tools-webrtc/mb/mb_config.pyl
index c31ba19..e0aa0ea 100644
--- a/tools-webrtc/mb/mb_config.pyl
+++ b/tools-webrtc/mb/mb_config.pyl
@@ -213,10 +213,10 @@
       'gn', 'openh264_release_bot', 'x64'
     ],
     'perf_release_bot_x86': [
-      'gn', 'openh264', 'release', 'static', 'goma', 'x86'
+      'gn', 'openh264', 'release', 'goma', 'x86'
     ],
     'perf_release_bot_x64': [
-      'gn', 'openh264', 'release', 'static', 'goma', 'x64'
+      'gn', 'openh264', 'release', 'goma', 'x64'
     ],
     'libfuzzer_asan_release_bot_x64': [
       'libfuzzer', 'asan', 'optimize_for_fuzzing', 'openh264_release_bot', 'x64'
@@ -286,13 +286,13 @@
       'android', 'gn', 'debug_static_bot', 'x64'
     ],
     'android_asan_shared_release_bot_arm': [
-      'android', 'gn', 'asan', 'clang', 'shared', 'release_bot', 'arm'
+      'android', 'gn', 'asan', 'clang', 'release_bot', 'arm'
     ],
     'perf_android_release_bot_arm': [
-      'android', 'gn', 'release', 'static', 'goma', 'arm'
+      'android', 'gn', 'release', 'goma', 'arm'
     ],
     'perf_android_release_bot_arm64': [
-      'android', 'gn', 'release', 'static', 'goma', 'arm64'
+      'android', 'gn', 'release', 'goma', 'arm64'
     ],
 
     # This is used for tracking purposes; any bot that uses this config
@@ -334,11 +334,11 @@
     },
 
     'debug_bot': {
-      'mixins': ['debug', 'shared', 'goma'],
+      'mixins': ['debug', 'goma'],
     },
 
     'debug_static_bot': {
-      'mixins': ['debug', 'static', 'minimal_symbols', 'goma'],
+      'mixins': ['debug', 'minimal_symbols', 'goma'],
     },
 
     # This mixin is used to force configs that use it to fail. It
@@ -413,15 +413,7 @@
     },
 
     'release_bot': {
-      'mixins': ['release', 'static', 'dcheck_always_on', 'goma'],
-    },
-
-    'shared': {
-      'gn_args': 'is_component_build=true',
-    },
-
-    'static': {
-      'gn_args': 'is_component_build=false',
+      'mixins': ['release', 'dcheck_always_on', 'goma'],
     },
 
     'syzyasan': {
diff --git a/webrtc/webrtc.gni b/webrtc/webrtc.gni
index 96975fa..48fc154 100644
--- a/webrtc/webrtc.gni
+++ b/webrtc/webrtc.gni
@@ -13,6 +13,21 @@
 import("//build/config/ui.gni")
 import("//build_overrides/build.gni")
 import("//testing/test.gni")
+
+if (is_component_build) {
+  print("The Gn argument `is_component_build` is currently " +
+        "ignored for WebRTC builds.")
+  print("Component builds are supported by Chromium and the argument " +
+        "`is_component_build` makes it possible to create shared libraries " +
+        "instead of static libraries.")
+  print("If an app depends on WebRTC it makes sense to just depend on the " +
+        "WebRTC static library, so there is no difference between " +
+        "`is_component_build=true` and `is_component_build=false`.")
+  print(
+      "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md")
+  assert(!is_component_build, "Component builds are not supported in WebRTC.")
+}
+
 if (is_ios) {
   import("//build/config/ios/rules.gni")
 }