summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli
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 /mullvad-cli
parentf334c2a84faaed748aeb857085e0754e189e4b2f (diff)
parentec7ea9fb689c6c3087ccbc4d37cbb786fff44895 (diff)
downloadmullvadvpn-27470f46a55c478abe994dfa86646fad5dc3847e.tar.xz
mullvadvpn-27470f46a55c478abe994dfa86646fad5dc3847e.zip
Merge branch 'improve-rust-crate-versioning'
Diffstat (limited to 'mullvad-cli')
-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
4 files changed, 7 insertions, 12 deletions
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)