Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Compile libraries and binaries at workspace level if building workspace #9

Open
azriel91 opened this issue Mar 30, 2018 · 2 comments
Open

Comments

@azriel91
Copy link
Owner

When compiling libraries and binaries for a workspace, if member crates are compiled individually, then crates that are common dependencies may be compiled multiple times1.

In addition, cargo build --all performs compilation on multiple threads, so the wall clock time is shorter.

$ time (for crate in $(ls crate); do; ( cd crate/$crate; cargo test --release;)
# ... elided
1652.02s user 51.42s system 303% cpu 9:21.12 total

$ time cargo test --all --release
# ... elided
1680.56s user 55.82s system 482% cpu 5:59.60 total

We should change the build command entry to build at the workspace level when building a workspace.

1 I've seen this on Windows. On Ubuntu the common dependencies are only compiled once.

@azriel91
Copy link
Owner Author

azriel91 commented Mar 30, 2018

Just discovered cargo build --all-targets, which does what I wanted with hull build (and more).

cargo build --all-targets builds lib and bin targets at debug and optimized levels. What we want is lib, bin, and example targets at just debug or just release levels (based on active profile).

cargo build --examples builds all examples in the workspace if invoked at workspace level. Perhaps just using bare cargo commands is good enough.

@azriel91
Copy link
Owner Author

azriel91 commented Jun 28, 2018

The current mechanism of hull each -- <command> doesn't work on Windows, as it tacks on the members to the canonicalized workspace path, e.g. \\?\D:\path\to\workspace\app/*\Cargo.toml, which fails to resolve on Windows. The app/* comes from the workspace's member dependencies.

azriel91 added a commit that referenced this issue Jul 19, 2018
Should allow crate directories to correctly be discovered on Windows.

Issue #9
azriel91 added a commit that referenced this issue Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant