Skip to content

Commit 743d408

Browse files
soenkeliebaurazvan
andcommitted
Changes to be compatible with crate2nix (#234)
see stackabletech/operator-templating#212 for more details Co-authored-by: Razvan-Daniel Mihai <[email protected]>
1 parent 845d93a commit 743d408

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
### Changed
1010

1111
- `operator-rs` `0.31.0` -> `0.34.0` ([#219]).
12+
- Revert openshift settings ([#233])
13+
- Support crate2nix in dev environments ([#234])
14+
15+
[#219]: https://github.com/stackabletech/airflow-operator/pull/219
16+
[#233]: https://github.com/stackabletech/spark-k8s-operator/pull/233
17+
[#234]: https://github.com/stackabletech/spark-k8s-operator/pull/234
18+
19+
## [23.1.0] - 2023-01-23
20+
21+
### Changed
22+
1223
- Specified security context settings needed for OpenShift ([#222]).
1324
- Fixed template parsing for OpenShift tests ([#222]).
1425
- Revert openshift settings ([#233])

rust/operator-binary/build.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
use std::path::PathBuf;
2+
13
fn main() {
2-
built::write_built_file().expect("Failed to acquire build-time information");
4+
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is required"));
5+
built::write_built_file_with_opts(
6+
// built's env module depends on a whole bunch of variables that crate2nix doesn't provide
7+
// so we grab the specific env variables that we care about out ourselves instead.
8+
built::Options::default().set_env(false),
9+
"Cargo.toml".as_ref(),
10+
&out_dir.join("built.rs"),
11+
)
12+
.unwrap();
313
}

rust/operator-binary/src/main.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod util;
88

99
use crate::airflow_controller::AIRFLOW_CONTROLLER_NAME;
1010

11-
use clap::Parser;
11+
use clap::{crate_description, crate_version, Parser};
1212
use futures::StreamExt;
1313
use stackable_airflow_crd::{
1414
airflowdb::{AirflowDB, AIRFLOW_DB_CONTROLLER_NAME},
@@ -34,10 +34,11 @@ use std::sync::Arc;
3434

3535
mod built_info {
3636
include!(concat!(env!("OUT_DIR"), "/built.rs"));
37+
pub const TARGET_PLATFORM: Option<&str> = option_env!("TARGET");
3738
}
3839

3940
#[derive(Parser)]
40-
#[clap(about = built_info::PKG_DESCRIPTION, author = stackable_operator::cli::AUTHOR)]
41+
#[clap(about, author)]
4142
struct Opts {
4243
#[clap(subcommand)]
4344
cmd: Command,
@@ -63,10 +64,10 @@ async fn main() -> anyhow::Result<()> {
6364
tracing_target,
6465
);
6566
stackable_operator::utils::print_startup_string(
66-
built_info::PKG_DESCRIPTION,
67-
built_info::PKG_VERSION,
67+
crate_description!(),
68+
crate_version!(),
6869
built_info::GIT_VERSION,
69-
built_info::TARGET,
70+
built_info::TARGET_PLATFORM.unwrap_or("unknown target"),
7071
built_info::BUILT_TIME_UTC,
7172
built_info::RUSTC_VERSION,
7273
);

0 commit comments

Comments
 (0)