Skip to content

Commit

Permalink
rust: introduce a workspace-hack package
Browse files Browse the repository at this point in the history
Introduce a workspace-hack package, managed by hakari, in order to
reduce excessive compiling.
  • Loading branch information
bmwill committed May 25, 2022
1 parent 758cf02 commit b000d5f
Show file tree
Hide file tree
Showing 31 changed files with 1,926 additions and 17 deletions.
31 changes: 31 additions & 0 deletions .config/hakari.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file contains settings for `cargo hakari`.
# See https://docs.rs/cargo-hakari/latest/cargo_hakari/config for a full list of options.

hakari-package = "workspace-hack"

# Format for `workspace-hack = ...` lines in other Cargo.tomls. Requires cargo-hakari 0.9.8 or above.
dep-format-version = "1"

# Setting workspace.resolver = "2" in the root Cargo.toml is HIGHLY recommended.
# Hakari works much better with the new feature resolver.
# For more about the new feature resolver, see:
# https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver
resolver = "2"

# Add triples corresponding to platforms commonly used by developers here.
# https://doc.rust-lang.org/rustc/platform-support.html
platforms = [
# "x86_64-unknown-linux-gnu",
# "x86_64-apple-darwin",
# "x86_64-pc-windows-msvc",
]

# Write out exact versions rather than a semver range. (Defaults to false.)
# exact-versions = true

output-single-feature = true

[final-excludes]
workspace-members = [
"x",
]
19 changes: 18 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ jobs:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: bmwill/rust-cache@v1 # Fork of 'Swatinem/rust-cache' which allows caching additional paths
- name: Install cargo-hakari, and cache the binary
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-hakari
locked: true
- run: scripts/license_check.sh
- run: cargo xlint
- run: |
cargo hakari generate --diff # workspace-hack Cargo.toml is up-to-date
cargo hakari manage-deps --dry-run # all workspace crates depend on workspace-hack
test:
needs: diff
Expand Down Expand Up @@ -127,10 +135,19 @@ jobs:
with:
crate: cargo-udeps
locked: true
- name: Install cargo-hakari, and cache the binary
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-hakari
locked: true
# Normally running cargo-udeps requires use of a nightly compiler
# In order to have a more stable and less noisy experience, lets instead
# opt to use the stable toolchain specified via the 'rust-toolchain' file
# and instead enable nightly features via 'RUSTC_BOOTSTRAP'
- name: run cargo-udeps
run: RUSTC_BOOTSTRAP=1 cargo udeps
run: |
# First we need to disable the workspace-hack package
cargo hakari disable
cargo hakari remove-deps -y
RUSTC_BOOTSTRAP=1 cargo udeps
Loading

0 comments on commit b000d5f

Please sign in to comment.