Skip to content

[Merged by Bors] - Changes to be compatible with crate2nix #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion rust/operator-binary/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
use std::path::PathBuf;

fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
let out_dir = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR is required"));
built::write_built_file_with_opts(
// built's env module depends on a whole bunch of variables that crate2nix doesn't provide
// so we grab the specific env variables that we care about out ourselves instead.
built::Options::default().set_env(false),
"Cargo.toml".as_ref(),
&out_dir.join("built.rs"),
)
.unwrap();
}
32 changes: 17 additions & 15 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
mod config;
mod controller;
mod product_logging;

use crate::controller::CONTROLLER_NAME;

use std::sync::Arc;

use clap::Parser;
use clap::{crate_description, crate_version, Parser};
use futures::stream::StreamExt;
use stackable_nifi_crd::{
authentication::{NifiAuthenticationConfig, NifiAuthenticationMethod},
NifiCluster,
};
use stackable_operator::{
cli::{Command, ProductOperatorRun},
commons::authentication::AuthenticationClass,
Expand All @@ -28,14 +18,26 @@ use stackable_operator::{
CustomResourceExt,
};

use stackable_nifi_crd::{
authentication::{NifiAuthenticationConfig, NifiAuthenticationMethod},
NifiCluster,
};

use crate::controller::CONTROLLER_NAME;

mod config;
mod controller;
mod product_logging;

const OPERATOR_NAME: &str = "nifi.stackable.tech";

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

#[derive(Parser)]
#[clap(about = built_info::PKG_DESCRIPTION, author = "Stackable GmbH - [email protected]")]
#[clap(about, author)]
struct Opts {
#[clap(subcommand)]
cmd: Command,
Expand All @@ -57,10 +59,10 @@ async fn main() -> anyhow::Result<()> {
tracing_target,
);
stackable_operator::utils::print_startup_string(
built_info::PKG_DESCRIPTION,
built_info::PKG_VERSION,
crate_description!(),
crate_version!(),
built_info::GIT_VERSION,
built_info::TARGET,
built_info::TARGET_PLATFORM.unwrap_or("unknown target"),
built_info::BUILT_TIME_UTC,
built_info::RUSTC_VERSION,
);
Expand Down