File tree 2 files changed +14
-5
lines changed
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1
1
use mullvad_version:: { PreStableType , Version } ;
2
+ use std:: env:: VarError ;
2
3
use std:: { env, process:: exit} ;
3
4
4
5
const ANDROID_VERSION : & str = include_str ! ( concat!( env!( "OUT_DIR" ) , "/android-version-name.txt" ) ) ;
5
6
6
7
fn main ( ) {
8
+ let android_version_env = env:: var ( "ANDROID_VERSION" ) ;
9
+ if matches ! ( android_version_env, Err ( VarError :: NotUnicode ( _) ) ) {
10
+ eprintln ! ( "ANDROID_VERSION is not valid unicode." ) ;
11
+ exit ( 1 ) ;
12
+ }
13
+ let android_version = android_version_env. unwrap_or ( ANDROID_VERSION . to_string ( ) ) ;
14
+
7
15
let command = env:: args ( ) . nth ( 1 ) ;
8
16
match command. as_deref ( ) {
9
17
None => println ! ( "{}" , mullvad_version:: VERSION ) ,
10
18
Some ( "semver" ) => println ! ( "{}" , to_semver( mullvad_version:: VERSION ) ) ,
11
19
Some ( "version.h" ) => println ! ( "{}" , to_windows_h_format( mullvad_version:: VERSION ) ) ,
12
- Some ( "versionName" ) => println ! ( "{ANDROID_VERSION }" ) ,
13
- Some ( "versionCode" ) => println ! ( "{}" , to_android_version_code( ANDROID_VERSION ) ) ,
20
+ Some ( "versionName" ) => println ! ( "{android_version }" ) ,
21
+ Some ( "versionCode" ) => println ! ( "{}" , to_android_version_code( & android_version ) ) ,
14
22
Some ( command) => {
15
23
eprintln ! ( "Unknown command: {command}" ) ;
16
24
exit ( 1 ) ;
Original file line number Diff line number Diff line change 74
74
75
75
if [[ " $ANDROID " == " true" ]]; then
76
76
echo " $PRODUCT_VERSION " > dist-assets/android-version-name.txt
77
+ ANDROID_VERSION=" $PRODUCT_VERSION " cargo run -q --bin mullvad-version versionCode > \
78
+ dist-assets/android-version-code.txt
77
79
git commit -S -m " Update android app version to $PRODUCT_VERSION " \
78
- dist-assets/android-version-name.txt
79
- cargo run -q --bin mullvad-version versionCode > dist-assets/android-version-code.txt
80
- git commit -S --amend --no-edit dist-assets/android-version-code.txt
80
+ dist-assets/android-version-name.txt \
81
+ dist-assets/android-version-code.txt
81
82
fi
82
83
83
84
NEW_TAGS=" "
You can’t perform that action at this time.
0 commit comments