如何获得电子v3.1.6和 依赖铬代码?
这是有关Electron官方提供的获取代码的信息,但这是获取最新代码的信息。
mkdir electronic-gn && cd electronic-gn gclient配置\ --name“ src / electron” \ -不受管理\ https://github.com/electron/electron gclient sync --with_branch_heads --with_tags
答案 0 :(得分:0)
请注意,使用--unmanaged
选项可以使它可以更改远程(仓库)和/或分支,而gclient
对此不做任何事情。 (如果我理解正确的话。)
来自gclient config --help
:
-非托管会覆盖默认行为,以使 具有gclient不变的主要解决方案(gclient 将检查非托管依赖项,但永远不会 同步它们)
因此,您可以进入src/electron
文件夹并签出您喜欢的任何分支。下面是我为此基于official build instructions(YMMV)编写的脚本。
#!/bin/bash
GN_DIR=${HOME}/tmp/electron-gn
SRC_DIR=$GN_DIR/src
ELECTRON_REPO_URL=https://github.com/user/electron
ELECTRON_REPO_BRANCH=some_branch
# mkdir -p $HOME/tmp
# cd $HOME/tmp
# git clone https://chromium.googlesource.com/chromium/tools/depot_tools
DEPOT_TOOLS_DIR=${HOME}/tmp/depot_tools
# Add depot_tools to PATH if not already there (need gclient, gn, ninja, cipd, etc.)
[[ ":$PATH:" != *":${DEPOT_TOOLS_DIR}:"* ]] && export PATH="${PATH}:${DEPOT_TOOLS_DIR}"
export GIT_CACHE_PATH="${HOME}/.git_cache"
export SCCACHE_BUCKET="electronjs-sccache-ci"
export SCCACHE_TWO_TIER=true
export CHROMIUM_BUILDTOOLS_PATH=$SRC_DIR/buildtools
export GN_EXTRA_ARGS="${GN_EXTRA_ARGS} cc_wrapper=\"${SRC_DIR}/electron/external_binaries/sccache\""
echo "Configuring environment with gclient"
cd $GN_DIR
gclient config --name "src/electron" --unmanaged $ELECTRON_REPO_URL
gclient sync --with_branch_heads --with_tags
echo "Making sure electron repo is tracking with $ELECTRON_REPO_URL"
cd src/electron
git checkout $ELECTRON_REPO_BRANCH
#git branch --set-upstream-to=origin/$ELECTRON_REPO_BRANCH
git pull
cd -
echo "Making sure electron repo is up to date"
cd src/electron
git pull
gclient sync -f
cd -
cd $SRC_DIR
echo "Generating config"
gn gen out/Debug --args="import(\"//electron/build/args/debug.gn\") $GN_EXTRA_ARGS"
echo "Building"
ninja -C out/Debug electron