Skip to content

Commit

Permalink
Factor out workspace props (#1437)
Browse files Browse the repository at this point in the history
* Factor out common workspace Cargo.toml properties

Signed-off-by: clux <[email protected]>

* factor out forbid(unsafe_code)

Signed-off-by: clux <[email protected]>

* factor out deny(missing_docs)

found one case where we were not in sync. raising an issue

Signed-off-by: clux <[email protected]>

* simplify msrv checks now that it's in sync

cargo-msrv does not work with the new package factoring out
but it wasn't really that helpful anyway...
we only bumped the msrv when something broke, so..

Signed-off-by: clux <[email protected]>

* fix merge missing change

Signed-off-by: clux <[email protected]>

---------

Signed-off-by: clux <[email protected]>
Signed-off-by: Eirik A <[email protected]>
  • Loading branch information
clux authored Mar 25, 2024
1 parent aeb4d3f commit 2ff3a2d
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 93 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,9 @@ jobs:
command: check
args: --workspace

- name: Check rust-version keys matches MSRV consistently
- name: Check rust-version keys matches advertised MSRV
run: |
if [[ $(cat ./*/Cargo.toml | grep "rust-version" | uniq | wc -l) -gt 1 ]]; then
echo "inconsistent rust-version keys set in various kube-crates:"
rg "rust-version" ./*/Cargo.toml
exit 1
fi
if ! cat kube/Cargo.toml | grep "rust-version" | grep "${{ steps.msrv.outputs.msrv }}"; then
if ! cat Cargo.toml | grep "rust-version" | grep "${{ steps.msrv.outputs.msrv }}"; then
echo "msrv policy inconsistent with rust-version key"
exit 1
fi
Expand Down
17 changes: 17 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ members = [
"examples",
]

[workspace.package]
version = "0.88.1"
authors = [
"clux <[email protected]>",
"Natalie Klestrup Röijezon <[email protected]>",
"kazk <[email protected]>",
]
repository = "https://github.com/kube-rs/kube"
readme = "README.md"
license = "Apache-2.0"
edition = "2021"
rust-version = "1.75.0"

[workspace.lints.rust]
unsafe_code = "forbid"
missing_docs = "deny"

[workspace.dependencies]
ahash = "0.8"
anyhow = "1.0.71"
Expand Down
8 changes: 4 additions & 4 deletions e2e/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "e2e"
version = "0.1.0"
authors = ["clux <[email protected]>"]
publish = false
edition = "2021"
license = "Apache-2.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true

[package.metadata.release]
release = false
Expand Down
12 changes: 4 additions & 8 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
[package]
name = "kube-examples"
version = "0.1.0"
authors = [
"clux <[email protected]>",
"Natalie Klestrup Röijezon <[email protected]>",
"kazk <[email protected]>",
]
publish = false
edition = "2021"
license = "Apache-2.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true

[package.metadata.release]
release = false
Expand Down
15 changes: 3 additions & 12 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,12 @@ k3d:
# Bump the msrv of kube; "just bump-msrv 1.60.0"
bump-msrv msrv:
#!/usr/bin/env bash
# TODO: warn if not msrv+2 not found
oldmsrv="$(rg "rust-version = \"(.*)\"" -r '$1' kube/Cargo.toml)"
fastmod -m -d . --extensions toml "rust-version = \"$oldmsrv\"" "rust-version = \"{{msrv}}\""
# sanity
if [[ $(cat ./*/Cargo.toml | grep "rust-version" | uniq | wc -l) -gt 1 ]]; then
echo "inconsistent rust-version keys set in various kube-crates:"
rg "rust-version" ./*/Cargo.toml
exit 1
fi
fullmsrv="{{msrv}}"
fullmsrv="{{msrv}}" # need a temporary var for this
shortmsrv="${fullmsrv::-2}" # badge can use a short display version
badge="[![Rust ${shortmsrv}](https://img.shields.io/badge/MSRV-${shortmsrv}-dea584.svg)](https://github.com/rust-lang/rust/releases/tag/{{msrv}})"
sd "rust-version = \".*\"" "rust-version = \"{{msrv}}\"" Cargo.toml
sd "^.+badge/MSRV.+$" "${badge}" README.md
sd "${oldmsrv}" "{{msrv}}" .devcontainer/Dockerfile
cargo msrv
sd "rust:.*-bullseye" "rust:{{msrv}}-bullseye" .devcontainer/Dockerfile
# Increment the Kubernetes feature version from k8s-openapi for tests; "just bump-k8s"
bump-k8s:
Expand Down
21 changes: 10 additions & 11 deletions kube-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
[package]
name = "kube-client"
version = "0.88.1"
description = "Kubernetes client"
authors = [
"clux <[email protected]>",
"Natalie Klestrup Röijezon <[email protected]>",
"kazk <[email protected]>",
]
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube"
readme = "../README.md"
version.workspace = true
authors.workspace = true
repository.workspace = true
readme.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
keywords = ["kubernetes", "client",]
categories = ["web-programming::http-client", "configuration", "network-programming", "api-bindings"]
rust-version = "1.75.0"
edition = "2021"

[features]
default = ["client"]
Expand All @@ -39,6 +35,9 @@ features = ["client", "rustls-tls", "openssl-tls", "ws", "oauth", "oidc", "jsonp
# Define the configuration attribute `docsrs`. Used to enable `doc_cfg` feature.
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true

[dependencies]
base64 = { workspace = true, optional = true }
chrono = { workspace = true, optional = true }
Expand Down
2 changes: 0 additions & 2 deletions kube-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
//! - [`Api`](crate::Api) for the generic api methods available on Kubernetes resources
//! - [k8s-openapi](https://docs.rs/k8s-openapi) for how to create typed kubernetes objects directly
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]
#![forbid(unsafe_code)]
// Nightly clippy (0.1.64) considers Drop a side effect, see https://github.com/rust-lang/rust-clippy/issues/9608
#![allow(clippy::unnecessary_lazy_evaluations)]

Expand Down
20 changes: 10 additions & 10 deletions kube-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[package]
name = "kube-core"
description = "Kube shared types, traits and client-less behavior"
version = "0.88.1"
authors = [
"clux <[email protected]>",
"kazk <[email protected]>",
]
edition = "2021"
rust-version = "1.75.0"
license = "Apache-2.0"
version.workspace = true
authors.workspace = true
repository.workspace = true
readme.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
keywords = ["kubernetes", "apimachinery"]
categories = ["api-bindings", "encoding", "parser-implementations"]
repository = "https://github.com/kube-rs/kube"
readme = "../README.md"

[package.metadata.docs.rs]
features = ["ws", "admission", "jsonpatch", "k8s-openapi/latest"]
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true

[features]
ws = []
admission = ["json-patch"]
Expand Down
2 changes: 0 additions & 2 deletions kube-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
//! Everything in this crate is re-exported from [`kube`](https://crates.io/crates/kube)
//! (even with zero features) under [`kube::core`]((https://docs.rs/kube/*/kube/core/index.html)).
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]
#![forbid(unsafe_code)]

#[cfg_attr(docsrs, doc(cfg(feature = "admission")))]
#[cfg(feature = "admission")]
Expand Down
19 changes: 9 additions & 10 deletions kube-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
[package]
name = "kube-derive"
description = "Custom derives for the kube kubernetes crates"
version = "0.88.1"
authors = [
"clux <[email protected]>",
"kazk <[email protected]>",
]
edition = "2021"
rust-version = "1.75.0"
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube"
readme = "../README.md"
version.workspace = true
authors.workspace = true
repository.workspace = true
readme.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
keywords = ["kubernetes", "macro", "customresource", "crd"]
categories = ["api-bindings", "encoding"]

[lints]
workspace = true

[dependencies]
proc-macro2.workspace = true
Expand Down
2 changes: 0 additions & 2 deletions kube-derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! A crate for kube's derive macros.
#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![recursion_limit = "1024"]
extern crate proc_macro;
#[macro_use] extern crate quote;
Expand Down
25 changes: 14 additions & 11 deletions kube-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
[package]
name = "kube-runtime"
version = "0.88.1"
description = "Kubernetes futures controller runtime"
authors = [
"Natalie Klestrup Röijezon <[email protected]>",
"clux <[email protected]>",
]
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube"
readme = "../README.md"
description = "Kubernetes controller runtime"
version.workspace = true
authors.workspace = true
repository.workspace = true
readme.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
keywords = ["kubernetes", "runtime", "reflector", "watcher", "controller"]
categories = ["web-programming::http-client", "caching", "network-programming"]
rust-version = "1.75.0"
edition = "2021"

[features]
unstable-runtime = ["unstable-runtime-subscribe", "unstable-runtime-predicates", "unstable-runtime-stream-control", "unstable-runtime-reconcile-on"]
Expand All @@ -26,6 +23,12 @@ features = ["k8s-openapi/latest", "unstable-runtime"]
# Define the configuration attribute `docsrs`. Used to enable `doc_cfg` feature.
rustdoc-args = ["--cfg", "docsrs"]

[lints]
#workspace = true
rust.unsafe_code = "forbid"
# TODO: make this pass and switch to workspace lints
#rust.missing_docs = "warn"

[dependencies]
futures.workspace = true
kube-client = { path = "../kube-client", version = "=0.88.1", default-features = false, features = ["jsonpatch", "client"] }
Expand Down
1 change: 0 additions & 1 deletion kube-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//! opinionated starting point that should be appropriate for simple operators, but all
//! components are designed to be usable á la carte if your operator doesn't quite fit that mold.
#![forbid(unsafe_code)]
#![deny(clippy::all)]
#![deny(clippy::pedantic)]
// Triggered by many derive macros (kube-derive, derivative)
Expand Down
21 changes: 10 additions & 11 deletions kube/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
[package]
name = "kube"
version = "0.88.1"
description = "Kubernetes client and async controller runtime"
authors = [
"clux <[email protected]>",
"Natalie Klestrup Röijezon <[email protected]>",
"kazk <[email protected]>",
]
license = "Apache-2.0"
repository = "https://github.com/kube-rs/kube"
readme = "../README.md"
version.workspace = true
authors.workspace = true
repository.workspace = true
readme.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
keywords = ["kubernetes", "client", "runtime", "cncf"]
categories = ["network-programming", "caching", "api-bindings", "configuration", "encoding"]
rust-version = "1.75.0"
edition = "2021"

[features]
default = ["client", "rustls-tls"]
Expand Down Expand Up @@ -45,6 +41,9 @@ features = ["client", "rustls-tls", "openssl-tls", "derive", "ws", "oauth", "jso
# Define the configuration attribute `docsrs`. Used to enable `doc_cfg` feature.
rustdoc-args = ["--cfg", "docsrs"]

[lints]
workspace = true

[dependencies]
kube-derive = { path = "../kube-derive", version = "=0.88.1", optional = true }
kube-core = { path = "../kube-core", version = "=0.88.1" }
Expand Down
2 changes: 0 additions & 2 deletions kube/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@
//! # Examples
//! A large list of complete, runnable examples with explainations are available in the [examples folder](https://github.com/kube-rs/kube/tree/main/examples).
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]
#![forbid(unsafe_code)]

macro_rules! cfg_client {
($($item:item)*) => {
Expand Down

0 comments on commit 2ff3a2d

Please sign in to comment.