From e3a0a3faaedbcd8f165626ad461eeaeecefb82d8 Mon Sep 17 00:00:00 2001 From: ia0 Date: Sat, 11 Nov 2023 23:29:05 +0100 Subject: [PATCH] Fix xtask --- .github/workflows/ci.yml | 18 ++++++++++++------ lib/CHANGELOG.md | 2 +- lib/src/lib.rs | 5 ++++- xtask/src/main.rs | 31 ++++++++++++++++++------------- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd5b5ab..b480def 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,9 +212,7 @@ jobs: run: cargo +stable semver-checks check-release working-directory: lib/macro - run: rustup install 1.48 - - run: mv lib/Cargo.lock.msrv lib/Cargo.lock - - run: mv lib/macro/internal/Cargo.lock.msrv lib/macro/internal/Cargo.lock - - run: mv lib/macro/Cargo.lock.msrv lib/macro/Cargo.lock + - run: cd lib && cp Cargo.lock.msrv Cargo.lock - name: cd lib && cargo +1.48 build run: cargo +1.48 build working-directory: lib @@ -233,18 +231,23 @@ jobs: - name: cd lib && cargo +1.48 build --release --no-default-features run: cargo +1.48 build --release --no-default-features working-directory: lib + - run: cd lib && rm Cargo.lock + - run: cd lib/macro/internal && cp Cargo.lock.msrv Cargo.lock - name: cd lib/macro/internal && cargo +1.48 build run: cargo +1.48 build working-directory: lib/macro/internal - name: cd lib/macro/internal && cargo +1.48 build --release run: cargo +1.48 build --release working-directory: lib/macro/internal + - run: cd lib/macro/internal && rm Cargo.lock + - run: cd lib/macro && cp Cargo.lock.msrv Cargo.lock - name: cd lib/macro && cargo +1.48 build run: cargo +1.48 build working-directory: lib/macro - name: cd lib/macro && cargo +1.48 build --release run: cargo +1.48 build --release working-directory: lib/macro + - run: cd lib/macro && rm Cargo.lock windows: runs-on: windows-latest steps: @@ -324,9 +327,7 @@ jobs: run: cargo +stable build --release working-directory: bin - run: rustup install 1.48 - - run: mv lib/Cargo.lock.msrv lib/Cargo.lock - - run: mv lib/macro/internal/Cargo.lock.msrv lib/macro/internal/Cargo.lock - - run: mv lib/macro/Cargo.lock.msrv lib/macro/Cargo.lock + - run: cd lib && cp Cargo.lock.msrv Cargo.lock - name: cd lib && cargo +1.48 build run: cargo +1.48 build working-directory: lib @@ -345,15 +346,20 @@ jobs: - name: cd lib && cargo +1.48 build --release --no-default-features run: cargo +1.48 build --release --no-default-features working-directory: lib + - run: cd lib && rm Cargo.lock + - run: cd lib/macro/internal && cp Cargo.lock.msrv Cargo.lock - name: cd lib/macro/internal && cargo +1.48 build run: cargo +1.48 build working-directory: lib/macro/internal - name: cd lib/macro/internal && cargo +1.48 build --release run: cargo +1.48 build --release working-directory: lib/macro/internal + - run: cd lib/macro/internal && rm Cargo.lock + - run: cd lib/macro && cp Cargo.lock.msrv Cargo.lock - name: cd lib/macro && cargo +1.48 build run: cargo +1.48 build working-directory: lib/macro - name: cd lib/macro && cargo +1.48 build --release run: cargo +1.48 build --release working-directory: lib/macro + - run: cd lib/macro && rm Cargo.lock diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index 5939605..e1a915f 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -5,7 +5,7 @@ ### Minor - Make some functions `must_use` -- Bump MSRV from 1.47 to 1.70 +- Bump MSRV from 1.47 to 1.48 ### Patch diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 339c16a..891dc88 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -147,14 +147,17 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] // TODO: This list up to warn(clippy::pedantic) should ideally use a lint group. #![warn(elided_lifetimes_in_paths)] -#![warn(let_underscore_drop)] +// TODO(msrv): #![warn(let_underscore_drop)] #![warn(missing_debug_implementations)] #![warn(missing_docs)] #![warn(unreachable_pub)] +// TODO(msrv): #![warn(unsafe_op_in_unsafe_fn)] #![warn(unused_results)] +#![allow(unused_unsafe)] // TODO(msrv) #![warn(clippy::pedantic)] #![allow(clippy::enum_glob_use)] #![allow(clippy::similar_names)] +#![allow(clippy::uninlined_format_args)] // TODO(msrv) #[cfg(feature = "alloc")] extern crate alloc; diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 8b36193..3b048ae 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -164,6 +164,15 @@ impl Action { args: vec![format!("+{}", self.toolchain)], }; } + if self.toolchain == Toolchain::Msrv { + let lock = "Cargo.lock"; + let backup = "Cargo.lock.backup"; + let msrv = "Cargo.lock.msrv"; + instructions += Instruction::shell("mv", &[lock, backup]); + instructions += Instruction::shell("cp", &[msrv, lock]); + instructions.0.rotate_right(2); + instructions += Instruction::shell("mv", &[backup, lock]); + } instructions } } @@ -183,6 +192,15 @@ struct Instruction { } impl Instruction { + fn shell(cmd: &str, args: &[&str]) -> Self { + Instruction { + executor: Executor::Shell, + env: vec![], + cmd: cmd.to_string(), + args: args.iter().map(|x| x.to_string()).collect(), + } + } + fn execute(&self, toolchain: Toolchain, dir: Dir) { let mut command = match self.executor { Executor::Cargo => { @@ -371,19 +389,6 @@ impl Flags { run: Some(format!("rustup install {}", actions[0].toolchain)), ..Default::default() }); - - if actions[0].toolchain == Toolchain::Msrv { - for dir in Dir::iter().filter(|x| x.is_published() && x != &Dir::Bin) { - job.steps.push(WorkflowStep { - run: Some(format!( - "mv {}/Cargo.lock.msrv {}/Cargo.lock", - dir, dir - )), - ..Default::default() - }); - } - } - let components: BTreeSet<_> = actions .iter() .filter_map(|x| match x.task {