Make WebRTC work with Chromium Git checkouts

WebRTC standalone shares a lot of dependencies and build
tools with Chromium. To make the build work, many of the
paths of a Chromium checkout is now emulated by creating
symlinks to files and directories.

All DEPS entries that previously used Var("chromium_trunk")
to reference a Chromium checkout or From("chromium_deps"..)
to reference the Chromium DEPS file are now removed and
replaced by symlink entries in setup_links.py.

The script also handles cleanup of the legacy
Subversion-based dependencies that's needed for the
transition.

Windows: One Windows-specific important change is that
gclient sync|runhooks must now be run from a shell
with Administrator privileges in order to be able to create
symlinks. This also means that Windows XP is no longer
supported.

To transition a previously created checkout:
Run "python setup_links.py --force" to cleanup the old
SVN-based dependencies that have been synced by gclient sync.
For Buildbots, the --force flag is automatically enabled for
their syncs.

BUG=2863, chromium:339647
TEST=Manual testing on Linux, Mac and Windows.
R=andrew@webrtc.org, iannucci@chromium.org, phoglund@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18379005

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6938 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/build/download_vs_toolchain.py b/build/download_vs_toolchain.py
index 2462bdc..e69de29 100644
--- a/build/download_vs_toolchain.py
+++ b/build/download_vs_toolchain.py
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS.  All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-# This script is used to run the vs_toolchain.py script to download the
-# Visual Studio toolchain. It's just a temporary measure while waiting for the
-# Chrome team to move find_depot_tools into src/build to get rid of these
-# workarounds (similar one in gyp_webrtc).
-
-import os
-import sys
-
-
-script_dir = os.path.dirname(os.path.realpath(__file__))
-checkout_root = os.path.abspath(os.path.join(script_dir, os.pardir, os.pardir))
-sys.path.insert(0, os.path.join(checkout_root, 'build'))
-sys.path.insert(0, os.path.join(checkout_root, 'tools', 'find_depot_tools'))
-
-
-import vs_toolchain
-
-
-if __name__ == '__main__':
-  sys.exit(vs_toolchain.main())
diff --git a/build/gyp_webrtc b/build/gyp_webrtc
index 4d5ae79..edc6b36 100755
--- a/build/gyp_webrtc
+++ b/build/gyp_webrtc
@@ -20,7 +20,6 @@
 checkout_root = os.path.abspath(os.path.join(script_dir, os.pardir, os.pardir))
 
 sys.path.insert(0, os.path.join(checkout_root, 'build'))
-sys.path.insert(0, os.path.join(checkout_root, 'tools', 'find_depot_tools'))
 import gyp_chromium
 import gyp_helper
 import vs_toolchain
@@ -28,6 +27,13 @@
 sys.path.insert(0, os.path.join(checkout_root, 'tools', 'gyp', 'pylib'))
 import gyp
 
+def GetSupplementalFiles():
+  """Returns a list of the supplemental files that are included in all GYP
+  sources."""
+  # Can't use the one in gyp_chromium since the directory location of the root
+  # is different.
+  return glob.glob(os.path.join(checkout_root, '*', 'supplement.gypi'))
+
 
 if __name__ == '__main__':
   args = sys.argv[1:]
@@ -52,7 +58,10 @@
 
   # If we didn't get a file, assume 'all.gyp' in the root of the checkout.
   if not gyp_file_specified:
-    args.append(os.path.join(checkout_root, 'all.gyp'))
+    # Because of a bug in gyp, simply adding the abspath to all.gyp doesn't
+    # work, but chdir'ing and adding the relative path does. Spooky :/
+    os.chdir(checkout_root)
+    args.append('all.gyp')
 
   # There shouldn't be a circular dependency relationship between .gyp files,
   args.append('--no-circular-check')
@@ -68,7 +77,7 @@
   # Enforce gyp syntax checking. This adds about 20% execution time.
   args.append('--check')
 
-  supplemental_includes = gyp_chromium.GetSupplementalFiles()
+  supplemental_includes = GetSupplementalFiles()
   gn_vars_dict = gyp_chromium.GetGypVars(supplemental_includes)
 
   # Automatically turn on crosscompile support for platforms that need it.