<commit_before>#!/bin/bash

# This script rolls new protocol files into https://github.com/ChromeDevTools/devtools-protocol
# This script is intended to be run on a regular schedule, e.g. via cron.

set -x

# These locations are very machine specific.
chromium_src_path="$HOME/chromium-tot/src"
protocol_repo_path="$HOME/code/pristine/devtools-protocol"

# => cd into protocol repo
cd "$protocol_repo_path" || exit 1
git submodule update --init
# always work with the latest inspector_protocol repo
git submodule foreach git pull origin master

# => cd into chromium
cd "$chromium_src_path" || exit 1

# get latest from chromium master
git fetch origin
git checkout -f origin/master
env GYP_DEFINES=disable_nacl=1 gclient sync --jobs=70 --nohooks


browser_protocol_path="$chromium_src_path/third_party/blink/renderer/core/inspector/browser_protocol.pdl"
js_protocol_path="$chromium_src_path/v8/src/inspector/js_protocol.pdl"

# copy the two protocol.pdl files over.
cp "$js_protocol_path" "$protocol_repo_path/pdl"
cp "$browser_protocol_path" "$protocol_repo_path/pdl"

# extract cr revision number
commit_pos_line=$(git log --date=iso --no-color --max-count=1 | gtac | grep -E -o "Cr-Commit-Position.*")
commit_rev=$(echo "$commit_pos_line" | grep -E -o "\d+")

# generate json from pdl
convert_script="$protocol_repo_path/scripts/inspector_protocol/convert_protocol_to_json.py"
python "$convert_script" "$protocol_repo_path/pdl/browser_protocol.pdl" "$protocol_repo_path/json/browser_protocol.json"
python "$convert_script" "$protocol_repo_path/pdl/js_protocol.pdl" "$protocol_repo_path/json/js_protocol.json"


# generate externs
python "$chromium_src_path/third_party/blink/renderer/devtools/scripts/build/generate_protocol_externs.py" -o "$protocol_repo_path/externs/protocol_externs.js" "$browser_protocol_path" "$js_protocol_path"<commit_msg>cleanup extra json files. fixes #100<commit_after>#!/bin/bash

# This script rolls new protocol files into https://github.com/ChromeDevTools/devtools-protocol
# This script is intended to be run on a regular schedule, e.g. via cron.

set -x

# These locations are very machine specific.
chromium_src_path="$HOME/chromium-tot/src"
protocol_repo_path="$HOME/code/pristine/devtools-protocol"

# => cd into protocol repo
cd "$protocol_repo_path" || exit 1
git submodule update --init
# always work with the latest inspector_protocol repo
git submodule foreach git pull origin master

# => cd into chromium
cd "$chromium_src_path" || exit 1

# get latest from chromium master
git fetch origin
git checkout -f origin/master
env GYP_DEFINES=disable_nacl=1 gclient sync --jobs=70 --nohooks


browser_protocol_path="$chromium_src_path/third_party/blink/renderer/core/inspector/browser_protocol.pdl"
js_protocol_path="$chromium_src_path/v8/src/inspector/js_protocol.pdl"

# copy the two protocol.pdl files over.
cp "$js_protocol_path" "$protocol_repo_path/pdl"
cp "$browser_protocol_path" "$protocol_repo_path/pdl"

# extract cr revision number
commit_pos_line=$(git log --date=iso --no-color --max-count=1 | gtac | grep -E -o "Cr-Commit-Position.*")
commit_rev=$(echo "$commit_pos_line" | grep -E -o "\d+")

# generate json from pdl
convert_script="$protocol_repo_path/scripts/inspector_protocol/convert_protocol_to_json.py"
python "$convert_script" "$protocol_repo_path/pdl/browser_protocol.pdl" "$protocol_repo_path/json/browser_protocol.json"
python "$convert_script" "$protocol_repo_path/pdl/js_protocol.pdl" "$protocol_repo_path/json/js_protocol.json"
# The conversion script leaves json files next to the pdl's. Because reasons.
rm -f "$protocol_repo_path"/pdl/*.json

# generate externs
python "$chromium_src_path/third_party/blink/renderer/devtools/scripts/build/generate_protocol_externs.py" -o "$protocol_repo_path/externs/protocol_externs.js" "$browser_protocol_path" "$js_protocol_path"
{'fraction_non_alphanumeric': 0.11148736650169315, 'fraction_numerical': 0.004428236519927064, 'mean_word_length': 6.084870848708487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '213395', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1243, 'n_words': 297}