-
Notifications
You must be signed in to change notification settings - Fork 2
Changes to be compatible with crate2nix #143
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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(); | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ mod restart_controller; | |||||||||||||||||||
use futures::pin_mut; | ||||||||||||||||||||
use stackable_operator::cli::{Command, ProductOperatorRun}; | ||||||||||||||||||||
|
||||||||||||||||||||
use clap::Parser; | ||||||||||||||||||||
use clap::{crate_description, crate_version, Parser}; | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We get this info from built_info. Is there a difference? |
||||||||||||||||||||
use stackable_operator::commons::{ | ||||||||||||||||||||
authentication::AuthenticationClass, | ||||||||||||||||||||
s3::{S3Bucket, S3Connection}, | ||||||||||||||||||||
|
@@ -13,10 +13,11 @@ use stackable_operator::CustomResourceExt; | |||||||||||||||||||
|
||||||||||||||||||||
mod built_info { | ||||||||||||||||||||
include!(concat!(env!("OUT_DIR"), "/built.rs")); | ||||||||||||||||||||
pub const TARGET_PLATFORM: Option<&str> = option_env!("TARGET"); | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. built_info seems to already export TARGET. But maybe that's different to what you want here? See:
|
||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
#[derive(Parser)] | ||||||||||||||||||||
#[clap(about = built_info::PKG_DESCRIPTION, author = stackable_operator::cli::AUTHOR)] | ||||||||||||||||||||
#[clap(about, author)] | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already done:
|
||||||||||||||||||||
struct Opts { | ||||||||||||||||||||
#[clap(subcommand)] | ||||||||||||||||||||
cmd: Command, | ||||||||||||||||||||
|
@@ -42,10 +43,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"), | ||||||||||||||||||||
Comment on lines
+46
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The print_startup_string function is superseded by commons-operator/rust/operator-binary/src/main.rs Lines 58 to 66 in c276cec
|
||||||||||||||||||||
built_info::BUILT_TIME_UTC, | ||||||||||||||||||||
built_info::RUSTC_VERSION, | ||||||||||||||||||||
); | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh. This might make my comments useless. But who knows, maybe it works now?