New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce new command, xtask print #905
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license-eye has totally checked 391 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
390 | 1 | 0 | 0 |
Click to see the invalid file list
- build/xtask/src/print.rs
82e6a1e
to
79b18a5
Compare
|
||
println!("{}", final_path.display()); | ||
} else { | ||
bail!("I'm not sure what to print. Currently supported: --archive"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to use an ArgGroup here, but it seems like it's not fully baked in the derive API yet clap-rs/clap#2621
No big deal.
.ok_or(Error::msg(format!("cannot find image {}", image_name)))?; | ||
|
||
let final_path = config | ||
.img_file(format!("build-{}.zip", config.toml.name), image_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little not happy about this one, as it's duplicating the logic that's already been duplicated twice:
hubris/build/xtask/src/humility.rs
Line 29 in 0b29eb5
.join(format!("build-{}.zip", &toml.name)); hubris/build/xtask/src/dist.rs
Line 579 in 60ecfe3
cfg.img_file(format!("build-{}.zip", cfg.toml.name), image_name),
Not 100% sure what the best way to solve this would be, though...
632d9d6
to
6c8de73
Compare
6c8de73
to
ac9c52a
Compare
This command can print out information about the build. Currently, it only supports one option, --archive, which prints out the final build archive. This is useful in scripting. Example: ``` 〉cargo xtask print .\app\demo-stm32f4-discovery\app.toml --archive Finished dev [optimized + debuginfo] target(s) in 1.68s Running `target\debug\xtask.exe print .\app\demo-stm32f4-discovery\app.toml --archive` target\demo-stm32f4-discovery\dist\default\build-demo-stm32f4-discovery.zip ``` Additonally, I wanted to make the errors nice for this, and so I ended up adding some contexts inside of the other commands, which will also make them slightly better. Example: ``` 〉cargo xtask print .\app\demo-stm32f4-discovery\app.tom --archive Finished dev [optimized + debuginfo] target(s) in 1.52s Running `target\debug\xtask.exe print .\app\demo-stm32f4-discovery\app.tom --archive` Error: could not print information about the build Caused by: 0: could not create build configuration 1: could not read .\app\demo-stm32f4-discovery\app.tom 2: The system cannot find the file specified. (os error 2) ```
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ac9c52a
to
f851223
Compare
This command can print out information about the build. Currently, it only supports one option, --archive, which prints out the final build archive. This is useful in scripting.
Example:
Additonally, I wanted to make the errors nice for this, and so I ended up adding some contexts inside of the other commands, which will also make them slightly better. Example:
This feature was requested by @rmustacc and @jclulow , so I'd love to make sure that this satisfies their needs.
I could make the command just
print-archive
(suggested by @mkeeter) and remove some of the machinery here, but I feel like we've wanted to print other stuff in the past? IIRC @cbiffle was talking about something with environment variables? maybe that was just setting them, not examining them.