From d09fa4da9adf1dbb2cc2ece196a00ea410a72cff Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Fri, 26 Sep 2025 12:33:33 +0000 Subject: [PATCH 1/5] Add Rust feature to container This installs rustc, rustfmt and more Rust tools. Then the image should have all tools preinstalled to build and debug Rust code. --- .../.devcontainer/devcontainer.json | 11 +++++++++++ .../.devcontainer/s-core-local/install.sh | 10 ---------- .../.devcontainer/s-core-local/tests/test_default.sh | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/s-core-devcontainer/.devcontainer/devcontainer.json b/src/s-core-devcontainer/.devcontainer/devcontainer.json index b9ab2ca..67aa4f1 100644 --- a/src/s-core-devcontainer/.devcontainer/devcontainer.json +++ b/src/s-core-devcontainer/.devcontainer/devcontainer.json @@ -29,6 +29,17 @@ "ghcr.io/devcontainers/features/python": { "version": "3.12.11" }, + "ghcr.io/devcontainers/features/rust:1.5.0": { + "version": "1.83.0", + "components": [ + "cargo", + "clippy", + // "miri", // only available at nightly + "rust-analyzer", + "rust-src", + "rustfmt" + ] + }, "./s-core-local": {} }, "remoteUser": "vscode", diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh index c6f7714..7861486 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh @@ -62,16 +62,6 @@ echo "${bazel_compile_commands_amd64_sha256} /tmp/bazel-compile-commands.deb" | apt-get install -y --no-install-recommends --fix-broken /tmp/bazel-compile-commands.deb rm /tmp/bazel-compile-commands.deb -# Code completion for Rust code of Bazel projects (language server part) -# (see https://bazelbuild.github.io/rules_rust/rust_analyzer.html and https://rust-analyzer.github.io/book/rust_analyzer_binary.html) -# The version is pinned to a specific release, and the SHA256 checksum is provided by the devcontainer-features.json file. -# NOTE: For an unknown reason, rust-analyzer uses dates for downloading of releases, while the executable reports an actual release. -curl -L https://github.com/rust-lang/rust-analyzer/releases/download/${rust_analyzer_date}/rust-analyzer-x86_64-unknown-linux-gnu.gz > /tmp/rust-analyzer.gz -echo "${rust_analyzer_amd64_sha256} /tmp/rust-analyzer.gz" | sha256sum -c - || exit -1 -gunzip -d /tmp/rust-analyzer.gz -mv /tmp/rust-analyzer /usr/local/bin/rust-analyzer -chmod +x /usr/local/bin/rust-analyzer - # qemu-system-arm apt-get install -y --no-install-recommends --fix-broken qemu-system-arm="${qemu_system_arm_version}*" diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh index 8603845..fa3b0f7 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh @@ -20,7 +20,8 @@ check "validate starpls is working and has the correct version" bash -c "starpls check "validate bazel-compile-commands is working and has the correct version" bash -c "bazel-compile-commands --version 2>&1 | grep '${bazel_compile_commands_version}'" # Rust tooling -check "validate rust-analyzer is working and has the correct version" bash -c "rust-analyzer --version 2>&1 | grep '${rust_analyzer_version}'" +# check "validate rust-analyzer is working and has the correct version" bash -c "rust-analyzer --version 2>&1 | grep '${rust_analyzer_version}'" +check "validate rust-analyzer is working and has the correct version" bash -c "rust-analyzer --version 2>&1" # Qemu target-related tools check "validate qemu-system-aarch64 is working and has the correct version" bash -c "qemu-system-aarch64 --version | grep '${qemu_system_arm_version}'" From 92ac600dc7fc6715e0d3d61ccb15acb854001fda Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 7 Oct 2025 09:25:32 +0000 Subject: [PATCH 2/5] proper use of lock file --- src/s-core-devcontainer/.devcontainer/devcontainer-lock.json | 5 +++++ src/s-core-devcontainer/.devcontainer/devcontainer.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json b/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json index 4f40819..e82fdb5 100644 --- a/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json +++ b/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json @@ -24,6 +24,11 @@ "version": "1.7.1", "resolved": "ghcr.io/devcontainers/features/python@sha256:cf9b6d879790a594b459845b207c5e1762a0c8f954bb8033ff396e497f9c301b", "integrity": "sha256:cf9b6d879790a594b459845b207c5e1762a0c8f954bb8033ff396e497f9c301b" + }, + "ghcr.io/devcontainers/features/rust": { + "version": "1.5.0", + "resolved": "ghcr.io/devcontainers/features/rust@sha256:0c55e65f2e3df736e478f26ee4d5ed41bae6b54dac1318c443e31444c8ed283c", + "integrity": "sha256:0c55e65f2e3df736e478f26ee4d5ed41bae6b54dac1318c443e31444c8ed283c" } } } \ No newline at end of file diff --git a/src/s-core-devcontainer/.devcontainer/devcontainer.json b/src/s-core-devcontainer/.devcontainer/devcontainer.json index 67aa4f1..d792496 100644 --- a/src/s-core-devcontainer/.devcontainer/devcontainer.json +++ b/src/s-core-devcontainer/.devcontainer/devcontainer.json @@ -29,7 +29,7 @@ "ghcr.io/devcontainers/features/python": { "version": "3.12.11" }, - "ghcr.io/devcontainers/features/rust:1.5.0": { + "ghcr.io/devcontainers/features/rust": { "version": "1.83.0", "components": [ "cargo", From d96c35f25b1f53610740dc6be952cfd7c85973f1 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 7 Oct 2025 09:25:49 +0000 Subject: [PATCH 3/5] check that expected tool versions are in the container --- src/s-core-devcontainer/test-project/test.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/s-core-devcontainer/test-project/test.sh b/src/s-core-devcontainer/test-project/test.sh index 1b1d94e..e1ff153 100755 --- a/src/s-core-devcontainer/test-project/test.sh +++ b/src/s-core-devcontainer/test-project/test.sh @@ -16,6 +16,13 @@ check "validate clang-format is working and has the correct version" bash -c "cl check "validate clang-tidy is working and has the correct version" bash -c "clang-tidy --version | grep '20.1.8'" check "validate clang is working and has the correct version" bash -c "clang --version | grep '20.1.8'" +# Rust tooling +check "validate rustc is working and has the correct version" bash -c "rustc --version | grep '1.83.0'" +check "validate cargo is working and has the correct version" bash -c "cargo --version | grep '1.83.0'" +check "validate cargo clippy is working and has the correct version" bash -c "cargo clippy --version | grep '0.1.83'" +check "validate rustfmt is working and has the correct version" bash -c "rustfmt --version | grep '1.8.0-stable'" +check "validate rust-analyzer is working and has the correct version" bash -c "rust-analyzer --version | grep '1.83.0'" + # Tests from the local s-core-local feature source /devcontainer/features/s-core-local/tests/test_default.sh From 14dbf40c2053307c50cd834987ae54fcc0f21e8a Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 7 Oct 2025 09:26:58 +0000 Subject: [PATCH 4/5] remove rust-analyzer version check from s-core-local feature --- .../.devcontainer/s-core-local/tests/test_default.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh index fa3b0f7..585dd83 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh @@ -19,10 +19,6 @@ check "validate buildifier is working and has the correct version" bash -c "buil check "validate starpls is working and has the correct version" bash -c "starpls version | grep '${starpls_version}'" check "validate bazel-compile-commands is working and has the correct version" bash -c "bazel-compile-commands --version 2>&1 | grep '${bazel_compile_commands_version}'" -# Rust tooling -# check "validate rust-analyzer is working and has the correct version" bash -c "rust-analyzer --version 2>&1 | grep '${rust_analyzer_version}'" -check "validate rust-analyzer is working and has the correct version" bash -c "rust-analyzer --version 2>&1" - # Qemu target-related tools check "validate qemu-system-aarch64 is working and has the correct version" bash -c "qemu-system-aarch64 --version | grep '${qemu_system_arm_version}'" check "validate sshpass is working and has the correct version" bash -c "sshpass -V | grep '${sshpass_version}'" From beede44e556409e7a65ee3e06b41603ebb2b72a7 Mon Sep 17 00:00:00 2001 From: Lutz Reinhardt Date: Tue, 7 Oct 2025 09:36:05 +0000 Subject: [PATCH 5/5] remove rust-analyzer from versions.yaml --- .../.devcontainer/s-core-local/versions.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml b/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml index 874dc32..d76d4e8 100644 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml @@ -35,12 +35,3 @@ bazel_compile_commands: # The following sha256sums are for the deb package bazel-compile-commands_-noble_amd64.deb # It is generated by running 'sha256sum bazel-compile-commands_-noble_amd64.deb' sha256: 97239b316df58fd3370a8aa6350790ececd5e4a1de30efb42d45cb1c300a179a - -rust_analyzer: - date: 2025-08-25 - version: 0.3.2593-standalone - amd64: - # The following sha256sum is for the binary rust-analyzer-x86_64-unknown-linux-gnu.gz - # from the GitHub release page of rust-analyzer - # It is generated by running 'sha256sum rust-analyzer-x86_64-unknown-linux-gnu.gz' - sha256: 487fb1cb99e567fd6b818cc88a7c1452d5260da57dbc171fc1359a4b604348ae