-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
chromium.sh
100 lines (79 loc) · 3.25 KB
/
chromium.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# usage:
# after `git pull`, a full build is now `depsbcr` or `deps && b && cr`
# and after changes.. a `bcr` will recompile and relaunch chrome.
# 2021 update: __dt versions of these functions are added for the chromium-devtools repo.
function deps () {
# --reset drops local changes. often great, but if making changes inside v8, you don't want to use --reset
# also reset seems to reset branch position in the devtools-internal repo??? weird.
gclient sync --delete_unversioned_trees --jobs=70
}
function hooks () {
gclient runhooks
}
function b () {
local dir=./$(git rev-parse --show-cdup)/out/Default
# autoninja will automatically determine your -j number based on CPU cores
local cmd="autoninja -C $(realpath $dir) chrome"
echo " > $cmd"
# start the compile
eval $cmd
if [ $? -eq 0 ]; then
osascript -e 'display notification "" with title "✅ Chromium compile done"'
else
osascript -e 'display notification "" with title "❌ Chromium compile failed"'
fi
}
function dtb () {
local dir_default=$(realpath $PWD/$(git rev-parse --show-cdup)out/Default/)
local cmd="autoninja -C $dir_default"
echo " > $cmd"
eval $cmd
}
# https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
# # Avoid the startup dialog for 'Chromium wants to use your confidential information stored in "Chromium Safe Storage" in your keychain'
# # Avoid the startup dialog for 'Do you want the application “Chromium.app” to accept incoming network connections?'
# # Avoid weird interaction between this experiment and CDP targets
# # Hides blue bubble "user education" nudges
# # Hides Chrome for Testing bar, among others.
clutch_chrome_flags="--use-mock-keychain --disable-features=MediaRouter,ProcessPerSiteUpToMainFrameThreshold --ash-no-nudges --disable-infobars"
# you can also add any extra args: `cr --user-data-dir=/tmp/lol123"
# (disable DialMediaRouteProvider gets rid of that "do you want to accept incoming connections" prompt)
function cr () {
local dir="./$(git rev-parse --show-cdup)/out/Default"
local cmd="./$dir/Chromium.app/Contents/MacOS/Chromium $clutch_chrome_flags $argv"
echo " > $cmd"
eval "$cmd"
}
function dtcr () {
local crpath="./$(git rev-parse --show-cdup)/third_party/chrome/chrome-mac/Chromium.app/Contents/MacOS/Chromium"
local dtpath=$(realpath out/Default/gen/front_end)
local cmd="$crpath --custom-devtools-frontend=file://$dtpath --user-data-dir=$HOME/chromium-devtools/dt-chrome-profile $clutch_chrome_flags $argv"
echo " > $cmd"
eval "$cmd"
}
function dtbcr () {
if dtb; then
dtcr
fi
}
function bcr () {
if b; then
cr
fi
}
function depsb () {
if deps; then
b
fi
}
function depsbcr () {
if deps; then
bcr
fi
}
function hooksbcr () {
if hooks; then
bcr
fi
}