Skip to content

Commit ab8680e

Browse files
committed
fix: Fix multiple compilation failures when not enabling default features
1 parent 2ba637e commit ab8680e

6 files changed

Lines changed: 114 additions & 31 deletions

File tree

.pre-commit-config.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,30 @@ repos:
5555
pass_filenames: false
5656
files: \.rs$|Cargo\.(toml|lock)
5757

58+
- id: cargo-doc-no-default-features
59+
name: cargo-doc-no-default-features
60+
language: system
61+
entry: cargo doc --no-default-features --document-private-items
62+
stages: [pre-commit, pre-merge-commit]
63+
pass_filenames: false
64+
files: \.rs$|Cargo\.(toml|lock)
65+
66+
- id: cargo-doc-all-features
67+
name: cargo-doc-all-features
68+
language: system
69+
entry: cargo doc --all-features --document-private-items
70+
stages: [pre-commit, pre-merge-commit]
71+
pass_filenames: false
72+
files: \.rs$|Cargo\.(toml|lock)
73+
74+
- id: cargo-test
75+
name: cargo-test
76+
language: system
77+
entry: cargo test --workspace
78+
stages: [pre-commit, pre-merge-commit]
79+
pass_filenames: false
80+
files: \.rs$|Cargo\.(toml|lock)
81+
5882
- id: cargo-test-no-default-features
5983
name: cargo-test-no-default-features
6084
language: system
@@ -71,6 +95,78 @@ repos:
7195
pass_filenames: false
7296
files: \.rs$|Cargo\.(toml|lock)
7397

98+
- id: cargo-test-k8s-version-no-default-features
99+
name: cargo-test-k8s-version-no-default-features
100+
language: system
101+
entry: cargo test --no-default-features --package k8s-version
102+
stages: [pre-commit, pre-merge-commit]
103+
pass_filenames: false
104+
files: \.rs$|Cargo\.(toml|lock)
105+
106+
- id: cargo-test-stackable-certs-no-default-features
107+
name: cargo-test-stackable-certs-no-default-features
108+
language: system
109+
entry: cargo test --no-default-features --package stackable-certs
110+
stages: [pre-commit, pre-merge-commit]
111+
pass_filenames: false
112+
files: \.rs$|Cargo\.(toml|lock)
113+
114+
- id: cargo-test-stackable-operator-no-default-features
115+
name: cargo-test-stackable-operator-no-default-features
116+
language: system
117+
entry: cargo test --no-default-features --package stackable-operator
118+
stages: [pre-commit, pre-merge-commit]
119+
pass_filenames: false
120+
files: \.rs$|Cargo\.(toml|lock)
121+
122+
- id: cargo-test-stackable-operator-derive-no-default-features
123+
name: cargo-test-stackable-operator-derive-no-default-features
124+
language: system
125+
entry: cargo test --no-default-features --package stackable-operator-derive
126+
stages: [pre-commit, pre-merge-commit]
127+
pass_filenames: false
128+
files: \.rs$|Cargo\.(toml|lock)
129+
130+
- id: cargo-test-stackable-shared-no-default-features
131+
name: cargo-test-stackable-shared-no-default-features
132+
language: system
133+
entry: cargo test --no-default-features --package stackable-shared
134+
stages: [pre-commit, pre-merge-commit]
135+
pass_filenames: false
136+
files: \.rs$|Cargo\.(toml|lock)
137+
138+
- id: cargo-test-stackable-telemetry-no-default-features
139+
name: cargo-test-stackable-telemetry-no-default-features
140+
language: system
141+
entry: cargo test --no-default-features --package stackable-telemetry
142+
stages: [pre-commit, pre-merge-commit]
143+
pass_filenames: false
144+
files: \.rs$|Cargo\.(toml|lock)
145+
146+
- id: cargo-test-stackable-versioned-no-default-features
147+
name: cargo-test-stackable-versioned-no-default-features
148+
language: system
149+
entry: cargo test --no-default-features --package stackable-versioned
150+
stages: [pre-commit, pre-merge-commit]
151+
pass_filenames: false
152+
files: \.rs$|Cargo\.(toml|lock)
153+
154+
- id: cargo-test-stackable-versioned-macros-no-default-features
155+
name: cargo-test-stackable-versioned-macros-no-default-features
156+
language: system
157+
entry: cargo test --no-default-features --package stackable-versioned-macros
158+
stages: [pre-commit, pre-merge-commit]
159+
pass_filenames: false
160+
files: \.rs$|Cargo\.(toml|lock)
161+
162+
- id: cargo-test-stackable-webhook-no-default-features
163+
name: cargo-test-stackable-webhook-no-default-features
164+
language: system
165+
entry: cargo test --no-default-features --package stackable-webhook
166+
stages: [pre-commit, pre-merge-commit]
167+
pass_filenames: false
168+
files: \.rs$|Cargo\.(toml|lock)
169+
74170
- id: cargo-rustfmt
75171
name: cargo-rustfmt
76172
language: system

crates/stackable-operator/Cargo.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@ edition.workspace = true
88
repository.workspace = true
99

1010
[features]
11-
full = ["certs", "telemetry", "versioned", "time", "webhook", "clap"]
12-
default = ["telemetry", "versioned", "clap"]
11+
full = ["certs", "time", "webhook"]
1312

14-
clap = []
1513
certs = ["dep:stackable-certs"]
16-
telemetry = ["dep:stackable-telemetry"]
1714
time = ["stackable-shared/time"]
18-
versioned = ["dep:stackable-versioned"]
1915
webhook = ["dep:stackable-webhook"]
2016

2117
[dependencies]
2218
stackable-certs = { path = "../stackable-certs", optional = true }
2319
stackable-operator-derive = { path = "../stackable-operator-derive" }
24-
stackable-shared = { path = "../stackable-shared", features = ["time", "jiff"] }
25-
stackable-telemetry = { path = "../stackable-telemetry", optional = true, features = ["clap"] }
26-
stackable-versioned = { path = "../stackable-versioned", optional = true }
20+
stackable-shared = { path = "../stackable-shared", features = ["jiff"] }
21+
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] }
22+
stackable-versioned = { path = "../stackable-versioned" }
2723
stackable-webhook = { path = "../stackable-webhook", optional = true }
2824

2925
clap.workspace = true

crates/stackable-operator/src/eos/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,34 @@ use tracing::{Level, instrument};
99
///
1010
/// Additionally, this struct can be used as operator CLI arguments. This functionality is only
1111
/// available if the feature `clap` is enabled.
12-
#[cfg_attr(feature = "clap", derive(clap::Args))]
13-
#[derive(Debug, PartialEq, Eq)]
12+
#[derive(Debug, PartialEq, Eq, clap::Args)]
1413
pub struct EndOfSupportOptions {
1514
/// The end-of-support check mode. Currently, only "offline" is supported.
16-
#[cfg_attr(feature = "clap", arg(
15+
#[arg(
1716
long = "eos-check-mode",
1817
env = "EOS_CHECK_MODE",
1918
default_value_t = EndOfSupportCheckMode::default(),
2019
value_enum
21-
))]
20+
)]
2221
pub check_mode: EndOfSupportCheckMode,
2322

2423
/// The interval in which the end-of-support check should run.
25-
#[cfg_attr(feature = "clap", arg(
24+
#[arg(
2625
long = "eos-interval",
2726
env = "EOS_INTERVAL",
2827
default_value_t = Self::default_interval()
29-
))]
28+
)]
3029
pub interval: Duration,
3130

3231
/// If the end-of-support check should be disabled entirely.
33-
#[cfg_attr(feature = "clap", arg(long = "eos-disabled", env = "EOS_DISABLED"))]
32+
#[arg(long = "eos-disabled", env = "EOS_DISABLED")]
3433
pub disabled: bool,
3534

3635
/// The support duration (how long the operator should be considered supported after
3736
/// it's built-date).
3837
///
3938
/// This field is currently not exposed as a CLI argument or environment variable.
40-
#[cfg_attr(feature = "clap", arg(skip = Self::default_support_duration()))]
39+
#[arg(skip = Self::default_support_duration())]
4140
pub support_duration: Duration,
4241
}
4342

@@ -55,8 +54,7 @@ impl EndOfSupportOptions {
5554
}
5655
}
5756

58-
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
59-
#[derive(Clone, Debug, Default, PartialEq, Eq)]
57+
#[derive(Clone, Debug, Default, PartialEq, Eq, clap::ValueEnum)]
6058
pub enum EndOfSupportCheckMode {
6159
#[default]
6260
Offline,

crates/stackable-operator/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ pub use schemars;
4242
pub use stackable_certs as certs;
4343
pub use stackable_shared as shared;
4444
pub use stackable_shared::{crd::CustomResourceExt, yaml::YamlSchema};
45-
#[cfg(feature = "telemetry")]
4645
pub use stackable_telemetry as telemetry;
47-
#[cfg(feature = "versioned")]
4846
pub use stackable_versioned as versioned;
4947
#[cfg(feature = "webhook")]
5048
pub use stackable_webhook as webhook;

crates/stackable-operator/src/utils/cluster_info.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,21 @@ pub struct KubernetesClusterInfo {
1515
pub cluster_domain: DomainName,
1616
}
1717

18-
#[cfg_attr(
19-
feature = "clap",
20-
derive(clap::Parser),
21-
command(next_help_heading = "Cluster Options")
22-
)]
18+
#[derive(clap::Parser)]
19+
#[command(next_help_heading = "Cluster Options")]
2320
#[derive(Debug, PartialEq, Eq)]
2421
pub struct KubernetesClusterInfoOptions {
2522
/// Kubernetes cluster domain, usually this is `cluster.local`.
2623
// We are not using a default value here, as we query the cluster if it is not specified.
27-
#[cfg_attr(feature = "clap", arg(long, env))]
24+
#[arg(long, env)]
2825
pub kubernetes_cluster_domain: Option<DomainName>,
2926

3027
/// Name of the Kubernetes Node that the operator is running on.
3128
///
3229
/// Note that when running the operator on Kubernetes we recommend to use the
3330
/// [downward API](https://kubernetes.io/docs/concepts/workloads/pods/downward-api/)
3431
/// to let Kubernetes project the namespace as the `KUBERNETES_NODE_NAME` env variable.
35-
#[cfg_attr(feature = "clap", arg(long, env))]
32+
#[arg(long, env)]
3633
pub kubernetes_node_name: String,
3734
}
3835

crates/stackable-telemetry/src/tracing/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
99
use std::{ops::Not, path::PathBuf};
1010

11-
#[cfg_attr(feature = "clap", cfg(doc))]
12-
use clap;
1311
use opentelemetry::trace::TracerProvider;
1412
use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge;
1513
use opentelemetry_otlp::{ExporterBuildError, LogExporter, SpanExporter};
@@ -125,7 +123,7 @@ pub enum Error {
125123
/// ```
126124
///
127125
/// Also see the documentation for [`TelemetryOptions`] which details how it can be used as CLI
128-
/// arguments via [`clap`]. Additionally see [this section](#environment-variables-and-cli-arguments)
126+
/// arguments via `clap`. Additionally see [this section](#environment-variables-and-cli-arguments)
129127
/// in the docs for a full list of environment variables and CLI arguments used by the pre-configured
130128
/// instance.
131129
///
@@ -148,7 +146,7 @@ pub enum Error {
148146
///
149147
/// #[tokio::main]
150148
/// async fn main() -> Result<(), Error> {
151-
/// // This can come from a Clap argument for example. The enabled builder
149+
/// // This can come from a `clap` argument for example. The enabled builder
152150
/// // function below allows enabling/disabling certain subscribers during
153151
/// // runtime.
154152
/// let otlp_log_flag = false;

0 commit comments

Comments
 (0)