GN: Introduce templates.

Defines the rtc_executable, rtc_source_set, rtc_test and
rtc_static_library templates.

These templates provide no functionality yet, but will enable common
configuration to be introduced, avoiding repetition in every target

Changes summary:
- Prepend rtc_ to test, source_set, executable and static_library targets
- Change "configs -= [" to "suppressed_configs += ["
- Include webrtc/build/webrtc.gni where it wasn't included yet
- Delete import("//testing/test.gni"), since rtc_test makes it unnecessary.

BUG=webrtc:6187
TBR=henrik.lundin@webrtc.org,tommi@webrtc.org
NOTRY=True

Review-Url: https://codereview.webrtc.org/2301053002
Cr-Commit-Position: refs/heads/master@{#14043}
diff --git a/webrtc/examples/BUILD.gn b/webrtc/examples/BUILD.gn
index b4d2bbe..6eb3f6f 100644
--- a/webrtc/examples/BUILD.gn
+++ b/webrtc/examples/BUILD.gn
@@ -6,6 +6,7 @@
 # in the file PATENTS.  All contributing project authors may
 # be found in the AUTHORS file in the root of the source tree.
 
+import("../build/webrtc.gni")
 if (is_android) {
   import("//build/config/android/config.gni")
   import("//build/config/android/rules.gni")
@@ -14,9 +15,6 @@
 } else if (is_ios) {
   import("//build/config/ios/rules.gni")
 }
-if (is_linux || is_win) {
-  import("//webrtc/build/webrtc.gni")
-}
 if (is_linux) {
   import("//build/config/linux/pkg_config.gni")
 }
@@ -136,7 +134,7 @@
     include_dirs = [ "objc/AppRTCDemo/common" ]
   }
 
-  source_set("apprtc_common") {
+  rtc_source_set("apprtc_common") {
     sources = [
       "objc/AppRTCDemo/common/ARDUtilities.h",
       "objc/AppRTCDemo/common/ARDUtilities.m",
@@ -173,7 +171,7 @@
     }
   }
 
-  source_set("apprtc_signaling") {
+  rtc_source_set("apprtc_signaling") {
     sources = [
       "objc/AppRTCDemo/ARDAppClient+Internal.h",
       "objc/AppRTCDemo/ARDAppClient.h",
@@ -293,7 +291,7 @@
   }
 
   if (is_mac) {
-    source_set("AppRTCDemo_app") {
+    rtc_source_set("AppRTCDemo_app") {
       sources = [
         "objc/AppRTCDemo/mac/APPRTCAppDelegate.h",
         "objc/AppRTCDemo/mac/APPRTCAppDelegate.m",
@@ -356,7 +354,7 @@
     }
   }
 
-  source_set("socketrocket") {
+  rtc_source_set("socketrocket") {
     sources = [
       "objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.h",
       "objc/AppRTCDemo/third_party/SocketRocket/SRWebSocket.m",
@@ -406,7 +404,7 @@
     }
   }
 
-  executable("peerconnection_client") {
+  rtc_executable("peerconnection_client") {
     sources = [
       "peerconnection/client/conductor.cc",
       "peerconnection/client/conductor.h",
@@ -418,7 +416,7 @@
     if (is_clang) {
       # Suppress warnings from the Chromium Clang plugin.
       # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-      configs -= [ "//build/config/clang:find_bad_constructs" ]
+      suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
     }
     if (is_win) {
       sources += [
@@ -456,7 +454,7 @@
       deps += [ "//third_party/jsoncpp" ]
     }
   }
-  executable("peerconnection_server") {
+  rtc_executable("peerconnection_server") {
     sources = [
       "peerconnection/server/data_socket.cc",
       "peerconnection/server/data_socket.h",
@@ -475,10 +473,10 @@
     if (is_clang) {
       # Suppress warnings from the Chromium Clang plugin.
       # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-      configs -= [ "//build/config/clang:find_bad_constructs" ]
+      suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
     }
   }
-  executable("relayserver") {
+  rtc_executable("relayserver") {
     sources = [
       "relayserver/relayserver_main.cc",
     ]
@@ -492,10 +490,10 @@
     if (is_clang) {
       # Suppress warnings from the Chromium Clang plugin.
       # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-      configs -= [ "//build/config/clang:find_bad_constructs" ]
+      suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
     }
   }
-  executable("turnserver") {
+  rtc_executable("turnserver") {
     sources = [
       "turnserver/turnserver_main.cc",
     ]
@@ -509,10 +507,10 @@
     if (is_clang) {
       # Suppress warnings from the Chromium Clang plugin.
       # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-      configs -= [ "//build/config/clang:find_bad_constructs" ]
+      suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
     }
   }
-  executable("stunserver") {
+  rtc_executable("stunserver") {
     sources = [
       "stunserver/stunserver_main.cc",
     ]
@@ -526,7 +524,7 @@
     if (is_clang) {
       # Suppress warnings from the Chromium Clang plugin.
       # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-      configs -= [ "//build/config/clang:find_bad_constructs" ]
+      suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
     }
   }
 }