File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change
1
+ use std:: path:: PathBuf ;
2
+
1
3
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 ( ) ;
3
13
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ mod product_logging;
5
5
6
6
use crate :: controller:: HIVE_CONTROLLER_NAME ;
7
7
8
- use clap:: Parser ;
8
+ use clap:: { crate_description , crate_version , Parser } ;
9
9
use futures:: stream:: StreamExt ;
10
10
use stackable_hive_crd:: { HiveCluster , APP_NAME } ;
11
11
use stackable_operator:: {
@@ -22,12 +22,13 @@ use std::sync::Arc;
22
22
23
23
mod built_info {
24
24
include ! ( concat!( env!( "OUT_DIR" ) , "/built.rs" ) ) ;
25
+ pub const TARGET_PLATFORM : Option < & str > = option_env ! ( "TARGET" ) ;
25
26
}
26
27
27
28
const OPERATOR_NAME : & str = "hive.stackable.tech" ;
28
29
29
30
#[ derive( Parser ) ]
30
- #[ clap( about = built_info :: PKG_DESCRIPTION , author = stackable_operator :: cli :: AUTHOR ) ]
31
+ #[ clap( about, author) ]
31
32
struct Opts {
32
33
#[ clap( subcommand) ]
33
34
cmd : Command ,
@@ -49,10 +50,10 @@ async fn main() -> anyhow::Result<()> {
49
50
tracing_target,
50
51
) ;
51
52
stackable_operator:: utils:: print_startup_string (
52
- built_info :: PKG_DESCRIPTION ,
53
- built_info :: PKG_VERSION ,
53
+ crate_description ! ( ) ,
54
+ crate_version ! ( ) ,
54
55
built_info:: GIT_VERSION ,
55
- built_info:: TARGET ,
56
+ built_info:: TARGET_PLATFORM . unwrap_or ( "unknown target" ) ,
56
57
built_info:: BUILT_TIME_UTC ,
57
58
built_info:: RUSTC_VERSION ,
58
59
) ;
You can’t perform that action at this time.
0 commit comments