Skip to content

Commit

Permalink
Fix xtask
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 committed Nov 11, 2023
1 parent 4597e11 commit e3a0a3f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion lib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
31 changes: 18 additions & 13 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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 => {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e3a0a3f

Please sign in to comment.