Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5acb7d0

Browse files
code-asherTinLe
authored andcommitted
chore: move to patches (coder#4997)
* Move integration types into code-server This will be easier to maintain than to have it as a patch. * Disable connection token Using a flag means we will not need to patch it out. I think this is new from 1.64? * Add product.json to build process This way we do not have to patch it. * Ship with remote agent package.json Instead of the root one. This contains fewer dependencies. * Let Code handle errors This way we will not have to patch Code to make this work and I think it makes sense to let Code handle the request. If we do want to handle errors we can do it cleanly by patching their error handler to throw instead. * Move manifest override into code-server This way we will not have to patch it. * Move to patches - Switch submodule to track upstream - Add quilt to the process - Add patches The node-* ignore was ignoring one of the diffs so I removed it. This was added when we were curling Node as node-v{version}-darwin-x64 for the macOS build but this no longer happens (we use the Node action to install a specific version now so we just use the system-wide Node). * Use pre-packaged Code
1 parent 510f702 commit 5acb7d0

37 files changed

+2245
-210
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ jobs:
110110
fetch-depth: 0
111111
submodules: true
112112

113+
- name: Install quilt
114+
run: sudo apt update && sudo apt install quilt
115+
116+
- name: Patch Code
117+
run: quilt push -a
118+
113119
- name: Install Node.js v14
114120
uses: actions/setup-node@v3
115121
with:
@@ -132,25 +138,22 @@ jobs:
132138
run: yarn build
133139

134140
# Get Code's git hash. When this changes it means the content is
135-
# different and we need to rebuild. Use VSCODE_CACHE_VERSION to force a
136-
# rebuild.
141+
# different and we need to rebuild.
137142
- name: Get latest lib/vscode rev
138143
id: vscode-rev
139144
run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
140145

141-
- name: Fetch Code build from cache
142-
id: cache-vscode-2
146+
# We need to rebuild when we have a new version of Code or when any of
147+
# the patches changed. Use VSCODE_CACHE_VERSION to force a rebuild.
148+
- name: Fetch prebuilt Code package from cache
149+
id: cache-vscode
143150
uses: actions/cache@v3
144151
with:
145-
path: |
146-
lib/vscode/.build
147-
lib/vscode/out-build
148-
lib/vscode/out-vscode-reh-web
149-
lib/vscode/out-vscode-reh-web-min
150-
key: vscode-reh-build-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}
152+
path: lib/vscode-reh-web-*
153+
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff') }}
151154

152155
- name: Build vscode
153-
if: steps.cache-vscode-2.outputs.cache-hit != 'true'
156+
if: steps.cache-vscode.outputs.cache-hit != 'true'
154157
run: yarn build:vscode
155158

156159
# Our code imports code from VS Code's `out` directory meaning VS Code

‎.gitignore‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ release-packages/
88
release-gcp/
99
release-images/
1010
node_modules
11-
vendor/modules
12-
node-*
1311
/plugins
1412
/lib/coder-cloud-agent
1513
.home
1614
coverage
1715
**/.DS_Store
16+
17+
# Code packages itself here.
18+
/lib/vscode-reh-web-*
19+
1820
# Failed e2e test videos are saved here
1921
test/test-results
22+
23+
# Quilt's internal data.
24+
/.pc

‎.gitmodules‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "lib/vscode"]
22
path = lib/vscode
3-
url = https://github.com/coder/vscode
3+
url = https://github.com/microsoft/vscode

‎ci/build/build-packages.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ release_nfpm() {
5050

5151
export NFPM_ARCH
5252

53+
# Code deletes some files from the extension node_modules directory which
54+
# leaves broken symlinks in the corresponding .bin directory. nfpm will fail
55+
# on these broken symlinks so clean them up.
56+
rm -fr "./release-standalone/lib/vscode/extensions/node_modules/.bin"
57+
5358
PKG_FORMAT="deb"
5459
NFPM_ARCH="$(get_nfpm_arch $PKG_FORMAT "$ARCH")"
5560
nfpm_config="$(envsubst < ./ci/build/nfpm.yaml)"

‎ci/build/build-release.sh‎

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -66,47 +66,59 @@ EOF
6666

6767
bundle_vscode() {
6868
mkdir -p "$VSCODE_OUT_PATH"
69-
rsync "$VSCODE_SRC_PATH/yarn.lock" "$VSCODE_OUT_PATH"
70-
rsync "$VSCODE_SRC_PATH/out-vscode-reh-web${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
69+
rsync ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
7170

72-
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
73-
if [ "$KEEP_MODULES" = 0 ]; then
74-
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
75-
else
76-
rsync "$VSCODE_SRC_PATH/node_modules/" "$VSCODE_OUT_PATH/node_modules"
77-
fi
78-
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions"
79-
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions"
80-
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"
81-
82-
mkdir -p "$VSCODE_OUT_PATH/resources/"
83-
rsync "$VSCODE_SRC_PATH/resources/" "$VSCODE_OUT_PATH/resources/"
84-
85-
# TODO: We should look into using VS Code's packaging task (see
86-
# gulpfile.reh.js). For now copy this directory into the right spot (for some
87-
# reason VS Code uses a different path in production).
88-
mkdir -p "$VSCODE_OUT_PATH/bin/helpers"
89-
rsync "$VSCODE_SRC_PATH/resources/server/bin/helpers/" "$VSCODE_OUT_PATH/bin/helpers"
90-
chmod +x "$VSCODE_OUT_PATH/bin/helpers/browser.sh"
91-
92-
# Add the commit and date and enable telemetry. This just makes telemetry
93-
# available; telemetry can still be disabled by flag or setting.
71+
# Add the commit, date, our name, links, and enable telemetry. This just makes
72+
# telemetry available; telemetry can still be disabled by flag or setting.
9473
jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <(
9574
cat << EOF
9675
{
9776
"enableTelemetry": true,
9877
"commit": "$(cd "$VSCODE_SRC_PATH" && git rev-parse HEAD)",
9978
"quality": "stable",
10079
"date": $(jq -n 'now | todate'),
101-
"codeServerVersion": "$VERSION"
80+
"codeServerVersion": "$VERSION",
81+
"nameShort": "code-server",
82+
"nameLong": "code-server",
83+
"applicationName": "code-server",
84+
"dataFolderName": ".code-server",
85+
"win32MutexName": "codeserver",
86+
"licenseUrl": "https://github.com/coder/code-server/blob/main/LICENSE.txt",
87+
"win32DirName": "code-server",
88+
"win32NameVersion": "code-server",
89+
"win32AppUserModelId": "coder.code-server",
90+
"win32ShellNameShort": "c&ode-server",
91+
"darwinBundleIdentifier": "com.coder.code.server",
92+
"linuxIconName": "com.coder.code.server",
93+
"reportIssueUrl": "https://github.com/coder/code-server/issues/new",
94+
"documentationUrl": "https://go.microsoft.com/fwlink/?LinkID=533484#vscode",
95+
"keyboardShortcutsUrlMac": "https://go.microsoft.com/fwlink/?linkid=832143",
96+
"keyboardShortcutsUrlLinux": "https://go.microsoft.com/fwlink/?linkid=832144",
97+
"keyboardShortcutsUrlWin": "https://go.microsoft.com/fwlink/?linkid=832145",
98+
"introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146",
99+
"tipsAndTricksUrl": "https://go.microsoft.com/fwlink/?linkid=852118",
100+
"newsletterSignupUrl": "https://www.research.net/r/vsc-newsletter",
101+
"linkProtectionTrustedDomains": [
102+
"https://open-vsx.org"
103+
]
102104
}
103105
EOF
104106
) > "$VSCODE_OUT_PATH/product.json"
105107

106-
# We remove the scripts field so that later on we can run
107-
# yarn to fetch node_modules if necessary without build scripts running.
108-
# We cannot use --no-scripts because we still want dependent package scripts to run.
109-
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
108+
# Use the package.json for the web/remote server. It does not have the right
109+
# version though so pull that from the main package.json. Also remove keytar
110+
# since the web does not rely on it and that removes the dependency on
111+
# libsecret.
112+
jq --slurp '.[0] * {version: .[1].version} | del(.dependencies.keytar)' \
113+
"$VSCODE_SRC_PATH/remote/package.json" \
114+
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
115+
116+
rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock"
117+
118+
if [ "$KEEP_MODULES" = 0 ]; then
119+
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
120+
rm -Rf "$VSCODE_OUT_PATH/node_modules"
121+
fi
110122

111123
pushd "$VSCODE_OUT_PATH"
112124
symlink_asar

‎ci/build/build-standalone-release.sh‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ main() {
2929

3030
cd "$RELEASE_PATH"
3131
yarn --production --frozen-lockfile
32-
33-
# HACK: the version of Typescript vscode 1.57 uses in extensions/
34-
# leaves a few stray symlinks. Clean them up so nfpm does not fail.
35-
# Remove this line when its no longer needed.
36-
rm -fr "$RELEASE_PATH/lib/vscode/extensions/node_modules/.bin"
3732
}
3833

3934
main "$@"

‎ci/dev/test-unit.sh‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ main() {
1414
# Our code imports from `out` in order to work during development but if you
1515
# have only built for production you will have not have this directory. In
1616
# that case symlink `out` to a production build directory.
17-
local vscode="lib/vscode"
18-
local link="$vscode/out"
19-
local target="out-build"
20-
if [[ ! -e $link ]] && [[ -d $vscode/$target ]]; then
21-
ln -s "$target" "$link"
17+
if [[ ! -e lib/vscode/out ]]; then
18+
pushd lib
19+
local out=(vscode-reh-web-*)
20+
if [[ -d "${out[0]}" ]]; then
21+
ln -s "../${out[0]}/out" ./vscode/out
22+
else
23+
echo "Could not find lib/vscode/out or lib/vscode-reh-web-*"
24+
echo "Code must be built before running unit tests"
25+
exit 1
26+
fi
27+
popd
2228
fi
2329

2430
# We must keep jest in a sub-directory. See ../../test/package.json for more

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /