mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-07-08 13:40:53 +00:00
other: fix schema crate interfering with installs (#2109)
This change should fix the issue around `cargo install` being confused by the schema generation binary by just moving it entirely into a separate tool "crate".
This commit is contained in:
@@ -11,8 +11,8 @@ on:
|
||||
paths:
|
||||
- "schema/**"
|
||||
- "scripts/schema/**"
|
||||
- "tools/schema_gen/**"
|
||||
- ".github/workflows/validate_schema.yml"
|
||||
- "src/bin/schema.rs"
|
||||
- "Cargo.toml"
|
||||
|
||||
permissions: {}
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
uses: ClementTsang/skip-duplicate-actions@41b0a75f656d455934ffa6a46b779d8d996ac47c
|
||||
with:
|
||||
skip_after_successful_duplicate: "true"
|
||||
paths: '["schema/**", "scripts/schema/**", ".github/workflows/validate_schema.yml", ".github/ci", "src/bin/schema.rs", "Cargo.toml"]'
|
||||
paths: '["schema/**", "scripts/schema/**", ".github/workflows/validate_schema.yml", ".github/ci", "tools/schema_gen/**", "Cargo.toml"]'
|
||||
do_not_skip: '["workflow_dispatch"]'
|
||||
|
||||
test-build-documentation:
|
||||
|
||||
@@ -20,6 +20,12 @@ That said, these are more guidelines rather than hard rules, though the project
|
||||
|
||||
---
|
||||
|
||||
## 0.14.2 - Unreleased
|
||||
|
||||
### Other
|
||||
|
||||
- [#2109](https://github.com/ClementTsang/bottom/pull/2109): Relocate the schema generation tool to avoid it interfering with `cargo install`.
|
||||
|
||||
## 0.14.1 - 2026-06-22
|
||||
|
||||
### Other
|
||||
|
||||
+2
-10
@@ -24,6 +24,7 @@ exclude = [
|
||||
"sample_configs/",
|
||||
"schema/",
|
||||
"scripts/",
|
||||
"tools/",
|
||||
"wix/",
|
||||
".all-contributorsrc",
|
||||
".gitignore",
|
||||
@@ -52,14 +53,6 @@ name = "btm"
|
||||
path = "src/bin/main.rs"
|
||||
doc = false
|
||||
|
||||
[[bin]]
|
||||
name = "schema"
|
||||
path = "src/bin/schema.rs"
|
||||
test = false
|
||||
doctest = false
|
||||
doc = false
|
||||
required-features = ["generate_schema"]
|
||||
|
||||
[features]
|
||||
# Used for general builds.
|
||||
battery = ["dep:starship-battery"]
|
||||
@@ -71,7 +64,7 @@ default = ["deploy"]
|
||||
|
||||
# Should not be included in builds.
|
||||
logging = ["fern", "log", "time"]
|
||||
generate_schema = ["schemars", "serde_json", "strum"]
|
||||
generate_schema = ["schemars", "strum"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.101"
|
||||
@@ -109,7 +102,6 @@ time = { version = "0.3.47", features = ["local-offset", "formatting", "macros"]
|
||||
|
||||
# These are just used for JSON schema generation.
|
||||
schemars = { version = "1.2.1", optional = true }
|
||||
serde_json = { version = "1.0.149", optional = true }
|
||||
strum = { version = "0.27.2", features = ["derive"], optional = true }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
|
||||
+7
-5
@@ -2,18 +2,20 @@
|
||||
|
||||
## Generation
|
||||
|
||||
These are automatically generated from code using [`schemars`](https://github.com/GREsau/schemars). They're locked
|
||||
behind a feature flag to avoid building unnecessary code for release builds, and you can generate them like so:
|
||||
These are automatically generated from the code using [`schemars`](https://github.com/GREsau/schemars). The `schemars`
|
||||
derives are locked behind the `generate_schema` feature flag to avoid building unnecessary code for normal builds.
|
||||
Meanwhile, the generator itself lives in a separate `tools/schema_gen` helper crate. You can
|
||||
generate them like so:
|
||||
|
||||
```bash
|
||||
# Will print out to stdout
|
||||
cargo run --features="generate_schema" -- --generate_schema
|
||||
cargo run --manifest-path tools/schema_gen/Cargo.toml
|
||||
|
||||
# e.g. for nightly
|
||||
cargo run --features="generate_schema" -- --generate_schema > schema/nightly/bottom.json
|
||||
cargo run --manifest-path tools/schema_gen/Cargo.toml > schema/nightly/bottom.json
|
||||
|
||||
# e.g. for a specific version
|
||||
cargo run --features="generate_schema" -- --generate_schema 0.12.0 > schema/v0.12.0/bottom.json
|
||||
cargo run --manifest-path tools/schema_gen/Cargo.toml -- 0.12.0 > schema/v0.12.0/bottom.json
|
||||
```
|
||||
|
||||
Alternatively, run the `scripts/schema/generate.sh` script (for stable releases) or `scripts/schema/nightly.sh`
|
||||
|
||||
@@ -5,4 +5,4 @@ set -e
|
||||
cd "$(dirname "$0")";
|
||||
cd ../..
|
||||
|
||||
cargo run --bin schema --features="generate_schema" -- $1 > schema/v$1/bottom.json
|
||||
cargo run --manifest-path tools/schema_gen/Cargo.toml -- $1 > schema/v$1/bottom.json
|
||||
|
||||
@@ -5,4 +5,4 @@ set -e
|
||||
cd "$(dirname "$0")";
|
||||
cd ../..
|
||||
|
||||
cargo run --bin schema --features="generate_schema" > schema/nightly/bottom.json
|
||||
cargo run --manifest-path tools/schema_gen/Cargo.toml > schema/nightly/bottom.json
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
target/
|
||||
Generated
+1882
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
[package]
|
||||
name = "schema_gen"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.101"
|
||||
bottom = { path = "../../", features = ["generate_schema"] }
|
||||
clap = { version = "4.5.57", features = ["default", "cargo", "wrap_help", "derive"] }
|
||||
itertools = "0.15.0"
|
||||
schemars = "1.2.1"
|
||||
serde_json = "1.0.149"
|
||||
strum = { version = "0.27.2", features = ["derive"] }
|
||||
|
||||
[lints.rust]
|
||||
rust_2018_idioms = "deny"
|
||||
|
||||
[lints.rustdoc]
|
||||
broken_intra_doc_links = "deny"
|
||||
private_intra_doc_links = "deny"
|
||||
|
||||
[lints.clippy]
|
||||
todo = "deny"
|
||||
unimplemented = "deny"
|
||||
missing_safety_doc = "deny"
|
||||
unwrap_used = "deny"
|
||||
@@ -1,4 +1,3 @@
|
||||
#![cfg(feature = "generate_schema")]
|
||||
#![expect(
|
||||
clippy::unwrap_used,
|
||||
reason = "this is just used to generate jsonschema files"
|
||||
Reference in New Issue
Block a user