Skip to content
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

Workspace hack #265

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/workspace-hack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Workspace hack

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
# Check https://docs.rs/cargo-hakari/0.9.29/cargo_hakari/#installation
# to learn how to install cargo-hakari locally
- name: Install cargo-hakari
uses: taiki-e/install-action@v2
with:
tool: cargo-hakari
- name: Verify workspace-hack
run: |
cd libs
# Check that my-workspace-hack's Cargo.toml is up-to-date
# If this fails, run `cargo hakari generate` to fix it
cargo hakari generate --diff
# Check that all workspace crates depend on my-workspace-hack
# If this fails, run `cargo hakari manage-deps` to fix it
cargo hakari manage-deps --dry-run
25 changes: 25 additions & 0 deletions libs/.config/hakari.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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 version for hakari's output. Version 4 requires cargo-hakari 0.9.22 or above.
dep-format-version = "4"

# 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",
# "aarch64-apple-darwin",
# "x86_64-pc-windows-msvc",
]

# Write out exact versions rather than a semver range. (Defaults to false.)
# exact-versions = true
58 changes: 58 additions & 0 deletions libs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["./pavex*", "generate_from_path", "persist_if_changed"]
members = ["./pavex*", "generate_from_path", "persist_if_changed", "workspace_hack"]
resolver = "2"

[workspace.package]
Expand Down
1 change: 1 addition & 0 deletions libs/generate_from_path/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ indicatif = "0.17.7"
walkdir = "2.4.0"
sanitize-filename = "0.5"
regex = "1.10.2"
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ hyper = { version = "1", features = ["full"], optional = true }
hyper-util = { version = "0.1", features = ["tokio", "server", "server-auto"], optional = true }
socket2 = { version = "0.5.3", optional = true }
smallvec = "1"
workspace_hack = { version = "0.1", path = "../workspace_hack" }

[dev-dependencies]
tokio = { version = "1", features = ["macros"] }
Expand Down
1 change: 1 addition & 0 deletions libs/pavex_bp_schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ license.workspace = true
[dependencies]
serde = { version = "1", features = ["derive"] }
pavex_reflection = { path = "../pavex_reflection", version = "=0.1.30" }
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavex_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ secrecy = { version = "0.8.0", features = ["serde"] }
clap-stdin = "0.4.0"
owo-colors = "4.0.0"
anstyle = "1.0.6"
workspace_hack = { version = "0.1", path = "../workspace_hack" }

[dev-dependencies]
pavex_test_runner = { path = "../pavex_test_runner" }
Expand Down
1 change: 1 addition & 0 deletions libs/pavex_cli_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ license.workspace = true
anyhow = "1"
pavex = { path = "../pavex", version = "0.1.30" }
thiserror = "1.0.56"
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavex_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ proc-macro = true
proc-macro2 = "1.0"
quote = "1.0"
syn = "2.0"
workspace_hack = { version = "0.1", path = "../workspace_hack" }

[dev-dependencies]
trybuild = "1.0"
Expand Down
1 change: 1 addition & 0 deletions libs/pavex_miette/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ supports-hyperlinks = { version = "3.0.0" }
supports-color = { version = "3.0.0" }
supports-unicode = { version = "3.0.0" }
terminal_size = { version = "0.3" }
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavex_reflection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ license.workspace = true

[dependencies]
serde = { version = "1", features = ["derive"] }
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavex_test_runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ globwalk = "0.9.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
regex = "1.10.2"
once_cell = "1.19.0"
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavex_tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ readme = "README.md"
[dependencies]
tracing = { version = "0.1", default-features = false, features = ["std"] }
pavex = { version = "0.1.30", path = "../pavex" }
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavexc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ r2d2 = "0.8"
bincode = "1"
rayon = "1.7"
num_cpus = "1.15.0"
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/pavexc_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ron = "0.8"
generate_from_path = { path = "../generate_from_path", version = "0.1.30" }
tempfile = "3.9.0"
better-panic = "0.3.0"
workspace_hack = { version = "0.1", path = "../workspace_hack" }

[build-dependencies]
vergen = { workspace = true }
1 change: 1 addition & 0 deletions libs/pavexc_cli_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ license.workspace = true
anyhow = "1"
pavex = { path = "../pavex", version = "0.1.30" }
thiserror = "1.0.56"
workspace_hack = { version = "0.1", path = "../workspace_hack" }
1 change: 1 addition & 0 deletions libs/persist_if_changed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ tracing = "0.1"
fs-err = "2.7"
sha2 = "0.10"
anyhow = "1"
workspace_hack = { version = "0.1", path = "../workspace_hack" }
4 changes: 4 additions & 0 deletions libs/workspace_hack/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Avoid putting conflict markers in the generated Cargo.toml file, since their presence breaks
# Cargo.
# Also do not check out the file as CRLF on Windows, as that's what hakari needs.
Cargo.toml merge=binary -crlf
Loading