File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: Apache-2.0
2+ // SPDX-FileCopyrightText: Copyright the Vortex contributors
3+
4+ fn main ( ) {
5+ // Rerun if git HEAD changes
6+ println ! ( "cargo::rerun-if-changed=../.git/HEAD" ) ;
7+ println ! ( "cargo::rerun-if-changed=../.git/refs/tags" ) ;
8+
9+ // Try to get version from git describe
10+ if let Ok ( output) = std:: process:: Command :: new ( "git" )
11+ . args ( [ "describe" , "--tags" , "--always" ] )
12+ . output ( )
13+ && output. status . success ( )
14+ {
15+ let version = String :: from_utf8_lossy ( & output. stdout ) ;
16+ println ! ( "cargo::rustc-env=VX_VERSION={}" , version. trim( ) ) ;
17+ }
18+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ use vortex::session::VortexSession;
2323use crate :: inspect:: InspectArgs ;
2424
2525#[ derive( clap:: Parser ) ]
26+ #[ command( version = option_env!( "VX_VERSION" ) . unwrap_or( env!( "CARGO_PKG_VERSION" ) ) ) ]
2627struct Cli {
2728 #[ clap( subcommand) ]
2829 command : Commands ,
You can’t perform that action at this time.
0 commit comments