Browse Source

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
Samuel Attard 2 years ago
parent
commit
2751c2b07f

+ 2 - 3
.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
 

+ 28 - 6
.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"
+			]
+		}
+	}
 }

+ 1 - 1
.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

+ 1 - 0
.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
 

+ 10 - 0
.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