Skip to content

Commit b8acc74

Browse files
committed
Merge branch 'add-support-for-overriding-the-versionname-used-to-generate-droid-1692'
2 parents 2c47294 + 35be6c3 commit b8acc74

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

mullvad-version/src/main.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
use mullvad_version::{PreStableType, Version};
2+
use std::env::VarError;
23
use std::{env, process::exit};
34

45
const ANDROID_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/android-version-name.txt"));
56

67
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+
715
let command = env::args().nth(1);
816
match command.as_deref() {
917
None => println!("{}", mullvad_version::VERSION),
1018
Some("semver") => println!("{}", to_semver(mullvad_version::VERSION)),
1119
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)),
1422
Some(command) => {
1523
eprintln!("Unknown command: {command}");
1624
exit(1);

prepare-release.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ fi
7474

7575
if [[ "$ANDROID" == "true" ]]; then
7676
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
7779
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
8182
fi
8283

8384
NEW_TAGS=""

0 commit comments

Comments
 (0)