Hi, I'd like to bring your attention to two upcoming changes which might impact your workflow if you work on rust code in the application-services repository.
1. https://github.com/mozilla/application-services/pull/3329: Exclude slow to build crates which are unlikely to break frequently from the workspace default-members. 2. https://github.com/mozilla/application-services/pull/3349: Optimize project layout to avoid bad build performance, These changes should land this week or early next, and are both intended to reduce the amount of time spent waiting for `cargo build`, `cargo test`, `cargo clippy`, and IDE results to complete. Anyway, I'm sending this prior to landing it so that anybody who has opinions on the topic has a chance to weigh in, and so that people aren't blindsided by it when it lands. Let's go through them in order: Excluding slow to build crates This change is smaller, and is just that the `megazord` crates as well as the `systest` crate will no longer be built with normal invocations of `cargo build` and `cargo test`. These are very slow crates to build and link, and there very rarely do we have changes that impact them that would not cause breakage earlier in the build change. If you need to build these, it can still be done using the `--all` or `--workspace` flags, e.g. `cargo build --all` or `cargo build --workspace` (which are equivalent). Additionally, manually specifying the project path as `cargo build -p megazord`, or issuing an unqualified `cargo build` from inside the megazord directory will be unaffected: e.g. `cd megazords/full; cargo build`. One concrete change here is that if you add a new crate to the repository, you now need to list it both in the `workspace.members` and `workspace.default-members`. We're working on improving this, but it requires upstream patches to `cargo` (which have PRs already). Optimize project layout If it were just that, I would likely not have bothered sending this email, however the second is more substantial, and involves a restructuring of where (some of) our tests, benchmarks, and example code are placed for Rust crates. The outcome of this is around a 40% reduction in individual crate build times, and far fewer crates needing to be rebuilt on average (no more needing to rebuild `places` whenever there's a change in `fxa-client`). The background here is that our example code causes a significant amount of extra time to be spent waiting for builds to complete. It may surprise you above that . Additionally, our benchmarks bring in `criterion`, a notoriously slow to compile Rust crate. By separating these dependencies, we ca see the results of our changes faster, and improve build parallelism across the board. Concretely, the outcome here is documented in https://github.com/mozilla/application-services/blob/example-freedom/docs/test-faster.md, but to summarize: - Place examples in `/examples/example-name` instead of `/components/$component/examples` - Place benchmarks in `/testing/separated/$component-bench` instead of `/components/$component/benches` - Place tests that require additional heavyweight dependencies in `/testing/separated/$component-tests` instead of in either `/components/$component/tests` or in the `#[cfg(test)]` block. There are a few extra steps that help avoid additional rebuilds, so you're recommended to follow those instructions, which will be located in `/docs/test-faster.md` once the code lands instead of relying on my summary here. Anyway, I hope this doesn't upset anybody too much, and if it does, please comment on the issue in question. Thanks, Thom Chiovoloni
_______________________________________________ Sync-dev mailing list Sync-dev@mozilla.org https://mail.mozilla.org/listinfo/sync-dev