Skip to content

Commit 98053a0

Browse files
committed
Move Code to a submodule
Closes #4901.
1 parent 184ef68 commit 98053a0

26 files changed

+138
-1690
lines changed

.github/workflows/ci.yaml

+42-16
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
steps:
3030
- name: Checkout repo
3131
uses: actions/checkout@v3
32+
with:
33+
fetch-depth: 0
34+
submodules: true
3235

3336
- name: Install Node.js v14
3437
uses: actions/setup-node@v3
@@ -71,6 +74,9 @@ jobs:
7174
steps:
7275
- name: Checkout repo
7376
uses: actions/checkout@v3
77+
with:
78+
fetch-depth: 0
79+
submodules: true
7480

7581
- name: Install Node.js v14
7682
uses: actions/setup-node@v3
@@ -102,9 +108,11 @@ jobs:
102108
env:
103109
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
104110
steps:
111+
- name: Checkout repo
105112
- uses: actions/checkout@v3
106113
with:
107114
fetch-depth: 0
115+
submodules: true
108116

109117
- name: Install Node.js v14
110118
uses: actions/setup-node@v3
@@ -119,7 +127,7 @@ jobs:
119127
# path: |
120128
# "**/node_modules"
121129
# "**/vendor/modules"
122-
# "**/vendor/modules/code-oss-dev/node_modules"
130+
# "**/lib/vscode/node_modules"
123131
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/vendor/yarn.lock') }}
124132
# restore-keys: |
125133
# yarn-build-
@@ -131,27 +139,26 @@ jobs:
131139
- name: Build code-server
132140
run: yarn build
133141

134-
# Parse the hash of the latest commit inside vendor/modules/code-oss-dev
142+
# Parse the hash of the latest commit inside lib/vscode
135143
# use this to avoid rebuilding it if nothing changed
136144
# How it works: the `git log` command fetches the hash of the last commit
137-
# that changed a file inside `vendor/modules/code-oss-dev`. If a commit changes any file in there,
145+
# that changed a file inside `lib/vscode`. If a commit changes any file in there,
138146
# the hash returned will change, and we rebuild vscode. If the hash did not change,
139147
# (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
140148
# This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
141-
- name: Get latest vendor/modules/code-oss-dev rev
149+
- name: Get latest lib/vscode rev
142150
id: vscode-rev
143-
run: echo "::set-output name=rev::$(jq -r '.devDependencies["code-oss-dev"]' vendor/package.json | sed -r 's|.*#(.*)$|\1|')"
151+
run: echo "::set-output name=rev::$(jq -r '.devDependencies["code-oss-dev"]' lib/vscode/package.json | sed -r 's|.*#(.*)$|\1|')"
144152

145153
- name: Attempt to fetch vscode build from cache
146154
id: cache-vscode-2
147155
uses: actions/cache@v2
148156
with:
149157
path: |
150-
vendor/modules/code-oss-dev/.build
151-
vendor/modules/code-oss-dev/package.json
152-
vendor/modules/code-oss-dev/out-build
153-
vendor/modules/code-oss-dev/out-vscode-reh-web
154-
vendor/modules/code-oss-dev/out-vscode-reh-web-min
158+
lib/vscode/.build
159+
lib/vscode/out-build
160+
lib/vscode/out-vscode-reh-web
161+
lib/vscode/out-vscode-reh-web-min
155162
key: vscode-reh-build-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}
156163

157164
- name: Build vscode
@@ -197,7 +204,11 @@ jobs:
197204
if: github.event.pull_request.head.repo.full_name == github.repository
198205
runs-on: ubuntu-latest
199206
steps:
207+
- name: Checkout repo
200208
- uses: actions/checkout@v3
209+
with:
210+
fetch-depth: 0
211+
submodules: true
201212

202213
- uses: actions/download-artifact@v3
203214
id: download
@@ -226,7 +237,11 @@ jobs:
226237
container: "centos:7"
227238

228239
steps:
240+
- name: Checkout repo
229241
- uses: actions/checkout@v3
242+
with:
243+
fetch-depth: 0
244+
submodules: true
230245

231246
- name: Install Node.js v14
232247
uses: actions/setup-node@v3
@@ -315,7 +330,11 @@ jobs:
315330
NODE_VERSION: v14.17.4
316331

317332
steps:
333+
- name: Checkout repo
318334
- uses: actions/checkout@v3
335+
with:
336+
fetch-depth: 0
337+
submodules: true
319338

320339
- name: Install Node.js v14
321340
uses: actions/setup-node@v3
@@ -364,7 +383,11 @@ jobs:
364383
runs-on: macos-latest
365384
timeout-minutes: 15
366385
steps:
386+
- name: Checkout repo
367387
- uses: actions/checkout@v3
388+
with:
389+
fetch-depth: 0
390+
submodules: true
368391

369392
- name: Install Node.js v14
370393
uses: actions/setup-node@v3
@@ -409,7 +432,11 @@ jobs:
409432
# since VS Code will load faster due to the bundling.
410433
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
411434
steps:
435+
- name: Checkout repo
412436
- uses: actions/checkout@v3
437+
with:
438+
fetch-depth: 0
439+
submodules: true
413440

414441
- name: Install Node.js v14
415442
uses: actions/setup-node@v3
@@ -446,12 +473,6 @@ jobs:
446473
./test/node_modules/.bin/playwright install-deps
447474
./test/node_modules/.bin/playwright install
448475
449-
# TODO@jsjoeio - remove once we switch to submodules.
450-
- name: Create package.json for testing
451-
run: |
452-
mkdir -p ./vendor/modules/code-oss-dev
453-
echo '{ "version": "test" }' > ./vendor/modules/code-oss-dev/package.json
454-
455476
- name: Run end-to-end tests
456477
run: yarn test:e2e
457478

@@ -470,6 +491,10 @@ jobs:
470491
steps:
471492
- name: Checkout code
472493
uses: actions/checkout@v3
494+
with:
495+
fetch-depth: 0
496+
submodules: true
497+
473498
- name: Run Trivy vulnerability scanner in repo mode
474499
uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18
475500
with:
@@ -480,6 +505,7 @@ jobs:
480505
template: "@/contrib/sarif.tpl"
481506
output: "trivy-repo-results.sarif"
482507
severity: "HIGH,CRITICAL"
508+
483509
- name: Upload Trivy scan results to GitHub Security tab
484510
uses: github/codeql-action/upload-sarif@v1
485511
with:

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "lib/vscode"]
2+
path = lib/vscode
3+
url = https://github.com/coder/vscode

.prettierrc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ useTabs: false
77

88
overrides:
99
# Attempt to keep VScode's existing code style intact.
10-
- files: "vendor/modules/code-oss-dev/**/*.ts"
10+
- files: "lib/vscode/**/*.ts"
1111
options:
1212
# No limit defined upstream.
1313
printWidth: 10000

.tours/contributing.tour

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"description": "Static images and the manifest live here in `src/browser/media` (see the explorer)."
144144
},
145145
{
146-
"directory": "vendor/modules/code-oss-dev",
146+
"directory": "lib/vscode",
147147
"line": 1,
148148
"description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible."
149149
}

ci/build/build-release.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ main() {
1515

1616
source ./ci/lib.sh
1717

18-
VSCODE_SRC_PATH="vendor/modules/code-oss-dev"
19-
VSCODE_OUT_PATH="$RELEASE_PATH/vendor/modules/code-oss-dev"
18+
VSCODE_SRC_PATH="lib/vscode"
19+
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
2020

2121
mkdir -p "$RELEASE_PATH"
2222

@@ -25,7 +25,7 @@ main() {
2525

2626
rsync ./docs/README.md "$RELEASE_PATH"
2727
rsync LICENSE.txt "$RELEASE_PATH"
28-
rsync ./vendor/modules/code-oss-dev/ThirdPartyNotices.txt "$RELEASE_PATH"
28+
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
2929
}
3030

3131
bundle_code_server() {

ci/build/build-standalone-release.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ main() {
3434
# leaves a few stray symlinks. Clean them up so nfpm does not fail.
3535
# Remove this line when its no longer needed.
3636

37-
rm -fr "$RELEASE_PATH/vendor/modules/code-oss-dev/extensions/node_modules/.bin"
37+
rm -fr "$RELEASE_PATH/lib/vscode/extensions/node_modules/.bin"
3838
}
3939

4040
main "$@"

ci/build/build-vscode.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# Builds vscode into vendor/modules/code-oss-dev/out-vscode.
4+
# Builds vscode into lib/vscode/out-vscode.
55

66
# MINIFY controls whether a minified version of vscode is built.
77
MINIFY=${MINIFY-true}
88

99
main() {
1010
cd "$(dirname "${0}")/../.."
1111

12-
cd vendor/modules/code-oss-dev
12+
cd lib/vscode
1313

1414
# Any platform works since we have our own packaging step (for now).
1515
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"

ci/build/npm-postinstall.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ symlink_asar() {
9090
}
9191

9292
vscode_yarn() {
93-
echo 'Installing vendor dependencies...'
94-
cd vendor/modules/code-oss-dev
93+
echo 'Installing Code dependencies...'
94+
cd lib/vscode
9595
yarn --production --frozen-lockfile
9696

9797
symlink_asar

ci/dev/fmt.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ main() {
1919
"*.sh"
2020
)
2121
prettier --write --loglevel=warn $(
22-
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v "vendor/modules/code-oss-dev" | grep -v 'helm-chart'
22+
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
2323
)
2424

2525
doctoc --title '# FAQ' docs/FAQ.md > /dev/null

ci/dev/lint.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66

7-
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
8-
stylelint $(git ls-files "*.css" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
7+
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode")
8+
stylelint $(git ls-files "*.css" | grep -v "lib/vscode")
99
tsc --noEmit --skipLibCheck
10-
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
10+
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
1111
if command -v helm && helm kubeval --help > /dev/null; then
1212
helm kubeval ci/helm-chart
1313
fi

ci/dev/postinstall.sh

+12-37
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,25 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
main() {
5-
cd "$(dirname "$0")/../.."
6-
source ./ci/lib.sh
7-
8-
pushd test
9-
echo "Installing dependencies for $PWD"
10-
yarn install
11-
popd
12-
4+
# Install dependencies in $1.
5+
install-deps() {
136
local args=(install)
147
if [[ ${CI-} ]]; then
158
args+=(--frozen-lockfile)
169
fi
17-
18-
pushd test
19-
echo "Installing dependencies for $PWD"
20-
yarn "${args[@]}"
21-
popd
22-
23-
pushd test/e2e/extensions/test-extension
24-
echo "Installing dependencies for $PWD"
25-
yarn "${args[@]}"
10+
pushd "$1"
11+
echo "Installing dependencies for $PWD"
12+
yarn "${args[@]}"
2613
popd
14+
}
2715

28-
pushd vendor
29-
echo "Installing dependencies for $PWD"
30-
31-
# We install in 'modules' instead of 'node_modules' because VS Code's
32-
# extensions use a webpack config which cannot differentiate between its own
33-
# node_modules and itself being in a directory with the same name.
34-
args+=(--modules-folder modules)
35-
36-
# We ignore scripts because NPM/Yarn's default behavior is to assume that
37-
# devDependencies are not needed, and that even git repo based packages are
38-
# assumed to be compiled. Because the default behavior for VS Code's
39-
# `postinstall` assumes we're also compiled, this needs to be ignored.
40-
args+=(--ignore-scripts)
41-
42-
yarn "${args[@]}"
43-
44-
# Finally, run the vendor `postinstall`
45-
yarn run postinstall
16+
main() {
17+
cd "$(dirname "$0")/../.."
18+
source ./ci/lib.sh
4619

47-
popd
20+
install-deps test
21+
install-deps test/e2e/extensions/test-extension
22+
install-deps lib/vscode
4823
}
4924

5025
main "$@"

ci/dev/test-e2e.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ main() {
3737
exit 1
3838
fi
3939

40-
if [[ ! -d $dir/vendor/modules/code-oss-dev/out ]]; then
40+
if [[ ! -d $dir/lib/vscode/out ]]; then
4141
echo >&2 "No VS Code build detected"
4242
help
4343
exit 1

ci/dev/test-unit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ 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="vendor/modules/code-oss-dev"
17+
local vscode="lib/vscode"
1818
local link="$vscode/out"
1919
local target="out-build"
2020
if [[ ! -e $link ]] && [[ -d $vscode/$target ]]; then

ci/dev/watch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Watcher {
1414
private rootPath = path.resolve(process.cwd())
1515
private readonly paths = {
1616
/** Path to uncompiled VS Code source. */
17-
vscodeDir: path.join(this.rootPath, "vendor", "modules", "code-oss-dev"),
17+
vscodeDir: path.join(this.rootPath, "lib/vscode"),
1818
pluginDir: process.env.PLUGIN_DIR,
1919
}
2020

ci/lib.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pkg_json_version() {
1414
}
1515

1616
vscode_version() {
17-
jq -r .version vendor/modules/code-oss-dev/package.json
17+
jq -r .version lib/vscode/package.json
1818
}
1919

2020
os() {

0 commit comments

Comments
 (0)