From 9f39607a930934c577fc6343256b7f986302bd4a Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 20 Feb 2024 16:29:47 +1100 Subject: [PATCH 1/5] Add support for devcontainers. --- .devcontainer/devcontainer.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..f508bf364e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "QMK CLI", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "ghcr.io/qmk/qmk_cli", + "customizations": { + "vscode": { + "extensions": [ + "amodio.toggle-excluded-files" + ] + } + }, + "postCreateCommand": "git config --global --add safe.directory /workspaces/qmk_userspace && git submodule update --init --recursive && { [ -d /workspaces/qmk_userspace/qmk_firmware ] || git clone https://github.com/qmk/qmk_firmware.git /workspaces/qmk_userspace/qmk_firmware; } && git config --global --add safe.directory /workspaces/qmk_userspace/qmk_firmware && qmk config user.qmk_home=/workspaces/qmk_userspace/qmk_firmware && qmk config user.overlay_dir=/workspaces/qmk_userspace && qmk git-submodule" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} From 26bc16c8e8bde202c2acd0014651a81734e06add Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Wed, 21 Feb 2024 20:24:59 +1100 Subject: [PATCH 2/5] Move to script. --- .devcontainer/devcontainer.json | 2 +- .devcontainer/setup.sh | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 .devcontainer/setup.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f508bf364e..371f5b9846 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,7 +11,7 @@ ] } }, - "postCreateCommand": "git config --global --add safe.directory /workspaces/qmk_userspace && git submodule update --init --recursive && { [ -d /workspaces/qmk_userspace/qmk_firmware ] || git clone https://github.com/qmk/qmk_firmware.git /workspaces/qmk_userspace/qmk_firmware; } && git config --global --add safe.directory /workspaces/qmk_userspace/qmk_firmware && qmk config user.qmk_home=/workspaces/qmk_userspace/qmk_firmware && qmk config user.overlay_dir=/workspaces/qmk_userspace && qmk git-submodule" + "postCreateCommand": "/workspaces/qmk_userspace/.devcontainer/setup.sh" // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000000..ba789d8204 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -eEuo pipefail + +wget https://bootstrap.pypa.io/get-pip.py +python3 get-pip.py +python3 -m pip install qmk +rm get-pip.py + +git config --global --add safe.directory /workspaces/qmk_userspace +git submodule update --init --recursive + +[ -d /workspaces/qmk_firmware ] || git clone https://github.com/qmk/qmk_firmware.git /workspaces/qmk_firmware +git config --global --add safe.directory /workspaces/qmk_firmware + +qmk config user.qmk_home=/workspaces/qmk_firmware +qmk config user.overlay_dir=/workspaces/qmk_userspace + +qmk git-submodule + +cat << __EOF__ > /workspaces/qmk_userspace/devcontainer.code-workspace +{ + "folders": [ + { + "name": "qmk_userspace", + "path": "/workspaces/qmk_userspace" + }, + { + "name": "qmk_firmware", + "path": "/workspaces/qmk_firmware" + }, + ], +} +__EOF__ From 5bb20884dfd9ac11e0b6a736c1ac5553477b4403 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Wed, 21 Feb 2024 20:33:59 +1100 Subject: [PATCH 3/5] Upgrade milc. --- .devcontainer/setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index ba789d8204..0e0460873a 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -7,6 +7,8 @@ python3 get-pip.py python3 -m pip install qmk rm get-pip.py +python3 -m pip install --upgrade milc + git config --global --add safe.directory /workspaces/qmk_userspace git submodule update --init --recursive From 6da981f526d517bfb1f5c7b0af2403eddb4cc5b7 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Thu, 22 Feb 2024 20:40:03 +1100 Subject: [PATCH 4/5] Remove auto-generated workspace file, sync suggested extensions with qmk/qmk_firmware. --- .devcontainer/devcontainer.json | 43 ++++++++++++++++++--------------- .devcontainer/setup.sh | 15 ------------ .vscode/extensions.json | 11 +++++++++ 3 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 .vscode/extensions.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 371f5b9846..5c9fbf133f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,27 +1,32 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/debian { - "name": "QMK CLI", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "ghcr.io/qmk/qmk_cli", - "customizations": { - "vscode": { - "extensions": [ - "amodio.toggle-excluded-files" - ] - } - }, - "postCreateCommand": "/workspaces/qmk_userspace/.devcontainer/setup.sh" + "name": "QMK CLI", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "ghcr.io/qmk/qmk_cli", + "customizations": { + "vscode": { + "extensions": [ + "amodio.toggle-excluded-files", + "EditorConfig.EditorConfig", + "xaver.clang-format", + "llvm-vs-code-extensions.vscode-clangd", + "bierner.github-markdown-preview", + "donjayamanne.git-extension-pack" + ] + } + }, + "postCreateCommand": "/workspaces/qmk_userspace/.devcontainer/setup.sh" - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], - // Configure tool-specific properties. - // "customizations": {}, + // Configure tool-specific properties. + // "customizations": {}, - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" } diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 0e0460873a..25c7c5ee9d 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -19,18 +19,3 @@ qmk config user.qmk_home=/workspaces/qmk_firmware qmk config user.overlay_dir=/workspaces/qmk_userspace qmk git-submodule - -cat << __EOF__ > /workspaces/qmk_userspace/devcontainer.code-workspace -{ - "folders": [ - { - "name": "qmk_userspace", - "path": "/workspaces/qmk_userspace" - }, - { - "name": "qmk_firmware", - "path": "/workspaces/qmk_firmware" - }, - ], -} -__EOF__ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..a1d61d3299 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +// Suggested extensions +{ + "recommendations": [ + "amodio.toggle-excluded-files", + "EditorConfig.EditorConfig", + "xaver.clang-format", + "llvm-vs-code-extensions.vscode-clangd", + "bierner.github-markdown-preview", + "donjayamanne.git-extension-pack" + ] +} From 1521bb4ffb98b6e83710b2b64dfcdaacb44b8652 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Fri, 23 Feb 2024 21:26:12 +1100 Subject: [PATCH 5/5] As requested. --- .devcontainer/devcontainer.json | 3 ++- .vscode/extensions.json | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5c9fbf133f..2b7b817a40 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,7 +12,8 @@ "xaver.clang-format", "llvm-vs-code-extensions.vscode-clangd", "bierner.github-markdown-preview", - "donjayamanne.git-extension-pack" + "donjayamanne.git-extension-pack", + "ms-vscode-remote.remote-containers" ] } }, diff --git a/.vscode/extensions.json b/.vscode/extensions.json index a1d61d3299..3984e9bedd 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,11 +1,12 @@ // Suggested extensions { - "recommendations": [ - "amodio.toggle-excluded-files", - "EditorConfig.EditorConfig", - "xaver.clang-format", - "llvm-vs-code-extensions.vscode-clangd", - "bierner.github-markdown-preview", - "donjayamanne.git-extension-pack" - ] + "recommendations": [ + "amodio.toggle-excluded-files", + "EditorConfig.EditorConfig", + "xaver.clang-format", + "llvm-vs-code-extensions.vscode-clangd", + "bierner.github-markdown-preview", + "donjayamanne.git-extension-pack", + "ms-vscode-remote.remote-containers" + ] }