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 @@ -6,7 +6,7 @@ mod product_logging;
6
6
7
7
use crate :: controller:: { CONTROLLER_NAME , OPERATOR_NAME } ;
8
8
9
- use clap:: Parser ;
9
+ use clap:: { crate_description , crate_version , Parser } ;
10
10
use futures:: stream:: StreamExt ;
11
11
use stackable_operator:: {
12
12
cli:: { Command , ProductOperatorRun } ,
@@ -27,10 +27,11 @@ use std::sync::Arc;
27
27
28
28
mod built_info {
29
29
include ! ( concat!( env!( "OUT_DIR" ) , "/built.rs" ) ) ;
30
+ pub const TARGET_PLATFORM : Option < & str > = option_env ! ( "TARGET" ) ;
30
31
}
31
32
32
33
#[ derive( Parser ) ]
33
- #[ clap( about = built_info :: PKG_DESCRIPTION , author = stackable_operator :: cli :: AUTHOR ) ]
34
+ #[ clap( about, author) ]
34
35
struct Opts {
35
36
#[ clap( subcommand) ]
36
37
cmd : Command ,
@@ -55,10 +56,10 @@ async fn main() -> anyhow::Result<()> {
55
56
tracing_target,
56
57
) ;
57
58
stackable_operator:: utils:: print_startup_string (
58
- built_info :: PKG_DESCRIPTION ,
59
- built_info :: PKG_VERSION ,
59
+ crate_description ! ( ) ,
60
+ crate_version ! ( ) ,
60
61
built_info:: GIT_VERSION ,
61
- built_info:: TARGET ,
62
+ built_info:: TARGET_PLATFORM . unwrap_or ( "unknown target" ) ,
62
63
built_info:: BUILT_TIME_UTC ,
63
64
built_info:: RUSTC_VERSION ,
64
65
) ;
You can’t perform that action at this time.
0 commit comments