chromium·自己整了一套構建系統,原來叫gclient(名字好像讓位給google桌面客戶端了) ,現在改名depot_tools
目標:
Wrapper
script for checking out and updating source code from multiple SCM repository locations.
chromium使用了(目前 @159834)107個代碼倉庫的代碼,這些分散在多個代碼倉庫,chromiun不需要某些倉庫的東西,google就封裝個工具,這個工具既支持svn,也支持git,不光能down代碼,也支持了
- patch
- cpplint,pylint
- apply_issue
- junction
- codereview
chromium·使用它來
- 更新chromium·代碼
- 生成工程文件,windows上生產sln,mac生產xcode工程,linux生成scons或者makefile
- 其他的patch,codereview,管理分散開發人員的修改
使用說明在這兒
http://www.chromium.org/developers/how-tos/depottools
用gclient 獲取代碼
- 首先會更新 depot_tools,有兩種 bat和sh,目的都一樣
更新depot_tools,然後運行python版gclient.py,參數都傳給gclient.py
這裏解決了雞生蛋還是蛋生雞的問題,更新了gclient.py - 生成.gclient文件,gclient指定了某個版本的chromium·代碼
- 執行gclient sync,更新代碼,生成工程文件,這裏使用了另一個工具 GYP
gclient 命令有:
Commands are: cleanup Cleans up all working copies. config Create a .gclient file in the current directory. diff Displays local diff for every dependencies. fetch Fetches upstream commits for all modules. help Prints list of commands or help for a specific command. hookinfo Output the hooks that would be run by `gclient runhooks` pack Generate a patch which can be applied at the root of the tree. recurse Operates on all the entries. revert Revert all modifications in every dependencies. revinfo Output revision info mapping for the client and its dependencies. runhooks Runs hooks for files that have been modified in the local working copy. status Show modification status for every dependencies. sync Checkout/update all modules. update Alias for the sync command. Deprecated. Prints list of commands or help for a specific command. Options: --version show program's version number and exit -h, --help show this help message and exit -j JOBS, --jobs=JOBS Specify how many SCM commands can run in parallel; default=8 -v, --verbose Produces additional output for diagnostics. Can be used up to three times for more logging info. --gclientfile=CONFIG_FILENAME Specify an alternate .gclient file --spec=SPEC create a gclient file containing the provided string. Due to Cygwin/Python brokenness, it probably can't contain any newlines.
具體例子:
1.安裝工具
http://www.chromium.org/developers/how-tos/install-depot-tools
2.配置
主要是寫
.gclient和DEPS python語法(精確點就是json語法+“#”型註釋,list最末元素可以有,執行時使用python的eval來解釋的)
.gclient
solutions = [
{ "name" : "src",
"url" : "http://skia.googlecode.com/svn/trunk",
"custom_deps" : {
}
}
]
DEPS
vars = {
}
deps = {
"src/testing/gtest":
(Var("googlecode_url") % "googletest") + "/trunk@621",
"src/testing/gmock":
(Var("googlecode_url") % "googlemock") + "/trunk@405",
}
deps_os = {
"win": {
},
}
include_rules = [
]
skip_child_includes = [
]
hooks = [
{
# This downloads binaries for Native Client's newlib toolchain.
# Done in lieu of building the toolchain from scratch as it can take
# anywhere from 30 minutes to 4 hours depending on platform to build.
"pattern": ".",
"action": [
"python", "src/build/download_nacl_toolchains.py",
"--no-arm-trusted",
"--save-downloads-dir",
"src/native_client_sdk/src/build_tools/toolchain_archives",
"--keep",
],
},
{
# Pull clang on mac. If nothing changed, or on non-mac platforms, this takes
# zero seconds to run. If something changed, it downloads a prebuilt clang,
# which takes ~20s, but clang speeds up builds by more than 20s.
"pattern": ".",
"action": ["python", "src/tools/clang/scripts/update.py", "--mac-only"],
},
{
# Update the cygwin mount on Windows.
"pattern": ".",
"action": ["python", "src/build/win/setup_cygwin_mount.py", "--win-only"],
},
{
# Update LASTCHANGE. This is also run by export_tarball.py in
# src/tools/export_tarball - please keep them in sync.
"pattern": ".",
"action": ["python", "src/build/util/lastchange.py",
"-o", "src/build/util/LASTCHANGE"],
},
{
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
"pattern": ".",
"action": ["python", "src/build/gyp_chromium"],
},
]
sync時會自動下載DEPS中指定的依賴和執行hooks中的命令,chromium就是如此,可以看第一層目錄中的.gclient文件和DEPSgcl命令有:
基本能和svn對起來
Commands are: change Creates or edits a changelist. changes Lists all the changelists and their files. commit Commits the changelist to the repository. delete Deletes a changelist. deleteempties Delete all changelists that have no files. description Prints the description of the specified change to stdout. diff Diffs all files in the changelist or all files that aren't in a CL. help Prints this help or help for the given command. lint Runs cpplint.py on all the files in the change list. nothave Lists files unknown to Subversion. opened Lists modified files in the current directory down. passthru Everything else that is passed into gcl we redirect to svn. presubmit Runs presubmit checks on the change. rename Renames an existing change. settings Prints code review settings for this checkout. status Lists modified and unknown files in the current directory down. try Sends the change to the tryserver to do a test run on your code. upload Uploads the changelist to the server for review.