Skip to content

Commit 25330f5

Browse files
committed
Use workspace inheritance to simplify cargo config
1 parent 05f8509 commit 25330f5

File tree

5 files changed

+43
-38
lines changed

5 files changed

+43
-38
lines changed

Cargo.toml

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
[workspace]
22
members = ["cli", "core", "wasm"]
33

4+
[workspace.package]
5+
version = "1.1.0"
6+
description = "Arbitrary-precision unit-aware calculator"
7+
edition = "2021"
8+
homepage = "https://github.com/printfn/fend"
9+
repository = "https://github.com/printfn/fend"
10+
keywords = ["calculator", "cli", "conversion", "math", "tool"]
11+
categories = ["command-line-utilities", "mathematics", "science"]
12+
license = "MIT"
13+
14+
[workspace.dependencies]
15+
fend-core = { version = "1.1.0", path = "core" }
16+
417
[profile.release]
518
lto = true
619
opt-level = "z" # small code size

cli/Cargo.toml

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
[package]
22
name = "fend"
3-
# Don't bump version numbers manually, use deploy.sh instead
4-
version = "1.1.0"
5-
description = "Arbitrary-precision unit-aware calculator"
6-
homepage = "https://github.com/printfn/fend"
7-
repository = "https://github.com/printfn/fend"
3+
version.workspace = true
4+
description.workspace = true
5+
edition.workspace = true
6+
repository.workspace = true
7+
homepage.workspace = true
8+
keywords.workspace = true
9+
categories.workspace = true
10+
license.workspace = true
811
readme = "../README.md"
9-
license = "MIT"
10-
keywords = ["calculator", "cli", "conversion", "math", "tool"]
11-
edition = "2021"
12-
categories = ["command-line-utilities", "mathematics", "science"]
1312

1413
[dependencies]
1514
atty = "0.2.14"
1615
console = { version = "0.15.1", default-features = false }
1716
ctrlc = "3.2.3"
18-
fend-core = { version = "1.1.0", path = "../core" }
17+
fend-core.workspace = true
1918
home = "0.5.3"
2019
nanorand = { version = "0.6.1", default-features = false, features = ["std", "wyrand"] }
2120
rustyline = { version = "10.0.2", default-features = false, package = "rustyline-with-hint-fix" }

contrib/deploy.sh

+4-14
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,13 @@ fi
112112

113113
echo "Bumping version numbers..."
114114

115-
# version number in fend-core
115+
# fend workspace Cargo.toml x2
116116
sed "s/^version = \"$OLD_VERSION\"$/version = \"$NEW_VERSION\"/" \
117-
core/Cargo.toml >temp
118-
mv temp core/Cargo.toml
119-
120-
# fend cli TOML x2
121-
sed "s/^version = \"$OLD_VERSION\"$/version = \"$NEW_VERSION\"/" \
122-
cli/Cargo.toml | \
117+
Cargo.toml | \
123118
sed "s/^fend-core = { version = \"$OLD_VERSION\"/fend-core = { version = \"$NEW_VERSION\"/" >temp
124-
mv temp cli/Cargo.toml
125-
126-
# wasm TOML
127-
sed "s/^version = \"$OLD_VERSION\"$/version = \"$NEW_VERSION\"/" \
128-
wasm/Cargo.toml >temp
129-
mv temp wasm/Cargo.toml
119+
mv temp Cargo.toml
130120

131-
gitdiff "" 7 7
121+
gitdiff "" 3 3
132122

133123
manualstep "Add changelog to CHANGELOG.md"
134124

core/Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[package]
22
name = "fend-core"
3-
version = "1.1.0"
4-
description = "Arbitrary-precision unit-aware calculator"
5-
homepage = "https://github.com/printfn/fend"
6-
repository = "https://github.com/printfn/fend"
3+
version.workspace = true
4+
description.workspace = true
5+
edition.workspace = true
6+
repository.workspace = true
7+
homepage.workspace = true
8+
keywords.workspace = true
9+
categories.workspace = true
10+
license.workspace = true
711
readme = "README.md"
8-
license = "MIT"
9-
keywords = ["calculator", "library", "conversion", "math", "tool"]
10-
edition = "2021"
11-
categories = ["command-line-utilities", "mathematics", "science"]
1212

1313
[features]
1414
default = []

wasm/Cargo.toml

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
[package]
22
name = "fend-wasm"
3-
version = "1.1.0"
4-
edition = "2021"
5-
license = "MIT"
6-
repository = "https://github.com/printfn/fend"
7-
description = "Arbitrary-precision unit-aware calculator"
3+
version.workspace = true
4+
description.workspace = true
5+
edition.workspace = true
6+
repository.workspace = true
7+
homepage.workspace = true
8+
keywords.workspace = true
9+
categories.workspace = true
10+
license.workspace = true
811
publish = false
912

1013
[lib]
@@ -15,7 +18,7 @@ crate-type = ["cdylib", "rlib"]
1518
default = []
1619

1720
[dependencies]
18-
fend-core = { path = "../core" }
21+
fend-core.workspace = true
1922
instant = { version = "0.1.12", features = [ "wasm-bindgen" ] }
2023
js-sys = "0.3.60"
2124
wasm-bindgen = "0.2.83"

0 commit comments

Comments
 (0)