summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2022-10-10 12:34:12 +0200
committerLinus Färnstrand <linus@mullvad.net>2022-10-10 12:34:12 +0200
commit27470f46a55c478abe994dfa86646fad5dc3847e (patch)
tree51d75bf5b47aeed30dfa2078fe42fe580243903b
parentf334c2a84faaed748aeb857085e0754e189e4b2f (diff)
parentec7ea9fb689c6c3087ccbc4d37cbb786fff44895 (diff)
downloadmullvadvpn-27470f46a55c478abe994dfa86646fad5dc3847e.tar.xz
mullvadvpn-27470f46a55c478abe994dfa86646fad5dc3847e.zip
Merge branch 'improve-rust-crate-versioning'
-rw-r--r--.github/workflows/android-app.yml1
-rw-r--r--.github/workflows/daemon.yml1
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock58
-rw-r--r--Cargo.toml1
-rw-r--r--android/app/build.gradle.kts11
-rw-r--r--android/buildSrc/src/main/kotlin/Utils.kt20
-rwxr-xr-xbuild-apk.sh20
-rwxr-xr-xbuild.sh42
-rw-r--r--dist-assets/android-product-version.txt1
-rw-r--r--dist-assets/desktop-product-version.txt1
-rw-r--r--dist-assets/windows/version.h4
-rw-r--r--gui/package-lock.json4
-rw-r--r--gui/package.json2
-rw-r--r--gui/tasks/distribution.js27
-rw-r--r--mullvad-api/Cargo.toml2
-rw-r--r--mullvad-cli/Cargo.toml4
-rw-r--r--mullvad-cli/build.rs8
-rw-r--r--mullvad-cli/src/cmds/beta_program.rs4
-rw-r--r--mullvad-cli/src/main.rs3
-rw-r--r--mullvad-daemon/Cargo.toml4
-rw-r--r--mullvad-daemon/build.rs5
-rw-r--r--mullvad-daemon/src/cli.rs4
-rw-r--r--mullvad-daemon/src/lib.rs2
-rw-r--r--mullvad-daemon/src/version.rs7
-rw-r--r--mullvad-daemon/src/version_check.rs45
-rw-r--r--mullvad-exclude/Cargo.toml2
-rw-r--r--mullvad-jni/Cargo.toml2
-rw-r--r--mullvad-management-interface/Cargo.toml2
-rw-r--r--mullvad-paths/Cargo.toml2
-rw-r--r--mullvad-problem-report/Cargo.toml4
-rw-r--r--mullvad-problem-report/build.rs9
-rw-r--r--mullvad-problem-report/src/main.rs4
-rw-r--r--mullvad-problem-report/src/metadata.rs4
-rw-r--r--mullvad-relay-selector/Cargo.toml2
-rw-r--r--mullvad-setup/Cargo.toml3
-rw-r--r--mullvad-setup/build.rs7
-rw-r--r--mullvad-setup/src/main.rs6
-rw-r--r--mullvad-types/Cargo.toml2
-rw-r--r--mullvad-version/Cargo.toml17
-rw-r--r--mullvad-version/build.rs97
-rw-r--r--mullvad-version/src/lib.rs2
-rw-r--r--mullvad-version/src/main.rs97
-rwxr-xr-xprepare-release.sh39
-rw-r--r--talpid-core/Cargo.toml2
-rw-r--r--talpid-dbus/Cargo.toml2
-rw-r--r--talpid-openvpn-plugin/Cargo.toml3
-rw-r--r--talpid-openvpn-plugin/build.rs3
-rw-r--r--talpid-platform-metadata/Cargo.toml2
-rw-r--r--talpid-time/Cargo.toml2
-rw-r--r--talpid-tunnel-config-client/Cargo.toml2
-rw-r--r--talpid-types/Cargo.toml2
-rw-r--r--tunnel-obfuscation/Cargo.toml2
-rwxr-xr-xversion-metadata.sh172
-rw-r--r--windows/winfw/src/winfw/winfw.rc2
-rw-r--r--windows/winfw/src/winfw/winfw.vcxproj12
-rw-r--r--windows/winnet/src/winnet/winnet.rc2
-rw-r--r--windows/winnet/src/winnet/winnet.vcxproj18
58 files changed, 422 insertions, 387 deletions
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml
index 193f8f075f..8f4740de71 100644
--- a/.github/workflows/android-app.yml
+++ b/.github/workflows/android-app.yml
@@ -20,7 +20,6 @@ on:
- build-apk.sh
- update-api-metadata.sh
- update-version-metadata.sh
- - version-metadata.sh
# Build if requested manually from the Actions tab
workflow_dispatch:
jobs:
diff --git a/.github/workflows/daemon.yml b/.github/workflows/daemon.yml
index beae485ded..c6ef2f1fff 100644
--- a/.github/workflows/daemon.yml
+++ b/.github/workflows/daemon.yml
@@ -29,7 +29,6 @@ on:
- integration-tests.sh
- prepare-release.sh
- rustfmt.toml
- - version-metadata.sh
# Build if requested manually from the Actions tab
workflow_dispatch:
jobs:
diff --git a/.gitignore b/.gitignore
index 170e4589b4..8fbeebe0f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,6 +31,7 @@
/dist-assets/shell-completions/
/dist-assets/aarch64-apple-darwin/
/dist-assets/x86_64-apple-darwin/
+/windows/version.h
/windows/**/bin/
/windows/**/*.user
/android/keystore.properties
diff --git a/Cargo.lock b/Cargo.lock
index 5c144aabc8..77a447ec8b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1567,7 +1567,7 @@ dependencies = [
[[package]]
name = "mullvad-api"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"chrono",
"err-derive",
@@ -1593,7 +1593,7 @@ dependencies = [
[[package]]
name = "mullvad-cli"
-version = "2022.5.0-beta2"
+version = "0.0.0"
dependencies = [
"base64",
"chrono",
@@ -1606,6 +1606,7 @@ dependencies = [
"mullvad-management-interface",
"mullvad-paths",
"mullvad-types",
+ "mullvad-version",
"natord",
"serde",
"talpid-types",
@@ -1616,7 +1617,7 @@ dependencies = [
[[package]]
name = "mullvad-daemon"
-version = "2022.5.0-beta2"
+version = "0.0.0"
dependencies = [
"android_logger",
"cfg-if",
@@ -1639,6 +1640,7 @@ dependencies = [
"mullvad-paths",
"mullvad-relay-selector",
"mullvad-types",
+ "mullvad-version",
"nix 0.23.1",
"parking_lot 0.11.2",
"rand 0.8.5",
@@ -1662,7 +1664,7 @@ dependencies = [
[[package]]
name = "mullvad-exclude"
-version = "2022.5.0-beta2"
+version = "0.0.0"
dependencies = [
"err-derive",
"nix 0.23.1",
@@ -1671,7 +1673,7 @@ dependencies = [
[[package]]
name = "mullvad-jni"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"err-derive",
"futures",
@@ -1694,7 +1696,7 @@ dependencies = [
[[package]]
name = "mullvad-management-interface"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"chrono",
"err-derive",
@@ -1716,7 +1718,7 @@ dependencies = [
[[package]]
name = "mullvad-paths"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"dirs-next",
"err-derive",
@@ -1725,7 +1727,7 @@ dependencies = [
[[package]]
name = "mullvad-problem-report"
-version = "2022.5.0-beta2"
+version = "0.0.0"
dependencies = [
"clap",
"dirs-next",
@@ -1736,6 +1738,7 @@ dependencies = [
"log",
"mullvad-api",
"mullvad-paths",
+ "mullvad-version",
"regex",
"talpid-platform-metadata",
"talpid-types",
@@ -1747,7 +1750,7 @@ dependencies = [
[[package]]
name = "mullvad-relay-selector"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"chrono",
"err-derive",
@@ -1769,7 +1772,7 @@ dependencies = [
[[package]]
name = "mullvad-setup"
-version = "2022.5.0-beta2"
+version = "0.0.0"
dependencies = [
"clap",
"env_logger 0.8.4",
@@ -1780,6 +1783,7 @@ dependencies = [
"mullvad-management-interface",
"mullvad-paths",
"mullvad-types",
+ "mullvad-version",
"talpid-core",
"talpid-types",
"tokio",
@@ -1789,7 +1793,7 @@ dependencies = [
[[package]]
name = "mullvad-types"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"chrono",
"err-derive",
@@ -1804,6 +1808,13 @@ dependencies = [
]
[[package]]
+name = "mullvad-version"
+version = "0.0.0"
+dependencies = [
+ "regex",
+]
+
+[[package]]
name = "multimap"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2544,9 +2555,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.5.5"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
+checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
dependencies = [
"aho-corasick",
"memchr",
@@ -2555,9 +2566,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.6.25"
+version = "0.6.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
+checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
[[package]]
name = "remove_dir_all"
@@ -3089,7 +3100,7 @@ dependencies = [
[[package]]
name = "talpid-core"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"async-trait",
"atty",
@@ -3160,7 +3171,7 @@ dependencies = [
[[package]]
name = "talpid-dbus"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"dbus",
"err-derive",
@@ -3172,11 +3183,12 @@ dependencies = [
[[package]]
name = "talpid-openvpn-plugin"
-version = "2022.5.0-beta2"
+version = "0.0.0"
dependencies = [
"env_logger 0.8.4",
"err-derive",
"log",
+ "mullvad-version",
"openvpn-plugin",
"parity-tokio-ipc",
"prost",
@@ -3191,7 +3203,7 @@ dependencies = [
[[package]]
name = "talpid-platform-metadata"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"rs-release",
"talpid-dbus",
@@ -3200,7 +3212,7 @@ dependencies = [
[[package]]
name = "talpid-time"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"libc",
"tokio",
@@ -3208,7 +3220,7 @@ dependencies = [
[[package]]
name = "talpid-tunnel-config-client"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"classic-mceliece-rust",
"log",
@@ -3223,7 +3235,7 @@ dependencies = [
[[package]]
name = "talpid-types"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"base64",
"err-derive",
@@ -3688,7 +3700,7 @@ dependencies = [
[[package]]
name = "tunnel-obfuscation"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"async-trait",
"err-derive",
diff --git a/Cargo.toml b/Cargo.toml
index 209384de44..91fbf682aa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,6 +12,7 @@ members = [
"mullvad-types",
"mullvad-api",
"mullvad-exclude",
+ "mullvad-version",
"talpid-openvpn-plugin",
"talpid-core",
"talpid-dbus",
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index 44ea1f7f32..265e0666c0 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -28,8 +28,8 @@ android {
applicationId = "net.mullvad.mullvadvpn"
minSdkVersion(Versions.Android.minSdkVersion)
targetSdkVersion(Versions.Android.targetSdkVersion)
- versionCode = 22020002
- versionName = "2022.2-beta2"
+ versionCode = generateVersionCode()
+ versionName = generateVersionName()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -162,6 +162,13 @@ tasks.register("ensureJniDirectoryExist") {
}
}
+tasks.create("printVersion") {
+ doLast {
+ println("versionCode=${project.android.defaultConfig.versionCode}")
+ println("versionName=${project.android.defaultConfig.versionName}")
+ }
+}
+
play {
serviceAccountCredentials = file("play-api-key.json")
}
diff --git a/android/buildSrc/src/main/kotlin/Utils.kt b/android/buildSrc/src/main/kotlin/Utils.kt
new file mode 100644
index 0000000000..96c44b78c2
--- /dev/null
+++ b/android/buildSrc/src/main/kotlin/Utils.kt
@@ -0,0 +1,20 @@
+import java.io.ByteArrayOutputStream
+import org.gradle.api.Project
+import org.gradle.process.ExecSpec
+
+fun Project.execWithOutput(spec: ExecSpec.() -> Unit) =
+ ByteArrayOutputStream().use { outputStream ->
+ exec {
+ this.spec()
+ this.standardOutput = outputStream
+ }
+ outputStream.toString().trim()
+ }
+
+fun Project.generateVersionCode() = execWithOutput {
+ commandLine("cargo", "run", "-q", "--bin", "mullvad-version", "versionCode")
+}.toInt()
+
+fun Project.generateVersionName() = execWithOutput {
+ commandLine("cargo", "run", "-q", "--bin", "mullvad-version", "versionName")
+}
diff --git a/build-apk.sh b/build-apk.sh
index 984f892268..9e906d97c0 100755
--- a/build-apk.sh
+++ b/build-apk.sh
@@ -6,7 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
-PRODUCT_VERSION="$(sed -n -e 's/^ *versionName = "\([^"]*\)"$/\1/p' android/app/build.gradle.kts)"
+PRODUCT_VERSION=$(cargo run -q --bin mullvad-version versionName)
BUILD_TYPE="release"
GRADLE_BUILD_TYPE="release"
GRADLE_TASK="assembleRelease"
@@ -50,12 +50,7 @@ if [[ "$GRADLE_BUILD_TYPE" == "release" ]]; then
fi
fi
-product_version_commit_hash=$(git rev-parse android/$PRODUCT_VERSION^{commit} || echo "")
-current_head_commit_hash=$(git rev-parse HEAD^{commit})
-if [[ "$BUILD_TYPE" == "debug" || $product_version_commit_hash != $current_head_commit_hash ]]; then
- PRODUCT_VERSION="${PRODUCT_VERSION}-dev-${current_head_commit_hash:0:6}"
- echo "Modifying product version to $PRODUCT_VERSION"
-else
+if [[ "$BUILD_TYPE" == "release" && "$PRODUCT_VERSION" != *"-dev-"* ]]; then
echo "Removing old Rust build artifacts"
cargo clean
CARGO_ARGS+=" --locked"
@@ -80,17 +75,6 @@ $GRADLE_CMD --console plain clean
mkdir -p "app/build/extraJni"
popd
-function restore_metadata_backups() {
- pushd "$SCRIPT_DIR"
- ./version-metadata.sh restore-backup --android
- mv Cargo.lock.bak Cargo.lock || true
- popd
-}
-trap 'restore_metadata_backups' EXIT
-
-cp Cargo.lock Cargo.lock.bak
-./version-metadata.sh inject $PRODUCT_VERSION --android
-
./wireguard/build-wireguard-go.sh --android $EXTRA_WGGO_ARGS
for ARCHITECTURE in ${ARCHITECTURES:-aarch64 armv7 x86_64 i686}; do
diff --git a/build.sh b/build.sh
index 4eaa409cc7..558b3d7c41 100755
--- a/build.sh
+++ b/build.sh
@@ -17,7 +17,7 @@ source scripts/utils/log
RUSTC_VERSION=$(rustc --version)
CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-"target"}
-PRODUCT_VERSION=$(cd gui/; node -p "require('./package.json').version" | sed -Ee 's/\.0//g')
+PRODUCT_VERSION=$(cargo run -q --bin mullvad-version)
# If compiler optimization and artifact compression should be turned on or not
OPTIMIZE="false"
@@ -51,10 +51,7 @@ done
# Everything that is not a release build is called a "dev build" and has "-dev-{commit hash}"
# appended to the version name.
IS_RELEASE="false"
-product_version_commit_hash=$(git rev-parse "$PRODUCT_VERSION^{commit}" || echo "")
-current_head_commit_hash=$(git rev-parse "HEAD^{commit}")
-if [[ "$SIGN" == "true" && "$OPTIMIZE" == "true" && \
- $product_version_commit_hash == "$current_head_commit_hash" ]]; then
+if [[ "$SIGN" == "true" && "$OPTIMIZE" == "true" && "$PRODUCT_VERSION" != *"-dev-"* ]]; then
IS_RELEASE="true"
fi
@@ -135,8 +132,6 @@ if [[ "$IS_RELEASE" == "true" ]]; then
# Will not allow an outdated lockfile in releases
CARGO_ARGS+=(--locked)
else
- PRODUCT_VERSION="$PRODUCT_VERSION-dev-${current_head_commit_hash:0:6}"
-
# Allow dev builds to override which API server to use at runtime.
CARGO_ARGS+=(--features api-override)
@@ -158,20 +153,6 @@ fi
log_header "Building Mullvad VPN $PRODUCT_VERSION"
-function restore_metadata_backups {
- pushd "$SCRIPT_DIR" > /dev/null
- log_info "Restoring version metadata files..."
- ./version-metadata.sh restore-backup --desktop
- mv Cargo.lock.bak Cargo.lock || true
- popd > /dev/null
-}
-trap 'restore_metadata_backups' EXIT
-
-log_info "Updating version in metadata files..."
-cp Cargo.lock Cargo.lock.bak
-./version-metadata.sh inject "$PRODUCT_VERSION" --desktop
-
-
# Sign all binaries passed as arguments to this function
function sign_win {
local NUM_RETRIES=3
@@ -360,20 +341,15 @@ case "$(uname -s)" in
Darwin*) npm run pack:mac -- "${NPM_PACK_ARGS[@]}";;
MINGW*) npm run pack:win -- "${NPM_PACK_ARGS[@]}";;
esac
-
popd
-SEMVER_VERSION=$(echo "$PRODUCT_VERSION" | sed -Ee 's/($|-.*)/.0\1/g')
-for semver_path in dist/*"$SEMVER_VERSION"*; do
- product_path=$(echo "$semver_path" | sed -Ee "s/$SEMVER_VERSION/$PRODUCT_VERSION/g")
- log_info "Moving $semver_path -> $product_path"
- mv "$semver_path" "$product_path"
-
- if [[ "$SIGN" == "true" && "$(uname -s)" == "MINGW"* && "$product_path" == *.exe ]]; then
- # sign installer
- sign_win "$product_path"
- fi
-done
+# sign installer on Windows
+if [[ "$SIGN" == "true" && "$(uname -s)" == "MINGW"* ]]; then
+ for installer_path in dist/*"$PRODUCT_VERSION"*.exe; do
+ log_info "Signing $installer_path"
+ sign_win "$installer_path"
+ done
+fi
log_success "**********************************"
log_success ""
diff --git a/dist-assets/android-product-version.txt b/dist-assets/android-product-version.txt
new file mode 100644
index 0000000000..8f7e21b428
--- /dev/null
+++ b/dist-assets/android-product-version.txt
@@ -0,0 +1 @@
+2022.2-beta2
diff --git a/dist-assets/desktop-product-version.txt b/dist-assets/desktop-product-version.txt
new file mode 100644
index 0000000000..2cc0695edf
--- /dev/null
+++ b/dist-assets/desktop-product-version.txt
@@ -0,0 +1 @@
+2022.5-beta2
diff --git a/dist-assets/windows/version.h b/dist-assets/windows/version.h
deleted file mode 100644
index 241c67d853..0000000000
--- a/dist-assets/windows/version.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#define MAJOR_VERSION 2022
-#define MINOR_VERSION 5
-#define PATCH_VERSION 0
-#define PRODUCT_VERSION "2022.5-beta2"
diff --git a/gui/package-lock.json b/gui/package-lock.json
index 09a98266a9..8a2b182aef 100644
--- a/gui/package-lock.json
+++ b/gui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "mullvad-vpn",
- "version": "2022.5.0-beta2",
+ "version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mullvad-vpn",
- "version": "2022.5.0-beta2",
+ "version": "0.0.0",
"hasInstallScript": true,
"license": "GPL-3.0",
"dependencies": {
diff --git a/gui/package.json b/gui/package.json
index ec2ab566d8..36bc9c6013 100644
--- a/gui/package.json
+++ b/gui/package.json
@@ -1,6 +1,6 @@
{
"name": "mullvad-vpn",
- "version": "2022.5.0-beta2",
+ "version": "0.0.0",
"productName": "Mullvad VPN",
"private": true,
"description": "Mullvad VPN client",
diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js
index b778a57b8c..1a54c2a93a 100644
--- a/gui/tasks/distribution.js
+++ b/gui/tasks/distribution.js
@@ -5,6 +5,7 @@ const { Arch } = require('electron-builder');
const parseSemver = require('semver/functions/parse');
const { notarize } = require('electron-notarize');
const { version } = require('../package.json');
+const { execFileSync } = require('child_process');
const noCompression = process.argv.includes('--no-compression');
const noAppleNotarization = process.argv.includes('--no-apple-notarization');
@@ -38,6 +39,9 @@ const config = {
extraMetadata: {
name: 'mullvad-vpn',
+ // We have to stick to semver on Windows for now due to:
+ // https://github.com/electron-userland/electron-builder/issues/7173
+ version: productVersion(process.platform === 'win32' ? ['semver'] : [])
},
files: [
@@ -240,6 +244,22 @@ function packWin() {
process.env.CPP_BUILD_MODE = release ? 'Release' : 'Debug';
return true;
},
+ afterAllArtifactBuild: (buildResult) => {
+ // All of this is a hack to work around the limitation in:
+ // https://github.com/electron-userland/electron-builder/issues/7173
+ const productSemverVersion = productVersion(['semver']);
+ const productTargetVersion = productVersion([]);
+
+ // Rename the artifacts so that they don't have the .0 (semver format)
+ for (const artifactPath of buildResult.artifactPaths) {
+ const artifactDir = path.dirname(artifactPath);
+ const artifactSemverFilename = path.basename(artifactPath);
+ const artifactDesiredFilename = artifactSemverFilename.replace(productSemverVersion, productTargetVersion);
+ const targetArtifactPath = path.join(artifactDir, artifactDesiredFilename);
+ console.log("Moving", artifactSemverFilename, "=>", artifactDesiredFilename);
+ fs.renameSync(artifactPath, targetArtifactPath);
+ }
+ },
},
});
}
@@ -405,6 +425,13 @@ function getDebVersion() {
return `${major}.${minor}`;
}
+// Returns the product version. The `args` argument is optional. Set it to `'semver'`
+// to get the version in semver format.
+function productVersion(extra_args) {
+ const args = ['run', '-q', '--bin', 'mullvad-version', ...extra_args];
+ return execFileSync('cargo', args, { encoding: 'utf-8' }).trim();
+}
+
packWin.displayName = 'builder-win';
packMac.displayName = 'builder-mac';
packLinux.displayName = 'builder-linux';
diff --git a/mullvad-api/Cargo.toml b/mullvad-api/Cargo.toml
index 3c10c63ce9..f267239f41 100644
--- a/mullvad-api/Cargo.toml
+++ b/mullvad-api/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-api"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Mullvad VPN API clients. Providing an interface to query our infrastructure for information."
license = "GPL-3.0"
diff --git a/mullvad-cli/Cargo.toml b/mullvad-cli/Cargo.toml
index afde8a303c..b82e675ad6 100644
--- a/mullvad-cli/Cargo.toml
+++ b/mullvad-cli/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-cli"
-version = "2022.5.0-beta2"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Manage the Mullvad VPN daemon via a convenient CLI"
license = "GPL-3.0"
@@ -24,6 +24,7 @@ itertools = "0.10"
mullvad-types = { path = "../mullvad-types" }
mullvad-paths = { path = "../mullvad-paths" }
+mullvad-version = { path = "../mullvad-version" }
talpid-types = { path = "../talpid-types" }
mullvad-management-interface = { path = "../mullvad-management-interface" }
@@ -34,6 +35,7 @@ clap_complete = { version = "3.0" }
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"
+mullvad-version = { path = "../mullvad-version" }
[target.'cfg(windows)'.build-dependencies.windows-sys]
version = "0.42.0"
diff --git a/mullvad-cli/build.rs b/mullvad-cli/build.rs
index b2cc9c3d9a..de110d3a76 100644
--- a/mullvad-cli/build.rs
+++ b/mullvad-cli/build.rs
@@ -1,19 +1,13 @@
-use std::{env, fs, path::PathBuf};
-
#[cfg(windows)]
fn make_lang_id(p: u16, s: u16) -> u16 {
(s << 10) | p
}
fn main() {
- let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
- let product_version = env!("CARGO_PKG_VERSION").replacen(".0", "", 1);
- fs::write(out_dir.join("product-version.txt"), &product_version).unwrap();
-
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
- res.set("ProductVersion", &product_version);
+ res.set("ProductVersion", mullvad_version::VERSION);
res.set_icon("../dist-assets/icon.ico");
res.set_language(make_lang_id(
windows_sys::Win32::System::SystemServices::LANG_ENGLISH as u16,
diff --git a/mullvad-cli/src/cmds/beta_program.rs b/mullvad-cli/src/cmds/beta_program.rs
index 8f659ec9b9..3fdcdb30f4 100644
--- a/mullvad-cli/src/cmds/beta_program.rs
+++ b/mullvad-cli/src/cmds/beta_program.rs
@@ -1,4 +1,4 @@
-use crate::{new_rpc_client, Command, Error, Result, PRODUCT_VERSION};
+use crate::{new_rpc_client, Command, Error, Result};
pub struct BetaProgram;
@@ -41,7 +41,7 @@ impl Command for BetaProgram {
let enable_str = matches.value_of("policy").expect("missing policy");
let enable = enable_str == "on";
- if !enable && PRODUCT_VERSION.contains("beta") {
+ if !enable && mullvad_version::VERSION.contains("beta") {
return Err(Error::InvalidCommand(
"The beta program must be enabled while running a beta version",
));
diff --git a/mullvad-cli/src/main.rs b/mullvad-cli/src/main.rs
index df7ef0a04c..39479d4054 100644
--- a/mullvad-cli/src/main.rs
+++ b/mullvad-cli/src/main.rs
@@ -15,7 +15,6 @@ mod location;
mod state;
pub const BIN_NAME: &str = "mullvad";
-pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt"));
pub type Result<T> = std::result::Result<T, Error>;
@@ -132,7 +131,7 @@ async fn run() -> Result<()> {
fn build_cli(commands: &HashMap<&'static str, Box<dyn Command>>) -> clap::App<'static> {
clap::App::new(BIN_NAME)
- .version(PRODUCT_VERSION)
+ .version(mullvad_version::VERSION)
.author(crate_authors!())
.about(crate_description!())
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml
index 4ebe4fcff1..5069a38f2a 100644
--- a/mullvad-daemon/Cargo.toml
+++ b/mullvad-daemon/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-daemon"
-version = "2022.5.0-beta2"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Mullvad VPN daemon. Runs and controls the VPN tunnels"
license = "GPL-3.0"
@@ -33,6 +33,7 @@ mullvad-paths = { path = "../mullvad-paths" }
mullvad-relay-selector = { path = "../mullvad-relay-selector" }
mullvad-types = { path = "../mullvad-types" }
mullvad-api = { path = "../mullvad-api" }
+mullvad-version = { path = "../mullvad-version" }
talpid-core = { path = "../talpid-core" }
talpid-dbus = { path = "../talpid-dbus" }
talpid-types = { path = "../talpid-types" }
@@ -71,6 +72,7 @@ features = [
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"
+mullvad-version = { path = "../mullvad-version" }
[target.'cfg(windows)'.build-dependencies.windows-sys]
version = "0.42.0"
diff --git a/mullvad-daemon/build.rs b/mullvad-daemon/build.rs
index a0d50577e7..ef84845f74 100644
--- a/mullvad-daemon/build.rs
+++ b/mullvad-daemon/build.rs
@@ -7,15 +7,12 @@ fn make_lang_id(p: u16, s: u16) -> u16 {
fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
-
- let product_version = env!("CARGO_PKG_VERSION").replacen(".0", "", 1);
- fs::write(out_dir.join("product-version.txt"), &product_version).unwrap();
fs::write(out_dir.join("git-commit-date.txt"), commit_date()).unwrap();
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
- res.set("ProductVersion", &product_version);
+ res.set("ProductVersion", mullvad_version::VERSION);
res.set_icon("../dist-assets/icon.ico");
res.set_language(make_lang_id(
windows_sys::Win32::System::SystemServices::LANG_ENGLISH as u16,
diff --git a/mullvad-daemon/src/cli.rs b/mullvad-daemon/src/cli.rs
index 22adf4427c..09412f4196 100644
--- a/mullvad-daemon/src/cli.rs
+++ b/mullvad-daemon/src/cli.rs
@@ -1,7 +1,5 @@
use clap::{crate_authors, crate_description, crate_name, App, Arg};
-use crate::version;
-
#[derive(Debug)]
pub struct Config {
pub log_level: log::LevelFilter,
@@ -72,7 +70,7 @@ lazy_static::lazy_static! {
fn create_app() -> App<'static> {
let mut app = App::new(crate_name!())
- .version(version::PRODUCT_VERSION)
+ .version(mullvad_version::VERSION)
.author(crate_authors!(", "))
.about(crate_description!())
.after_help(ENV_DESC.as_str())
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 959e3222da..4f22c7244c 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -1498,7 +1498,7 @@ where
fn on_get_current_version(&mut self, tx: oneshot::Sender<AppVersion>) {
Self::oneshot_send(
tx,
- version::PRODUCT_VERSION.to_owned(),
+ mullvad_version::VERSION.to_owned(),
"get_current_version response",
);
}
diff --git a/mullvad-daemon/src/version.rs b/mullvad-daemon/src/version.rs
index b80ea9d03e..19e6dfa134 100644
--- a/mullvad-daemon/src/version.rs
+++ b/mullvad-daemon/src/version.rs
@@ -1,18 +1,15 @@
-/// A string that identifies the current version of the application
-pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt"));
-
/// Contains the date of the git commit this was built from
pub const COMMIT_DATE: &str = include_str!(concat!(env!("OUT_DIR"), "/git-commit-date.txt"));
pub fn is_beta_version() -> bool {
- PRODUCT_VERSION.contains("beta")
+ mullvad_version::VERSION.contains("beta")
}
pub fn log_version() {
log::info!(
"Starting {} - {} {}",
env!("CARGO_PKG_NAME"),
- PRODUCT_VERSION,
+ mullvad_version::VERSION,
COMMIT_DATE,
)
}
diff --git a/mullvad-daemon/src/version_check.rs b/mullvad-daemon/src/version_check.rs
index 4afa7ab44b..6f3a8f6a9a 100644
--- a/mullvad-daemon/src/version_check.rs
+++ b/mullvad-daemon/src/version_check.rs
@@ -1,7 +1,4 @@
-use crate::{
- version::{is_beta_version, PRODUCT_VERSION},
- DaemonEventSender,
-};
+use crate::{version::is_beta_version, DaemonEventSender};
use futures::{
channel::{mpsc, oneshot},
stream::FusedStream,
@@ -24,7 +21,7 @@ use tokio::fs::{self, File};
const VERSION_INFO_FILENAME: &str = "version-info.json";
lazy_static::lazy_static! {
- static ref APP_VERSION: ParsedAppVersion = ParsedAppVersion::from_str(PRODUCT_VERSION).unwrap();
+ static ref APP_VERSION: ParsedAppVersion = ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap();
static ref IS_DEV_BUILD: bool = APP_VERSION.is_dev();
}
@@ -58,7 +55,7 @@ impl From<AppVersionInfo> for CachedAppVersionInfo {
fn from(version_info: AppVersionInfo) -> CachedAppVersionInfo {
CachedAppVersionInfo {
version_info,
- cached_from_version: PRODUCT_VERSION.to_owned(),
+ cached_from_version: mullvad_version::VERSION.to_owned(),
}
}
}
@@ -190,7 +187,7 @@ impl VersionUpdater {
let download_future_factory = move || {
version_proxy
.version_check(
- PRODUCT_VERSION.to_owned(),
+ mullvad_version::VERSION.to_owned(),
PLATFORM,
platform_version.clone(),
)
@@ -228,7 +225,7 @@ impl VersionUpdater {
let download_future_factory = move || {
let when_available = api_handle.wait_background();
let request = version_proxy.version_check(
- PRODUCT_VERSION.to_owned(),
+ mullvad_version::VERSION.to_owned(),
PLATFORM,
platform_version.clone(),
);
@@ -304,24 +301,20 @@ impl VersionUpdater {
latest_beta: &str,
show_beta: bool,
) -> Option<String> {
- if !*IS_DEV_BUILD {
- let stable_version = latest_stable
- .as_ref()
- .and_then(|stable| ParsedAppVersion::from_str(stable).ok());
+ let stable_version = latest_stable
+ .as_ref()
+ .and_then(|stable| ParsedAppVersion::from_str(stable).ok());
- let beta_version = if show_beta {
- ParsedAppVersion::from_str(latest_beta).ok()
- } else {
- None
- };
+ let beta_version = if show_beta {
+ ParsedAppVersion::from_str(latest_beta).ok()
+ } else {
+ None
+ };
- let latest_version = stable_version.iter().chain(beta_version.iter()).max()?;
+ let latest_version = stable_version.iter().chain(beta_version.iter()).max()?;
- if current_version < latest_version {
- Some(latest_version.to_string())
- } else {
- None
- }
+ if current_version < latest_version {
+ Some(latest_version.to_string())
} else {
None
}
@@ -450,7 +443,7 @@ async fn try_load_cache(cache_dir: &Path) -> Result<AppVersionInfo, Error> {
let version_info: CachedAppVersionInfo =
serde_json::from_str(&content).map_err(Error::Deserialize)?;
- if version_info.cached_from_version == PRODUCT_VERSION {
+ if version_info.cached_from_version == mullvad_version::VERSION {
Ok(version_info.version_info)
} else {
Err(Error::CacheVersionMismatch)
@@ -475,8 +468,8 @@ fn dev_version_cache() -> AppVersionInfo {
AppVersionInfo {
supported: false,
- latest_stable: PRODUCT_VERSION.to_owned(),
- latest_beta: PRODUCT_VERSION.to_owned(),
+ latest_stable: mullvad_version::VERSION.to_owned(),
+ latest_beta: mullvad_version::VERSION.to_owned(),
suggested_upgrade: None,
// Use WireGuard on 75% of dev builds. So we can manually modify
// wg_migration_rand_num in the settings and verify that the migration
diff --git a/mullvad-exclude/Cargo.toml b/mullvad-exclude/Cargo.toml
index 4e506cb948..1e550d7dfd 100644
--- a/mullvad-exclude/Cargo.toml
+++ b/mullvad-exclude/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-exclude"
-version = "2022.5.0-beta2"
+version = "0.0.0"
authors = ["Mullvad VPN"]
license = "GPL-3.0"
edition = "2021"
diff --git a/mullvad-jni/Cargo.toml b/mullvad-jni/Cargo.toml
index a2134a21e9..da60b07ea8 100644
--- a/mullvad-jni/Cargo.toml
+++ b/mullvad-jni/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-jni"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "JNI interface for the Mullvad daemon"
license = "GPL-3.0"
diff --git a/mullvad-management-interface/Cargo.toml b/mullvad-management-interface/Cargo.toml
index ce7659b416..957fb5c1d5 100644
--- a/mullvad-management-interface/Cargo.toml
+++ b/mullvad-management-interface/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-management-interface"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Mullvad VPN IPC. Contains types and functions for IPC clients and servers."
license = "GPL-3.0"
diff --git a/mullvad-paths/Cargo.toml b/mullvad-paths/Cargo.toml
index 64d9e277dc..04edf4e365 100644
--- a/mullvad-paths/Cargo.toml
+++ b/mullvad-paths/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-paths"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Mullvad VPN application paths and directories"
license = "GPL-3.0"
diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml
index a3643b5743..4b9cc07398 100644
--- a/mullvad-problem-report/Cargo.toml
+++ b/mullvad-problem-report/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-problem-report"
-version = "2022.5.0-beta2"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Collect Mullvad VPN logs into a report and send it to support"
license = "GPL-3.0"
@@ -20,6 +20,7 @@ tokio = { version = "1.8", features = ["rt"] }
mullvad-paths = { path = "../mullvad-paths" }
mullvad-api = { path = "../mullvad-api" }
+mullvad-version = { path = "../mullvad-version" }
talpid-types = { path = "../talpid-types" }
talpid-platform-metadata = { path = "../talpid-platform-metadata" }
@@ -30,6 +31,7 @@ duct = "0.13"
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"
+mullvad-version = { path = "../mullvad-version" }
[target.'cfg(windows)'.build-dependencies.windows-sys]
version = "0.42.0"
diff --git a/mullvad-problem-report/build.rs b/mullvad-problem-report/build.rs
index 1da519a32e..de110d3a76 100644
--- a/mullvad-problem-report/build.rs
+++ b/mullvad-problem-report/build.rs
@@ -1,20 +1,13 @@
-use std::{env, fs, path::PathBuf};
-
#[cfg(windows)]
fn make_lang_id(p: u16, s: u16) -> u16 {
(s << 10) | p
}
fn main() {
- let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
-
- let product_version = env!("CARGO_PKG_VERSION").replacen(".0", "", 1);
- fs::write(out_dir.join("product-version.txt"), &product_version).unwrap();
-
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
- res.set("ProductVersion", &product_version);
+ res.set("ProductVersion", mullvad_version::VERSION);
res.set_icon("../dist-assets/icon.ico");
res.set_language(make_lang_id(
windows_sys::Win32::System::SystemServices::LANG_ENGLISH as u16,
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs
index 09d681fd25..85f0143bee 100644
--- a/mullvad-problem-report/src/main.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -1,7 +1,7 @@
#![deny(rust_2018_idioms)]
use clap::{crate_authors, crate_name};
-use mullvad_problem_report::{collect_report, metadata, Error};
+use mullvad_problem_report::{collect_report, Error};
use std::{env, path::Path, process};
use talpid_types::ErrorExt;
@@ -18,7 +18,7 @@ fn main() {
fn run() -> Result<(), Error> {
env_logger::init();
let app = clap::App::new(crate_name!())
- .version(metadata::PRODUCT_VERSION)
+ .version(mullvad_version::VERSION)
.author(crate_authors!())
.about("Mullvad VPN problem report tool. Collects logs and sends them to Mullvad support.")
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
diff --git a/mullvad-problem-report/src/metadata.rs b/mullvad-problem-report/src/metadata.rs
index ac4b8c9255..ab9fe53a91 100644
--- a/mullvad-problem-report/src/metadata.rs
+++ b/mullvad-problem-report/src/metadata.rs
@@ -1,13 +1,11 @@
use std::collections::BTreeMap;
-pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt"));
-
pub fn collect() -> BTreeMap<String, String> {
let mut metadata = BTreeMap::new();
metadata.insert("id".to_owned(), uuid::Uuid::new_v4().to_string());
metadata.insert(
"mullvad-product-version".to_owned(),
- PRODUCT_VERSION.to_owned(),
+ mullvad_version::VERSION.to_owned(),
);
metadata.insert("os".to_owned(), talpid_platform_metadata::version());
metadata.extend(talpid_platform_metadata::extra_metadata());
diff --git a/mullvad-relay-selector/Cargo.toml b/mullvad-relay-selector/Cargo.toml
index 602cbf29aa..9a18fa1618 100644
--- a/mullvad-relay-selector/Cargo.toml
+++ b/mullvad-relay-selector/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-relay-selector"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Mullvad VPN relay selector"
license = "GPL-3.0"
diff --git a/mullvad-setup/Cargo.toml b/mullvad-setup/Cargo.toml
index 969e3441d1..d47ed796ed 100644
--- a/mullvad-setup/Cargo.toml
+++ b/mullvad-setup/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-setup"
-version = "2022.5.0-beta2"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Tool used to manage daemon setup"
license = "GPL-3.0"
@@ -25,6 +25,7 @@ mullvad-daemon = { path = "../mullvad-daemon" }
mullvad-paths = { path = "../mullvad-paths" }
mullvad-api = { path = "../mullvad-api" }
mullvad-types = { path = "../mullvad-types" }
+mullvad-version = { path = "../mullvad-version" }
talpid-core = { path = "../talpid-core" }
talpid-types = { path = "../talpid-types" }
diff --git a/mullvad-setup/build.rs b/mullvad-setup/build.rs
deleted file mode 100644
index 7cc0a0a5de..0000000000
--- a/mullvad-setup/build.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-use std::{env, fs, path::PathBuf};
-
-fn main() {
- let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
- let product_version = env!("CARGO_PKG_VERSION").replacen(".0", "", 1);
- fs::write(out_dir.join("product-version.txt"), &product_version).unwrap();
-}
diff --git a/mullvad-setup/src/main.rs b/mullvad-setup/src/main.rs
index 9d353b78a6..2f210ebb76 100644
--- a/mullvad-setup/src/main.rs
+++ b/mullvad-setup/src/main.rs
@@ -9,10 +9,8 @@ use talpid_core::{
};
use talpid_types::ErrorExt;
-pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt"));
-
lazy_static::lazy_static! {
- static ref APP_VERSION: ParsedAppVersion = ParsedAppVersion::from_str(PRODUCT_VERSION).unwrap();
+ static ref APP_VERSION: ParsedAppVersion = ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap();
static ref IS_DEV_BUILD: bool = APP_VERSION.is_dev();
}
@@ -101,7 +99,7 @@ async fn main() {
];
let app = clap::App::new(crate_name!())
- .version(PRODUCT_VERSION)
+ .version(mullvad_version::VERSION)
.author(crate_authors!())
.about(crate_description!())
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
diff --git a/mullvad-types/Cargo.toml b/mullvad-types/Cargo.toml
index a794470b7f..afa2246a87 100644
--- a/mullvad-types/Cargo.toml
+++ b/mullvad-types/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mullvad-types"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Common base data structures for Mullvad VPN client"
license = "GPL-3.0"
diff --git a/mullvad-version/Cargo.toml b/mullvad-version/Cargo.toml
new file mode 100644
index 0000000000..fdc013a261
--- /dev/null
+++ b/mullvad-version/Cargo.toml
@@ -0,0 +1,17 @@
+[package]
+name = "mullvad-version"
+version = "0.0.0"
+authors = ["Mullvad VPN"]
+license = "GPL-3.0"
+edition = "2021"
+publish = false
+
+description = """
+Computes the Mullvad VPN app product version. This crate is the single source of truth for
+what version string a build should have. This crate is responsible for computing the
+`-dev-$git_hash` suffix as well as transforming the version into semver, Android versionCode
+and other formats.
+"""
+
+[dependencies]
+regex = "1.6.0"
diff --git a/mullvad-version/build.rs b/mullvad-version/build.rs
new file mode 100644
index 0000000000..a5b8734fb9
--- /dev/null
+++ b/mullvad-version/build.rs
@@ -0,0 +1,97 @@
+use std::{env, fs, path::PathBuf, process::Command};
+
+/// How many characters of the git commit that should be added to the version name
+/// in dev builds.
+const GIT_HASH_DEV_SUFFIX_LEN: usize = 6;
+
+const ANDROID_VERSION_FILE_PATH: &str = "../dist-assets/android-product-version.txt";
+const DESKTOP_VERSION_FILE_PATH: &str = "../dist-assets/desktop-product-version.txt";
+
+#[derive(Debug, Copy, Clone)]
+enum Target {
+ Android,
+ Desktop,
+}
+
+impl Target {
+ pub fn current_target() -> Self {
+ println!("cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS");
+ match env::var("CARGO_CFG_TARGET_OS")
+ .expect("CARGO_CFG_TARGET_OS should be set")
+ .as_str()
+ {
+ "android" => Self::Android,
+ "linux" | "windows" | "macos" => Self::Desktop,
+ target_os => panic!("Unsupported target OS: {target_os}"),
+ }
+ }
+}
+
+fn main() {
+ let product_version = get_product_version(Target::current_target());
+ let android_product_version = get_product_version(Target::Android);
+
+ let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
+ fs::write(out_dir.join("product-version.txt"), &product_version).unwrap();
+ fs::write(
+ out_dir.join("android-product-version.txt"),
+ &android_product_version,
+ )
+ .unwrap();
+}
+
+/// Returns the Mullvad product version from the corresponding metadata files,
+/// depending on target platform.
+fn get_product_version(target: Target) -> String {
+ let version_file_path = match target {
+ Target::Android => ANDROID_VERSION_FILE_PATH,
+ Target::Desktop => DESKTOP_VERSION_FILE_PATH,
+ };
+ println!("cargo:rerun-if-changed={version_file_path}");
+ let version = fs::read_to_string(version_file_path)
+ .unwrap_or_else(|_| panic!("Failed to read {version_file_path}"))
+ .trim()
+ .to_owned();
+
+ let dev_suffix = get_dev_suffix(target, &version);
+
+ format!("{version}{dev_suffix}")
+}
+
+fn get_dev_suffix(target: Target, product_version: &str) -> String {
+ // Compute the expected tag name for the release named `product_version`
+ let release_tag = match target {
+ Target::Android => format!("android/{product_version}"),
+ Target::Desktop => product_version.to_owned(),
+ };
+
+ // Get the git commit hashes for the latest release and current HEAD
+ let product_version_commit_hash = git_rev_parse_commit_hash(&release_tag);
+ let current_head_commit_hash =
+ git_rev_parse_commit_hash("HEAD").expect("HEAD must have a commit hash");
+
+ // If we are not currently building the release tag, we are on a development build.
+ // Adjust product version string accordingly.
+ if product_version_commit_hash.as_ref() != Some(&current_head_commit_hash) {
+ let hash_suffix = &current_head_commit_hash[..GIT_HASH_DEV_SUFFIX_LEN];
+ format!("-dev-{hash_suffix}")
+ } else {
+ "".to_owned()
+ }
+}
+
+/// Returns the commit hash for the commit that `git_ref` is pointing to
+fn git_rev_parse_commit_hash(git_ref: &str) -> Option<String> {
+ // This is a very blunt way of making sure we run again if a tag is added or removed.
+ println!("cargo:rerun-if-changed=.git");
+
+ let output = Command::new("git")
+ .arg("rev-parse")
+ .arg(format!("{git_ref}^{{commit}}"))
+ .output()
+ .expect("Not able to run git");
+ if !output.status.success() {
+ return None;
+ }
+ Some(String::from_utf8(output.stdout).unwrap().trim().to_owned())
+}
diff --git a/mullvad-version/src/lib.rs b/mullvad-version/src/lib.rs
new file mode 100644
index 0000000000..9586b9b776
--- /dev/null
+++ b/mullvad-version/src/lib.rs
@@ -0,0 +1,2 @@
+/// The Mullvad VPN app product version
+pub const VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt"));
diff --git a/mullvad-version/src/main.rs b/mullvad-version/src/main.rs
new file mode 100644
index 0000000000..a54914e6c2
--- /dev/null
+++ b/mullvad-version/src/main.rs
@@ -0,0 +1,97 @@
+use regex::Regex;
+use std::{env, process::exit};
+
+const ANDROID_VERSION: &str =
+ include_str!(concat!(env!("OUT_DIR"), "/android-product-version.txt"));
+
+const VERSION_REGEX: &str = r"^20([0-9]{2})\.([1-9][0-9]?)(-beta([1-9][0-9]?))?(-dev-[0-9a-f]+)?$";
+
+fn main() {
+ let command = env::args().nth(1);
+ match command.as_deref() {
+ None => println!("{}", mullvad_version::VERSION),
+ Some("semver") => println!("{}", to_semver(mullvad_version::VERSION)),
+ Some("version.h") => println!("{}", to_windows_h_format(mullvad_version::VERSION)),
+ Some("versionName") => println!("{ANDROID_VERSION}"),
+ Some("versionCode") => println!("{}", to_android_version_code(ANDROID_VERSION)),
+ Some(command) => {
+ eprintln!("Unknown command: {command}");
+ exit(1);
+ }
+ }
+}
+
+/// Takes a version without a patch number and adds the patch (set to zero).
+///
+/// Converts `x.y[-z]` into `x.y.0[-z]` to make the version semver compatible.
+fn to_semver(version: &str) -> String {
+ let mut parts = version.splitn(2, '-');
+
+ let version = parts.next().expect("Year component");
+ let remainder = parts.next().map(|s| format!("-{s}")).unwrap_or_default();
+ assert_eq!(parts.next(), None);
+
+ format!("{version}.0{remainder}")
+}
+
+/// Takes a version in the normal Mullvad VPN app version format and returns the Android
+/// `versionCode` formatted version.
+///
+/// The format of the code is: YYVV00XX
+/// Last two digits of the year (major) ^^
+/// Incrementing version (minor) ^^
+/// Unused ^^
+/// Beta number, 00 if stable ^^
+///
+/// # Example
+///
+/// Version: 2021.34-beta5
+/// versionCode: 21340005
+fn to_android_version_code(version: &str) -> String {
+ let version = parse_version(version);
+ format!(
+ "{}{:0>2}00{:0>2}",
+ version.year,
+ version.incremental,
+ version.beta.unwrap_or_default()
+ )
+}
+
+fn to_windows_h_format(version: &str) -> String {
+ let Version {
+ year, incremental, ..
+ } = parse_version(version);
+
+ format!(
+ "#define MAJOR_VERSION 20{year}
+#define MINOR_VERSION {incremental}
+#define PATCH_VERSION 0
+#define PRODUCT_VERSION \"{version}\""
+ )
+}
+
+struct Version {
+ year: String,
+ incremental: String,
+ beta: Option<String>,
+}
+
+fn parse_version(version: &str) -> Version {
+ let re = Regex::new(VERSION_REGEX).unwrap();
+ let captures = re
+ .captures(version)
+ .expect("Version does not match expected format");
+ let year = captures.get(1).expect("Missing year").as_str().to_owned();
+ let incremental = captures
+ .get(2)
+ .expect("Missing incremental")
+ .as_str()
+ .to_owned();
+ let beta = captures.get(4).map(|m| m.as_str().to_owned());
+
+ Version {
+ year,
+ incremental,
+ beta,
+ }
+}
diff --git a/prepare-release.sh b/prepare-release.sh
index 2a18f8f45b..d7de34199d 100755
--- a/prepare-release.sh
+++ b/prepare-release.sh
@@ -13,7 +13,6 @@ for argument in "$@"; do
case "$argument" in
"--android")
ANDROID="true"
- VERSION_METADATA_ARGS+="--android "
;;
"--desktop")
DESKTOP="true"
@@ -63,40 +62,16 @@ if [[ "$ANDROID" == "true" && $(grep "^## \\[android/$PRODUCT_VERSION\\] - " CHA
exit 1
fi
-echo "Updating version in metadata files..."
-./version-metadata.sh inject $PRODUCT_VERSION $VERSION_METADATA_ARGS
-
-echo "Syncing Cargo.lock with new version numbers"
-source env.sh ""
-# If cargo exits with a non zero exit status and it's not a timeout (exit code 124) it's an error
-set +e
-timeout 5s cargo build
-if [[ $? != 0 && $? != 124 ]]; then
- exit 1
-fi
-set -e
-
-echo "Commiting metadata changes to git..."
-
-git commit -S -m "Update crate versions to $PRODUCT_VERSION" \
- mullvad-daemon/Cargo.toml \
- mullvad-cli/Cargo.toml \
- mullvad-problem-report/Cargo.toml \
- mullvad-setup/Cargo.toml \
- mullvad-exclude/Cargo.toml \
- talpid-openvpn-plugin/Cargo.toml \
- Cargo.lock
-
if [[ "$DESKTOP" == "true" ]]; then
- git commit -S -m "Update desktop app versions to $PRODUCT_VERSION" \
- gui/package.json \
- gui/package-lock.json \
- dist-assets/windows/version.h
+ echo "$PRODUCT_VERSION" > dist-assets/desktop-product-version.txt
+ git commit -S -m "Update desktop app version to $PRODUCT_VERSION" \
+ dist-assets/desktop-product-version.txt
fi
if [[ "$ANDROID" == "true" ]]; then
- git commit -S -m "Update Android app version to $PRODUCT_VERSION" \
- android/app/build.gradle.kts
+ echo "$PRODUCT_VERSION" > dist-assets/android-product-version.txt
+ git commit -S -m "Update android app version to $PRODUCT_VERSION" \
+ dist-assets/android-product-version.txt
fi
NEW_TAGS=""
@@ -114,8 +89,6 @@ if [[ "$DESKTOP" == "true" ]]; then
NEW_TAGS+=" $PRODUCT_VERSION"
fi
-./version-metadata.sh delete-backup
-
echo "================================================="
echo "| DONE preparing for a release! |"
echo "| Now push the tag created by this script |"
diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml
index b2c04dac53..d1167e16fc 100644
--- a/talpid-core/Cargo.toml
+++ b/talpid-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "talpid-core"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Privacy preserving and secure VPN client library"
license = "GPL-3.0"
diff --git a/talpid-dbus/Cargo.toml b/talpid-dbus/Cargo.toml
index f003f79998..4686ffabfc 100644
--- a/talpid-dbus/Cargo.toml
+++ b/talpid-dbus/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "talpid-dbus"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
license = "GPL-3.0"
edition = "2021"
diff --git a/talpid-openvpn-plugin/Cargo.toml b/talpid-openvpn-plugin/Cargo.toml
index 9b8fb0c4a9..12db76343b 100644
--- a/talpid-openvpn-plugin/Cargo.toml
+++ b/talpid-openvpn-plugin/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "talpid-openvpn-plugin"
-version = "2022.5.0-beta2"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "OpenVPN shared library plugin for relaying OpenVPN events to talpid_core"
license = "GPL-3.0"
@@ -30,6 +30,7 @@ tonic-build = { version = "0.8", default-features = false, features = ["transpor
[target.'cfg(windows)'.build-dependencies]
winres = "0.1"
+mullvad-version = { path = "../mullvad-version" }
[target.'cfg(windows)'.build-dependencies.windows-sys]
version = "0.42.0"
diff --git a/talpid-openvpn-plugin/build.rs b/talpid-openvpn-plugin/build.rs
index b3f12019a0..06d3f260a4 100644
--- a/talpid-openvpn-plugin/build.rs
+++ b/talpid-openvpn-plugin/build.rs
@@ -10,9 +10,8 @@ fn main() {
#[cfg(windows)]
{
- let product_version = env!("CARGO_PKG_VERSION").replacen(".0", "", 1);
let mut res = winres::WindowsResource::new();
- res.set("ProductVersion", &product_version);
+ res.set("ProductVersion", mullvad_version::VERSION);
res.set_icon("../dist-assets/icon.ico");
res.set_language(make_lang_id(
windows_sys::Win32::System::SystemServices::LANG_ENGLISH as u16,
diff --git a/talpid-platform-metadata/Cargo.toml b/talpid-platform-metadata/Cargo.toml
index 2710451c02..c6ed0ded87 100644
--- a/talpid-platform-metadata/Cargo.toml
+++ b/talpid-platform-metadata/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "talpid-platform-metadata"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Platform metadata detection functions"
license = "GPL-3.0"
diff --git a/talpid-time/Cargo.toml b/talpid-time/Cargo.toml
index 754007e84a..73f7a25977 100644
--- a/talpid-time/Cargo.toml
+++ b/talpid-time/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "talpid-time"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Time functions"
license = "GPL-3.0"
diff --git a/talpid-tunnel-config-client/Cargo.toml b/talpid-tunnel-config-client/Cargo.toml
index d99e5eb13e..c6b2d1d655 100644
--- a/talpid-tunnel-config-client/Cargo.toml
+++ b/talpid-tunnel-config-client/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "talpid-tunnel-config-client"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Uses the relay RPC service to set up PQ-safe peers, etc."
license = "GPL-3.0"
diff --git a/talpid-types/Cargo.toml b/talpid-types/Cargo.toml
index 4db8315c99..20980ce344 100644
--- a/talpid-types/Cargo.toml
+++ b/talpid-types/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "talpid-types"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Common base structures for talpid"
license = "GPL-3.0"
diff --git a/tunnel-obfuscation/Cargo.toml b/tunnel-obfuscation/Cargo.toml
index 0cf0b54add..cca4fca894 100644
--- a/tunnel-obfuscation/Cargo.toml
+++ b/tunnel-obfuscation/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "tunnel-obfuscation"
-version = "0.1.0"
+version = "0.0.0"
authors = ["Mullvad VPN"]
description = "Provides different types of obfuscation layers for WireGuard"
license = "GPL-3.0"
diff --git a/version-metadata.sh b/version-metadata.sh
deleted file mode 100755
index e7001e19af..0000000000
--- a/version-metadata.sh
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env bash
-#
-# Can inject correctly formatted version strings/numbers in all the various
-# project metadata files. Can also back them up and restore them.
-
-set -eu
-
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-cd "$SCRIPT_DIR"
-
-INCLUDED_CRATES=(
- "mullvad-daemon"
- "mullvad-cli"
- "mullvad-problem-report"
- "mullvad-setup"
- "mullvad-exclude"
- "talpid-openvpn-plugin"
-)
-MANIFESTS=( "${INCLUDED_CRATES[@]/%//Cargo.toml}" )
-
-# Parse arguments
-COMMAND="$1"
-shift 1
-
-PRODUCT_VERSION=""
-ANDROID="false"
-DESKTOP="false"
-for argument in "$@"; do
- case "$argument" in
- "--android")
- ANDROID="true"
- ;;
- "--desktop")
- DESKTOP="true"
- ;;
- -*)
- echo >&2 "Unknown option \"$argument\""
- exit 1
- ;;
- *)
- PRODUCT_VERSION="$argument"
- ;;
- esac
-done
-
-function inject_version {
- # Regex that only matches valid Mullvad VPN versions. It also captures
- # relevant values into capture groups, read out via BASH_REMATCH[x].
- local VERSION_REGEX="^20([0-9]{2})\.([1-9][0-9]?)(-beta([1-9][0-9]?))?(-dev-[0-9a-f]+)?$"
-
- if [[ ! $PRODUCT_VERSION =~ $VERSION_REGEX ]]; then
- echo >&2 "Invalid version format. Please specify version as:"
- echo >&2 "<YEAR>.<NUMBER>[-beta<NUMBER>]"
- return 1
- fi
-
- local semver_version
- semver_version=$(echo "$PRODUCT_VERSION" | sed -Ee 's/($|-.*)/.0\1/g')
- local semver_major="20${BASH_REMATCH[1]}"
- local semver_minor=${BASH_REMATCH[2]}
- local semver_patch="0"
-
- echo "Setting Rust crate versions to $semver_version"
- # Rust crates
- for toml in "${MANIFESTS[@]}"; do
- cp "$toml" "$toml.bak"
- awk "BEGIN { matches=0; } matches==0 && /^version = \"[^\"]+\"$/ \
- { print \"version = \\\"$semver_version\\\"\"; matches++; next; } { print }" "$toml.bak" > "$toml"
- done
-
- if [[ "$DESKTOP" == "true" ]]; then
- echo "Setting desktop version to $semver_version"
-
- # Electron GUI
- cp gui/package.json gui/package.json.bak
- cp gui/package-lock.json gui/package-lock.json.bak
- (cd gui/ && npm version "$semver_version" --no-git-tag-version --allow-same-version)
-
- # Windows C++
- cp dist-assets/windows/version.h dist-assets/windows/version.h.bak
- cat <<EOF > dist-assets/windows/version.h
-#define MAJOR_VERSION $semver_major
-#define MINOR_VERSION $semver_minor
-#define PATCH_VERSION $semver_patch
-#define PRODUCT_VERSION "$PRODUCT_VERSION"
-EOF
- fi
-
- if [[ "$ANDROID" == "true" ]]; then
- # Android
- local version_year
- version_year=$(printf "%02d" "${BASH_REMATCH[1]}")
- local version_number
- version_number=$(printf "%02d" "${BASH_REMATCH[2]}")
- local version_patch="00" # Not used for now.
- local version_beta
- version_beta=$(printf "%02d" "${BASH_REMATCH[4]:-99}")
- local android_version_code=${version_year}${version_number}${version_patch}${version_beta}
-
- echo "Setting Android versionName to $PRODUCT_VERSION and versionCode to $android_version_code"
-
- cp android/app/build.gradle.kts android/app/build.gradle.kts.bak
- sed -i -Ee "s/versionCode = [0-9]+/versionCode = $android_version_code/g" \
- android/app/build.gradle.kts
- sed -i -Ee "s/versionName = \"[^\"]+\"/versionName = \"$PRODUCT_VERSION\"/g" \
- android/app/build.gradle.kts
- fi
-}
-
-function restore_backup {
- set +e
-
- # Rust crates
- for toml in "${MANIFESTS[@]}"; do
- mv "${toml}.bak" "${toml}"
- done
-
- if [[ "$DESKTOP" == "true" ]]; then
- # Electron GUI
- mv gui/package.json.bak gui/package.json
- mv gui/package-lock.json.bak gui/package-lock.json
- # Windows C++
- mv dist-assets/windows/version.h.bak dist-assets/windows/version.h
-
- fi
-
- if [[ "$ANDROID" == "true" ]]; then
- # Android
- mv android/app/build.gradle.kts.bak android/app/build.gradle.kts
- fi
- set -e
-}
-
-function delete_backup {
- set +e
-
- # Rust crates
- for toml in "${MANIFESTS[@]}"; do
- rm "${toml}.bak"
- done
-
- if [[ "$DESKTOP" == "true" ]]; then
- # Electron GUI
- rm gui/package.json.bak
- rm gui/package-lock.json.bak
- # Windows C++
- rm dist-assets/windows/version.h.bak
-
- fi
-
- if [[ "$ANDROID" == "true" ]]; then
- # Android
- rm android/app/build.gradle.kts.bak
- fi
- set -e
-}
-
-case "$COMMAND" in
- "inject")
- inject_version
- ;;
- "restore-backup")
- restore_backup
- ;;
- "delete-backup")
- delete_backup
- ;;
- *)
- echo >&2 "Invalid command"
- exit 1
- ;;
-esac
diff --git a/windows/winfw/src/winfw/winfw.rc b/windows/winfw/src/winfw/winfw.rc
index 1e70710b75..a101cebb61 100644
--- a/windows/winfw/src/winfw/winfw.rc
+++ b/windows/winfw/src/winfw/winfw.rc
@@ -1,4 +1,4 @@
-#include "../../../../dist-assets/windows/version.h"
+#include "../../../version.h"
1 VERSIONINFO
FILEVERSION MAJOR_VERSION,MINOR_VERSION,PATCH_VERSION,0
diff --git a/windows/winfw/src/winfw/winfw.vcxproj b/windows/winfw/src/winfw/winfw.vcxproj
index afdb8daec1..f13b019889 100644
--- a/windows/winfw/src/winfw/winfw.vcxproj
+++ b/windows/winfw/src/winfw/winfw.vcxproj
@@ -181,6 +181,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>winfw.def</ModuleDefinitionFile>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -201,6 +204,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>winfw.def</ModuleDefinitionFile>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -225,6 +231,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>winfw.def</ModuleDefinitionFile>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -249,6 +258,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>winfw.def</ModuleDefinitionFile>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/windows/winnet/src/winnet/winnet.rc b/windows/winnet/src/winnet/winnet.rc
index 253d011bc1..0509b4a59e 100644
--- a/windows/winnet/src/winnet/winnet.rc
+++ b/windows/winnet/src/winnet/winnet.rc
@@ -1,4 +1,4 @@
-#include "../../../../dist-assets/windows/version.h"
+#include "../../../version.h"
1 VERSIONINFO
FILEVERSION MAJOR_VERSION,MINOR_VERSION,PATCH_VERSION,0
diff --git a/windows/winnet/src/winnet/winnet.vcxproj b/windows/winnet/src/winnet/winnet.vcxproj
index c32fa0972a..e38fd0e4b1 100644
--- a/windows/winnet/src/winnet/winnet.vcxproj
+++ b/windows/winnet/src/winnet/winnet.vcxproj
@@ -173,6 +173,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<AdditionalDependencies>libshared.lib;libcommon.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">
<ClCompile>
@@ -197,6 +200,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-Debug</AdditionalLibraryDirectories>
<AdditionalDependencies>libshared.lib;libcommon.lib;Iphlpapi.lib</AdditionalDependencies>
</Lib>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -217,6 +223,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>winnet.def</ModuleDefinitionFile>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
<ClCompile>
@@ -241,6 +250,9 @@
<AdditionalDependencies>libshared.lib;libcommon.lib;Iphlpapi.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-Debug</AdditionalLibraryDirectories>
</Lib>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -265,6 +277,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<AdditionalDependencies>libshared.lib;libcommon.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -289,6 +304,9 @@
<AdditionalLibraryDirectories>$(SolutionDir)/bin/$(Platform)-$(Configuration)</AdditionalLibraryDirectories>
<AdditionalDependencies>libshared.lib;libcommon.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
+ <PreBuildEvent>
+ <Command>cargo run -q --bin mullvad-version version.h &gt; $(ProjectDir)..\..\..\version.h</Command>
+ </PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">