http://www.chromium.org/developers/how-tos/depottools

gclient:  Meta-checkout tool managing both subversion and git checkouts. It is similar to repo tool except that it works on Linux, OS X, and Windows and supports both svn and git. On the other hand, gclient doesn't integrate any code review functionality.

下面参考 http://code.google.com/p/chromium/wiki/UsingNewGit 通过 gclient 获取chromium 的代码

1、gclient config http://git.chromium.org/chromium/src.git --git-deps

生成 .gclient 文件,内容如下

   
   
   
   
  1. solutions = [ 
  2.   { "name"        : "src", 
  3.     "url"         : "http://git.chromium.org/chromium/src.git", 
  4.     "deps_file"   : ".DEPS.git", 
  5.     "managed"     : True, 
  6.     "custom_deps" : { 
  7.     }, 
  8.     "safesync_url": "", 
  9.   }, 

2、Edit your .gclient file to avoid checking out the enormous set of WebKit layout tests and that what won't need that you can put there:

"src/third_party/WebKit/LayoutTests": None,
"src/content/test/data/layout_tests/LayoutTests": None,
"src/chrome_frame/tools/test/reference_build/chrome": None,
"src/chrome_frame/tools/test/reference_build/chrome_win": None,
"src/chrome/tools/test/reference_build/chrome": None,
"src/chrome/tools/test/reference_build/chrome_linux": None,
"src/chrome/tools/test/reference_build/chrome_mac": None,
"src/chrome/tools/test/reference_build/chrome_win": None,

现在.gclient 文件,内容如下

   
   
   
   
  1. solutions = [ 
  2.   { "name"        : "src", 
  3.     "url"         : "http://git.chromium.org/chromium/src.git", 
  4.     "deps_file"   : ".DEPS.git", 
  5.     "managed"     : True, 
  6.     "custom_deps" : { 
  7.         "src/third_party/WebKit/LayoutTests": None, 
  8.         "src/content/test/data/layout_tests/LayoutTests": None, 
  9.         "src/chrome_frame/tools/test/reference_build/chrome": None, 
  10.         "src/chrome_frame/tools/test/reference_build/chrome_win": None, 
  11.         "src/chrome/tools/test/reference_build/chrome": None, 
  12.         "src/chrome/tools/test/reference_build/chrome_linux": None, 
  13.         "src/chrome/tools/test/reference_build/chrome_mac": None, 
  14.         "src/chrome/tools/test/reference_build/chrome_win": None, 
  15.     }, 
  16.     "safesync_url": "", 
  17.   }, 

3、Now do a sync to create the src/ folder and get the source code.

   
   
   
   
  1. # Linux: First time only you must use '--nohooks' to pull only source code, 
  2. # then install dependencies. 
  3. gclient sync --nohooks 
  4. ./src/build/install-build-deps.sh 
  5. gclient sync 
  6.  
  7. # All platforms: 
  8. gclient sync 

 

想了解 gclient 的字段的含义,请参考  http://src.chromium.org/svn/trunk/tools/depot_tools/README.gclient

   
   
   
   
  1. name 
  2.         The name of the directory in which the solution will be 
  3.         checked out. 
  4.  
  5.     url 
  6.         The URL from which this solution will be checked out. 
  7.         gclient expects that the checked-out solution will contain a 
  8.         file named "DEPS" that in turn defines the specific pieces 
  9.         that must be checked out to create the working directory 
  10.         layout for building and developing the solution's software. 
  11.  
  12.     deps_file 
  13.         A string containing just the filename (not a path) of the file 
  14.         in the solution dir to use as the list of dependencies. 
  15.         This tag is optional, and defaults to "DEPS". 
  16.  
  17.     custom_deps 
  18.         A dictionary containing optional custom overrides for entries 
  19.         in the solution's "DEPS" file.  This can be used to have 
  20.         the local working directory *not* check out and update specific 
  21.         components, or to sync the local working-directory copy of a 
  22.         given component to a different specific revision, or a branch, 
  23.         or the head of a tree. It can also be used to append new entries 
  24.         that do not exist in the "DEPS" file.