Skip to content

Commit bdf68de

Browse files
committed
Add version to installer-downloader
1 parent df2730b commit bdf68de

File tree

7 files changed

+27
-17
lines changed

7 files changed

+27
-17
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

installer-downloader/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "installer-downloader"
33
description = "A secure minimal web installer for the Mullvad app"
4+
version = "1.0.0"
45
authors.workspace = true
56
repository.workspace = true
67
license.workspace = true

installer-downloader/assets/Info.plist

+3-9
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,18 @@
66
<string>English</string>
77
<key>CFBundleExecutable</key>
88
<string>installer-downloader</string>
9-
<key>CFBundleGetInfoString</key>
10-
<string></string>
119
<key>CFBundleIconFile</key>
1210
<string>icon.icns</string>
1311
<key>CFBundleIdentifier</key>
14-
<string>net.mullvad.MullvadVPNInstaller</string>
12+
<string>%BUNDLE_ID%</string>
1513
<key>CFBundleInfoDictionaryVersion</key>
1614
<string>6.0</string>
17-
<key>CFBundleLongVersionString</key>
18-
<string></string>
1915
<key>CFBundleName</key>
20-
<string>net.mullvad.MullvadVPNInstaller</string>
16+
<string>%BUNDLE_NAME%</string>
2117
<key>CFBundlePackageType</key>
2218
<string>APPL</string>
23-
<key>CFBundleShortVersionString</key>
24-
<string>0.1</string>
2519
<key>CFBundleVersion</key>
26-
<string></string>
20+
<string>%BUNDLE_VERSION%</string>
2721
<key>CSResourcesFileMapped</key>
2822
<true/>
2923
<key>LSRequiresCarbon</key>

installer-downloader/build.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ use anyhow::Context;
22
use std::env;
33

44
fn main() -> anyhow::Result<()> {
5-
if cfg!(debug_assertions) {
6-
return Ok(());
7-
}
8-
95
let target_os = env::var("CARGO_CFG_TARGET_OS").context("Missing 'CARGO_CFG_TARGET_OS")?;
106
match target_os.as_str() {
117
"windows" => win_main(),
@@ -23,8 +19,10 @@ fn win_main() -> anyhow::Result<()> {
2319
windows_sys::Win32::System::SystemServices::SUBLANG_ENGLISH_US as u16,
2420
));
2521

26-
println!("cargo:rerun-if-changed=loader.manifest");
27-
res.set_manifest_file("loader.manifest");
22+
if !cfg!(debug_assertions) {
23+
println!("cargo:rerun-if-changed=loader.manifest");
24+
res.set_manifest_file("loader.manifest");
25+
}
2826
res.set_icon("../dist-assets/icon.ico");
2927

3028
res.compile().context("Failed to compile resources")

installer-downloader/build.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ function assert_can_sign {
8787
fi
8888
}
8989

90+
# Get the project version (specified in Cargo.toml).
91+
# This outputs string such as 1.0.0.
92+
function product_version {
93+
sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml
94+
}
95+
9096
# Run cargo with all appropriate flags and options
9197
# Arguments:
9298
# - (optional) target
@@ -212,7 +218,13 @@ function dist_macos_app {
212218

213219
mkdir -p "$app_path/Contents/MacOS"
214220

215-
cp ./assets/Info.plist "$app_path/Contents/Info.plist"
221+
# Generate info plist, using the version specified in Cargo.toml
222+
sed -e "s/%BUNDLE_VERSION%/$(product_version)/g" \
223+
-e "s/%BUNDLE_NAME%/$BUNDLE_NAME/g" \
224+
-e "s/%BUNDLE_ID%/$BUNDLE_ID/g" \
225+
./assets/Info.plist > "$app_path/Contents/Info.plist"
226+
227+
# Copy executable
216228
cp "$BUILD_DIR/installer-downloader" "$app_path/Contents/MacOS/installer-downloader"
217229

218230
# Sign app bundle

installer-downloader/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ mod inner {
1616
pub fn run() {
1717
log::init().expect("failed to set up logger");
1818

19+
::log::debug!("Installer downloader version: {}", resource::VERSION);
20+
1921
let rt = tokio::runtime::Builder::new_multi_thread()
2022
.enable_all()
2123
.build()

installer-downloader/src/resource.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//! Shared text and other resources
22
3+
/// Installer downloader version
4+
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
5+
36
/// Window title
47
pub const WINDOW_TITLE: &str = "Mullvad VPN installer";
58
/// Window width

0 commit comments

Comments
 (0)