Skip to content

Commit bb00b98

Browse files
authored
Use git instead of cs (#354)
1 parent df427c5 commit bb00b98

2 files changed

Lines changed: 42 additions & 17 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.vscode
2+
tmp

scripts/update-to-latest.sh

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,48 @@ commit_rev=$(python3 -c 'import json;print(json.load(open("tmp.json"))["log"][0]
2323
grep -E -o "^Cr-Commit-Position.*" | grep -E -o "[0-9]+")
2424
rm tmp.json
2525

26-
chromium_deps_url="https://chromium.googlesource.com/chromium/src.git/+/${commit_sha}/DEPS?format=TEXT"
27-
v8_revision=$(curl --silent "${chromium_deps_url}" | base64 --decode | grep "'v8_revision':" | cut -d "'" -f4)
28-
browser_protocol_domains_url="https://chromium.googlesource.com/chromium/src.git/+/${commit_sha}/third_party/blink/public/devtools_protocol/domains?format=TEXT"
29-
browser_protocol_url="https://chromium.googlesource.com/chromium/src.git/+/${commit_sha}/third_party/blink/public/devtools_protocol/browser_protocol.pdl?format=TEXT"
30-
js_protocol_url="https://chromium.googlesource.com/v8/v8.git/+/${v8_revision}/include/js_protocol.pdl?format=TEXT"
31-
32-
if curl --output /dev/null --silent --head --fail "$browser_protocol_domains_url"; then
33-
# the 4th column is the file name in the folder (e.g., DOM.pdl).
34-
domains=$(curl --silent "${browser_protocol_domains_url}" | base64 --decode | grep .pdl | awk "{print \$4}")
35-
mkdir -p pdl/domains
36-
for domain in $domains; do
37-
browser_protocol_domain_url="https://chromium.googlesource.com/chromium/src.git/+/${commit_sha}/third_party/blink/public/devtools_protocol/domains/$domain?format=TEXT"
38-
curl --silent "${browser_protocol_domain_url}" | base64 --decode > pdl/domains/$domain
39-
sleep 3
40-
done
26+
# Fetch PDL files via sparse checkout
27+
mkdir -p tmp
28+
cd tmp
29+
30+
# Chromium PDLs
31+
if [ ! -d chromium ]; then
32+
git init chromium
33+
cd chromium
34+
git remote add origin https://chromium.googlesource.com/chromium/src.git
35+
git config core.sparseCheckout true
36+
echo "/third_party/blink/public/devtools_protocol/" >> .git/info/sparse-checkout
37+
echo "/DEPS" >> .git/info/sparse-checkout
38+
else
39+
cd chromium
4140
fi
42-
curl --silent "${browser_protocol_url}" | base64 --decode > pdl/browser_protocol.pdl
43-
curl --silent "${js_protocol_url}" | base64 --decode > pdl/js_protocol.pdl
41+
git fetch --depth 1 origin "$commit_sha"
42+
git checkout FETCH_HEAD
43+
cd ..
44+
45+
v8_revision=$(grep "'v8_revision':" chromium/DEPS | cut -d "'" -f4)
46+
47+
# V8 PDL
48+
if [ ! -d v8 ]; then
49+
git init v8
50+
cd v8
51+
git remote add origin https://chromium.googlesource.com/v8/v8.git
52+
git config core.sparseCheckout true
53+
echo "include/js_protocol.pdl" >> .git/info/sparse-checkout
54+
else
55+
cd v8
56+
fi
57+
git fetch --depth 1 origin "$v8_revision"
58+
git checkout FETCH_HEAD
59+
cd ../..
60+
61+
# Copy files
62+
cp tmp/chromium/third_party/blink/public/devtools_protocol/browser_protocol.pdl pdl/
63+
if [ -d tmp/chromium/third_party/blink/public/devtools_protocol/domains ]; then
64+
mkdir -p pdl/domains
65+
cp tmp/chromium/third_party/blink/public/devtools_protocol/domains/*.pdl pdl/domains/
66+
fi
67+
cp tmp/v8/include/js_protocol.pdl pdl/
4468

4569
# generate json from pdl
4670
convert_script="$protocol_repo_path/scripts/inspector_protocol/convert_protocol_to_json.py"

0 commit comments

Comments
 (0)