Skip to content

Latest commit

 

History

History
151 lines (109 loc) · 4.15 KB

File metadata and controls

151 lines (109 loc) · 4.15 KB

Learn VS Codium Build Scripts

How to build

First, set or check VS Code version in upstream/stable.json.

# clone vscode and build, don't package
bash ./dev/build.sh

# only clone vscode
bash ./dev/build.sh -o
# Generate `vscode/` `dev/build.env`

# only pactch and build
bash ./dev/build.sh -s
# Generate `VSCode-win32-x64` `vscode-reh-win32-x64` `vscode-reh-web-win32-x64`

# only packaging, skip msi packaging
SHOULD_BUILD_MSI=no SHOULD_BUILD_MSI_NOUP=no bash ./dev/build.sh -s -o -p
# Generate `assets`
# system setup exe
# user setup exe
# vscode zip
# vscode-cli.tar.gz
# reh.tar.gz
# reh-web.tar.gz
  • -o skip build
  • -p generate packages
  • -s skip git clone

Abbreviations

  • REH: Remote Extension Host

Environment Variables

  • MS_COMMIT & MS_TAG
    • Only for checking out source code
    • RELEASE_VERSION & BUILD_SOURCEVERSION are used in codium for versioning.
  • RLEASE_VERSION & BUILD_SOURCEVERSION
    • Generated by get_repo.sh, and saved to dev/build.env
    • dev/build.sh will source dev/build.env
    • Used in publish pipeline as version number for VSCodium

Anatomy

Entry: dev/build.sh

  • Parse options to skip steps
  • Set environment variables
  • Main phases:
    • Git clone, checkout, save commit info: get_repo.sh
    • Generate BUILD_SOURCEVERSION for vscodium version update: version.sh
    • Git rest, apply patches, configure native addons and build: build.sh
    • Packaging: prepare_assets.sh

Git clone: get_repo.sh

  • If no RELEASE_VERSION, read it from upstream/stable.json
  • Clone VSCode to vscode/ and checkout FETCH_HEAD

Versioning: version.sh

  • Sha1sum RELEASE_VERSION to get BUILD_SOURCEVERSION.

Build: build.sh

  • Check and set BUILD_SOURCEVERSION: version.sh
  • Apply patches and install dependencies: prepare_vscode.sh
  • Run npm build tasks: npm run <check>; npm run gulp <gulp_task>
  • Build cli, aka vscode-tunnel: build_cli.sh
  • Build Remote Extension Host: npm run gulp <gulp_task>

prepare_vscode.sh

  • Copy icons from src/stable to vscode/.
  • Copy LICENSE
  • Update vscode/product.json
    • Define function setpath() for replacing a given field in JSON to string
    • setpath_json() for replacing a given field in JSON to a JSON object
  • Apply patches from patches/*.patch patches/{os_type}/*.patch patches/user/*.patch
    • We should put changes to VS Code inside patches/user/*.patch as patch to keep compatible with VS Code source code.
  • npm ci
  • Disable telemetry
  • Substitute VS Code and Microsoft with VS Codium
    • Update vscode/package.json
    • Update vscode/resources/server/manifest.json
    • Replace BUILTIN_ANNOUNCEMENTS in gettingStarted.ts
    • Update vscode/build/lib/electron.js
    • Update vscode/build/win32/code.iss

Main Build Tasks

npm run monaco-compile-check
npm run valid-layers-check

npm run gulp compile-build-without-mangling
npm run gulp compile-extension-media
npm run gulp compile-extensions-build
npm run gulp minify-vscode

Group Policy

  • node build/lib/policies {mac,win32}
    • Generate Group Policy for enterprise deployment

Min CI Task

  • npm run gulp vscode-{os_type}-{arch}-min-ci
    • Packaging
  • Show all gulptasks
    • npm run gulp -- --tasks-json >> gulp_task.json

build_cli.sh

Remote Extension Host

Packaging: prepare_assets.sh

  • On Mac, notarize and sign, then build zip and dmg.
  • On Windows, build inno-updater, then build zip, exe and msi.
  • Package Remote Extension Host.
  • Package vscode-cli, aka vscode-tunnel.

GitHub Workflow

stable-windows

Jobs: check

  • Prepare vscodium and vscode source code.
  • Get tag and commit, generate release version.
  • Check whether to build and deploy, according to release version and assets in current release.

Jobs: compile

  • Build on Linux, and upload artifact.

Jobs: build

  • Download artifact generated in compile job.
  • Package by ./build/windows/package.sh, generate unpacked core, cli, reh, reh-web.
  • Generate assets: inno-updater, portable zip, user setup exe, system setup exe, msi, and msi(auto-update disabled).
  • Generate checksums for assets.
  • Create a new release or update current release, upload assets.