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 = [ ]
sync时会自动下载DEPS中指定的依赖和执行hooks中的命令,chromium就是如此,可以看第一层目录中的.gclient文件和DEPShooks = [ { # 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"], }, ]
gcl命令有:
基本能和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.