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 @@ -4,7 +4,7 @@ mod spark_k8s_controller;
4
4
5
5
use std:: sync:: Arc ;
6
6
7
- use clap:: Parser ;
7
+ use clap:: { crate_description , crate_version , Parser } ;
8
8
use futures:: StreamExt ;
9
9
use stackable_operator:: cli:: { Command , ProductOperatorRun } ;
10
10
use stackable_operator:: k8s_openapi:: api:: apps:: v1:: StatefulSet ;
@@ -24,10 +24,11 @@ use tracing_futures::Instrument;
24
24
25
25
mod built_info {
26
26
include ! ( concat!( env!( "OUT_DIR" ) , "/built.rs" ) ) ;
27
+ pub const TARGET_PLATFORM : Option < & str > = option_env ! ( "TARGET" ) ;
27
28
}
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 ,
@@ -52,10 +53,10 @@ async fn main() -> anyhow::Result<()> {
52
53
tracing_target,
53
54
) ;
54
55
stackable_operator:: utils:: print_startup_string (
55
- built_info :: PKG_DESCRIPTION ,
56
- built_info :: PKG_VERSION ,
56
+ crate_description ! ( ) ,
57
+ crate_version ! ( ) ,
57
58
built_info:: GIT_VERSION ,
58
- built_info:: TARGET ,
59
+ built_info:: TARGET_PLATFORM . unwrap_or ( "unknown target" ) ,
59
60
built_info:: BUILT_TIME_UTC ,
60
61
built_info:: RUSTC_VERSION ,
61
62
) ;
You can’t perform that action at this time.
0 commit comments