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 6adeb14
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 21 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ 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 && mv Cargo.lock Cargo.lock.backup
- 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 +232,28 @@ 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 && mv Cargo.lock.backup Cargo.lock
- run: cd lib/macro/internal && mv Cargo.lock Cargo.lock.backup
- 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/internal && mv Cargo.lock.backup Cargo.lock
- run: cd lib/macro && mv Cargo.lock Cargo.lock.backup
- 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
- run: cd lib/macro && mv Cargo.lock.backup Cargo.lock
windows:
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -324,9 +333,8 @@ 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 && mv Cargo.lock Cargo.lock.backup
- 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 +353,25 @@ 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 && mv Cargo.lock.backup Cargo.lock
- run: cd lib/macro/internal && mv Cargo.lock Cargo.lock.backup
- 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/internal && mv Cargo.lock.backup Cargo.lock
- run: cd lib/macro && mv Cargo.lock Cargo.lock.backup
- 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
- run: cd lib/macro && mv Cargo.lock.backup 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
34 changes: 21 additions & 13 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ 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";
// We assume a lock file already exists, which should often by the case.
instructions += Instruction::shell("mv", &[lock, backup]);
instructions += Instruction::shell("cp", &[msrv, lock]);
instructions.0.rotate_right(2);
// We have to remove first because Windows cannot move on an existing file.
instructions += Instruction::shell("rm", &[lock]);
instructions += Instruction::shell("mv", &[backup, lock]);
}
instructions
}
}
Expand All @@ -183,6 +195,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 +392,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 6adeb14

Please sign in to comment.