Skip to content

Conversation

@taiki-e
Copy link

@taiki-e taiki-e commented Mar 2, 2024

Fixes #355

See #355 (comment) and #355 (comment) for details.
This PR uses the latter approach, which is more accurate. However, I have also implemented the former approach in another branch and can update the PR to use it if needed.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you report the timings for cargo clean && time cargo build on main and on this feature branch?

Comment on lines +11 to +18
if targets.len() > 1 {
// Config can contain multiple targets, but we don't support it: https://doc.rust-lang.org/cargo/reference/config.html#buildtarget
panic!("multi-target build is not supported: {targets:?}");
}
targets
.pop()
// Get the host triple if the target is not specified in config.
.unwrap_or_else(|| config.host_triple().unwrap().to_owned())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be cleaner as match targets.len() { ... }.

let mut targets = config.build_target_for_cli(None::<&str>).unwrap();
if targets.len() > 1 {
// Config can contain multiple targets, but we don't support it: https://doc.rust-lang.org/cargo/reference/config.html#buildtarget
panic!("multi-target build is not supported: {targets:?}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's return a result from this function and properly propagate errors rather than panicking here.

@kaleidawave
Copy link

kaleidawave commented Jun 18, 2024

Rough test of build time:

# main
real	0m22.610s
user	0m36.292s
sys	0m4.760s

# feature
real	0m26.355s
user	0m44.987s
sys	0m5.021s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distributed release files can only compile for musl

3 participants