From 2751c2b07f52b65822dc1c1f25687f4f4770d01f Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 22 Nov 2022 12:16:15 -0800 Subject: [PATCH] build: update devcontainer and use latest codespaces features (#36422) * build: update devcontainer to latest build image * build: add update-content-command * build: set good vscode config * build: be less noisy in update command * build: only run sync in prebuild environment * build: list env vars * build: run sync always --- .devcontainer/README.md | 5 ++-- .devcontainer/devcontainer.json | 34 ++++++++++++++++++++----- .devcontainer/docker-compose.yml | 2 +- .devcontainer/on-create-command.sh | 1 + .devcontainer/update-content-command.sh | 10 ++++++++ 5 files changed, 42 insertions(+), 10 deletions(-) create mode 100755 .devcontainer/update-content-command.sh diff --git a/.devcontainer/README.md b/.devcontainer/README.md index c12625a148..255596b6b1 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -4,14 +4,13 @@ Welcome to the Codespaces Electron Developer Environment. ## Quick Start -Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following commands. +Upon creation of your codespace you should have [build tools](https://github.com/electron/build-tools) installed and an initialized gclient checkout of Electron. In order to build electron you'll need to run the following command. ```bash -e sync -vv e build ``` -The initial sync will take approximately ~30 minutes and the build will take ~8 minutes. Incremental syncs and incremental builds are substantially quicker. +The initial build will take ~8 minutes. Incremental builds are substantially quicker. If you pull changes from upstream that touch either the `patches` folder or the `DEPS` folder you will have to run `e sync` in order to keep your checkout up to date. ## Directory Structure diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5c80002828..605c3eaf9a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,6 +2,7 @@ "dockerComposeFile": "docker-compose.yml", "service": "buildtools", "onCreateCommand": ".devcontainer/on-create-command.sh", + "updateContentCommand": ".devcontainer/update-content-command.sh", "workspaceFolder": "/workspaces/gclient/src/electron", "extensions": [ "joeleinbinder.mojom-language", @@ -11,14 +12,28 @@ "mutantdino.resourcemonitor", "dbaeumer.vscode-eslint", "shakram02.bash-beautify", - "marshallofsound.gnls-electron" + "marshallofsound.gnls-electron", + "CircleCI.circleci" ], "settings": { + "editor.tabSize": 2, + "bashBeautify.tabSize": 2, + "typescript.tsdk": "node_modules/typescript/lib", "[gn]": { "editor.formatOnSave": true }, - "editor.tabSize": 2, - "bashBeautify.tabSize": 2 + "[javascript]": { + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + } + }, + "[typescript]": { + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + } + }, + "javascript.preferences.quoteStyle": "single", + "typescript.preferences.quoteStyle": "single" }, "forwardPorts": [8088, 6080, 5901], "portsAttributes": { @@ -36,8 +51,15 @@ } }, "hostRequirements": { - "storage": "32gb", - "cpus": 8 + "storage": "128gb", + "cpus": 16 }, - "remoteUser": "builduser" + "remoteUser": "builduser", + "customizations": { + "codespaces": { + "openFiles": [ + ".devcontainer/README.md" + ] + } + } } \ No newline at end of file diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 7945777455..f229808891 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: buildtools: - image: ghcr.io/electron/devcontainer:27db4a3e3512bfd2e47f58cea69922da0835f1d9 + image: ghcr.io/electron/devcontainer:3d8d44d0f15b05bef6149e448f9cc522111847e9 volumes: - ..:/workspaces/gclient/src/electron:cached diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh index 8899906dff..840d894c86 100755 --- a/.devcontainer/on-create-command.sh +++ b/.devcontainer/on-create-command.sh @@ -10,6 +10,7 @@ export PATH="$PATH:$buildtools/src" # Create the persisted buildtools config folder mkdir -p $buildtools_configs +mkdir -p $gclient_root/.git-cache rm -f $buildtools/configs ln -s $buildtools_configs $buildtools/configs diff --git a/.devcontainer/update-content-command.sh b/.devcontainer/update-content-command.sh new file mode 100755 index 0000000000..012eef9714 --- /dev/null +++ b/.devcontainer/update-content-command.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -eo pipefail + +buildtools=$HOME/.electron_build_tools + +export PATH="$PATH:$buildtools/src" + +# Sync latest +e d gclient sync --with_branch_heads --with_tags