From a02c230e4d9f16f93c295ae857e6618349338f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Sat, 17 May 2025 22:17:36 +0200 Subject: [PATCH] Pin rust toolchain (#14817) * Pin rust toolchain * Always install targets in build script * Delete installed toolchains --- .github/renovate.json5 | 6 +++++ .github/workflows/build-desktop.yml | 26 ++----------------- apps/desktop/desktop_native/Cargo.lock | 16 ++++++------ apps/desktop/desktop_native/build.js | 6 +++++ .../desktop_native/rust-toolchain.toml | 4 +++ 5 files changed, 26 insertions(+), 32 deletions(-) create mode 100644 apps/desktop/desktop_native/rust-toolchain.toml diff --git a/.github/renovate.json5 b/.github/renovate.json5 index d0066ddd7ba..12ae415c6a1 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -51,6 +51,12 @@ commitMessagePrefix: "[deps] BRE:", addLabels: ["hold"], }, + { + // Enable support for Rust toolchain updates. + matchManagers: ["custom.regex"], + matchDepNames: ["rust"], + commitMessageTopic: "Rust", + }, { // By default, we send patch updates to the Dependency Dashboard and do not generate a PR. // We want to generate PRs for a select number of dependencies to ensure we stay up to date on these. diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index 86dc74f7351..fab0df693cb 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -428,12 +428,6 @@ jobs: - name: Set up environmentF run: choco install checksum --no-progress - - name: Rust - shell: pwsh - run: | - rustup target install i686-pc-windows-msvc - rustup target install aarch64-pc-windows-msvc - - name: Print environment run: | node --version @@ -681,10 +675,6 @@ jobs: - name: Set up Node-gyp run: python3 -m pip install setuptools - - name: Rust - shell: pwsh - run: rustup target install aarch64-apple-darwin - - name: Print environment run: | node --version @@ -890,10 +880,6 @@ jobs: - name: Set up Node-gyp run: python3 -m pip install setuptools - - name: Rust - shell: pwsh - run: rustup target install aarch64-apple-darwin - - name: Print environment run: | node --version @@ -1040,9 +1026,7 @@ jobs: - name: Build Native Module if: steps.cache.outputs.cache-hit != 'true' working-directory: apps/desktop/desktop_native - run: | - rustup target add aarch64-apple-darwin - node build.js cross-platform + run: node build.js cross-platform - name: Build if: steps.build-cache.outputs.cache-hit != 'true' @@ -1139,10 +1123,6 @@ jobs: - name: Set up Node-gyp run: python3 -m pip install setuptools - - name: Rust - shell: pwsh - run: rustup target install aarch64-apple-darwin - - name: Print environment run: | node --version @@ -1296,9 +1276,7 @@ jobs: - name: Build Native Module if: steps.cache.outputs.cache-hit != 'true' working-directory: apps/desktop/desktop_native - run: | - rustup target add aarch64-apple-darwin - node build.js cross-platform + run: node build.js cross-platform - name: Build if: steps.build-cache.outputs.cache-hit != 'true' diff --git a/apps/desktop/desktop_native/Cargo.lock b/apps/desktop/desktop_native/Cargo.lock index 115947f1a81..f3db03f8639 100644 --- a/apps/desktop/desktop_native/Cargo.lock +++ b/apps/desktop/desktop_native/Cargo.lock @@ -889,7 +889,7 @@ dependencies = [ "ssh-encoding", "ssh-key", "sysinfo", - "thiserror 1.0.69", + "thiserror 2.0.12", "tokio", "tokio-stream", "tokio-util", @@ -931,7 +931,7 @@ dependencies = [ "cc", "core-foundation", "glob", - "thiserror 1.0.69", + "thiserror 2.0.12", "tokio", ] @@ -2480,7 +2480,7 @@ checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ "getrandom 0.2.15", "libredox", - "thiserror 2.0.11", + "thiserror 2.0.12", ] [[package]] @@ -2971,11 +2971,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.11", + "thiserror-impl 2.0.12", ] [[package]] @@ -2991,9 +2991,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", diff --git a/apps/desktop/desktop_native/build.js b/apps/desktop/desktop_native/build.js index da61da15f9d..2edd0e89616 100644 --- a/apps/desktop/desktop_native/build.js +++ b/apps/desktop/desktop_native/build.js @@ -45,6 +45,10 @@ function buildProxyBin(target, release = true) { } } +function installTarget(target) { + child_process.execSync(`rustup target add ${target}`, { stdio: 'inherit', cwd: __dirname }); +} + if (!crossPlatform && !target) { console.log(`Building native modules in ${mode} mode for the native architecture`); buildNapiModule(false, mode === "release"); @@ -54,6 +58,7 @@ if (!crossPlatform && !target) { if (target) { console.log(`Building for target: ${target} in ${mode} mode`); + installTarget(target); buildNapiModule(target, mode === "release"); buildProxyBin(target, mode === "release"); return; @@ -70,6 +75,7 @@ if (process.platform === "linux") { } platformTargets.forEach(([target, _]) => { + installTarget(target); buildNapiModule(target); buildProxyBin(target); }); diff --git a/apps/desktop/desktop_native/rust-toolchain.toml b/apps/desktop/desktop_native/rust-toolchain.toml new file mode 100644 index 00000000000..898a61f3f4b --- /dev/null +++ b/apps/desktop/desktop_native/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.85.0" +components = [ "rustfmt", "clippy" ] +profile = "minimal"