mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 12:12:50 +01:00
Fix config pickup behaviour so that both examples and usage-examples build
correctly
This commit is contained in:
parent
859cd418f0
commit
d838286de6
4 changed files with 39 additions and 15 deletions
|
@ -2,13 +2,5 @@
|
|||
xtask = "run --package xtask --"
|
||||
pxtask = "run --package xtask --features rayon --"
|
||||
|
||||
[target.thumbv6m-none-eabi]
|
||||
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
|
||||
|
||||
[target.thumbv7m-none-eabi]
|
||||
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
|
||||
|
||||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||
rustflags = [
|
||||
"-C", "link-arg=-Tlink.x",
|
||||
]
|
||||
# Don't define the RUSTFLAGS link.x thing here: it messes
|
||||
# up compilation of the usage examples.
|
||||
|
|
10
rtic/.cargo/config.toml
Normal file
10
rtic/.cargo/config.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
[target.thumbv6m-none-eabi]
|
||||
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
|
||||
|
||||
[target.thumbv7m-none-eabi]
|
||||
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
|
||||
|
||||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||
rustflags = [
|
||||
"-C", "link-arg=-Tlink.x",
|
||||
]
|
|
@ -383,6 +383,7 @@ impl<'a> CargoCommand<'a> {
|
|||
if let Some(cargoarg) = cargoarg {
|
||||
args.extend_from_slice(&[cargoarg]);
|
||||
}
|
||||
|
||||
args.extend_from_slice(&[
|
||||
self.command(),
|
||||
"--example",
|
||||
|
@ -407,9 +408,15 @@ impl<'a> CargoCommand<'a> {
|
|||
mode,
|
||||
} => {
|
||||
let mut args = vec!["+nightly"];
|
||||
|
||||
if let Some(cargoarg) = cargoarg {
|
||||
args.extend_from_slice(&[cargoarg]);
|
||||
}
|
||||
|
||||
// We need to be in the `rtic` directory to pick up
|
||||
// the correct .cargo/config.toml file
|
||||
args.extend_from_slice(&["-Z", "unstable-options", "-C", "rtic"]);
|
||||
|
||||
args.extend_from_slice(&[
|
||||
self.command(),
|
||||
"--example",
|
||||
|
@ -641,6 +648,11 @@ impl<'a> CargoCommand<'a> {
|
|||
if let Some(cargoarg) = cargoarg {
|
||||
args.extend_from_slice(&[cargoarg]);
|
||||
}
|
||||
|
||||
// We need to be in the `rtic` directory to pick up
|
||||
// the correct .cargo/config.toml file
|
||||
args.extend_from_slice(&["-Z", "unstable-options", "-C", "rtic"]);
|
||||
|
||||
args.extend_from_slice(&[
|
||||
self.command(),
|
||||
"--example",
|
||||
|
@ -694,6 +706,13 @@ impl<'a> CargoCommand<'a> {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_stdout_intermediate(&self) -> bool {
|
||||
match self {
|
||||
Self::ExampleSize { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl BuildMode {
|
||||
|
@ -737,6 +756,10 @@ pub fn run_command(command: &CargoCommand, stderr_mode: OutputMode) -> anyhow::R
|
|||
let stderr = String::from_utf8(result.stderr).unwrap_or("Not displayable".into());
|
||||
let stdout = String::from_utf8(result.stdout).unwrap_or("Not displayable".into());
|
||||
|
||||
if command.print_stdout_intermediate() && exit_status.success() {
|
||||
log::info!("\n{}", stdout);
|
||||
}
|
||||
|
||||
Ok(RunResult {
|
||||
exit_status,
|
||||
stdout,
|
||||
|
@ -850,9 +873,8 @@ pub fn handle_results(globals: &Globals, results: Vec<FinalRunResult>) -> Result
|
|||
.clone()
|
||||
.for_each(|(cmd, error)| error!("❌ Failed: {cmd}\n {}\n{error}", cmd.as_cmd_string()));
|
||||
|
||||
let ecount = errors.count();
|
||||
let cecount = command_errors.count();
|
||||
if ecount != 0 || cecount != 0 {
|
||||
let ecount = errors.count() + command_errors.count();
|
||||
if ecount != 0 {
|
||||
log::error!("{ecount} commands failed.");
|
||||
Err(())
|
||||
} else {
|
||||
|
|
|
@ -100,8 +100,8 @@ impl fmt::Display for TestRunError {
|
|||
TestRunError::CommandError(e) => {
|
||||
write!(
|
||||
f,
|
||||
"Command failed with exit status {}: {}",
|
||||
e.exit_status, e.stdout
|
||||
"Command failed with exit status {}: {} {}",
|
||||
e.exit_status, e.stdout, e.stderr
|
||||
)
|
||||
}
|
||||
TestRunError::PathConversionError(p) => {
|
||||
|
|
Loading…
Reference in a new issue