diff options
| -rw-r--r-- | mullvad-cli/build.rs | 7 | ||||
| -rw-r--r-- | mullvad-cli/src/main.rs | 6 | ||||
| -rw-r--r-- | mullvad-daemon/src/cli.rs | 2 | ||||
| -rw-r--r-- | mullvad-daemon/src/main.rs | 4 | ||||
| -rw-r--r-- | mullvad-daemon/src/version.rs | 2 | ||||
| -rw-r--r-- | mullvad-problem-report/build.rs | 14 | ||||
| -rw-r--r-- | mullvad-problem-report/src/metadata.rs | 6 |
7 files changed, 15 insertions, 26 deletions
diff --git a/mullvad-cli/build.rs b/mullvad-cli/build.rs index 126fbafc03..3c59e07c65 100644 --- a/mullvad-cli/build.rs +++ b/mullvad-cli/build.rs @@ -3,10 +3,15 @@ extern crate winapi; #[cfg(windows)] extern crate winres; +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(); + #[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_icon("../dist-assets/icon.ico"); diff --git a/mullvad-cli/src/main.rs b/mullvad-cli/src/main.rs index 68d4bf7194..5d0bd921ed 100644 --- a/mullvad-cli/src/main.rs +++ b/mullvad-cli/src/main.rs @@ -19,7 +19,7 @@ extern crate talpid_types; mod cmds; -use clap::{crate_authors, crate_description, crate_name, crate_version}; +use clap::{crate_authors, crate_description, crate_name}; use mullvad_ipc_client::{new_standalone_ipc_client, DaemonRpcClient}; use std::alloc::System; @@ -29,6 +29,8 @@ use std::io; #[global_allocator] static GLOBAL: System = System; +pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")); + error_chain! { foreign_links { @@ -53,7 +55,7 @@ fn run() -> Result<()> { let commands = cmds::get_commands(); let app = clap::App::new(crate_name!()) - .version(crate_version!()) + .version(PRODUCT_VERSION) .author(crate_authors!()) .about(crate_description!()) .setting(clap::AppSettings::SubcommandRequired) diff --git a/mullvad-daemon/src/cli.rs b/mullvad-daemon/src/cli.rs index d1dcd66a73..017a15a3e9 100644 --- a/mullvad-daemon/src/cli.rs +++ b/mullvad-daemon/src/cli.rs @@ -37,7 +37,7 @@ pub fn get_config() -> Config { fn create_app() -> App<'static, 'static> { let app = App::new(crate_name!()) - .version(version::CURRENT) + .version(version::PRODUCT_VERSION) .author(crate_authors!()) .about(crate_description!()) .arg( diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index 26a67824ae..7f9771592f 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -144,7 +144,7 @@ fn create_daemon(config: &cli::Config) -> Result<Daemon> { log_dir, resource_dir, cache_dir, - version::CURRENT.to_owned(), + version::PRODUCT_VERSION.to_owned(), ) .chain_err(|| "Unable to initialize daemon") } @@ -153,7 +153,7 @@ fn log_version() { info!( "Starting {} - {} {}", env!("CARGO_PKG_NAME"), - version::CURRENT, + version::PRODUCT_VERSION, version::COMMIT_DATE, ) } diff --git a/mullvad-daemon/src/version.rs b/mullvad-daemon/src/version.rs index 2c28c2bba4..f02e2b5fda 100644 --- a/mullvad-daemon/src/version.rs +++ b/mullvad-daemon/src/version.rs @@ -1,5 +1,5 @@ /// A string that identifies the current version of the application -pub const CURRENT: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")); +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")); diff --git a/mullvad-problem-report/build.rs b/mullvad-problem-report/build.rs index 7dfd55b2c3..e806ed4361 100644 --- a/mullvad-problem-report/build.rs +++ b/mullvad-problem-report/build.rs @@ -1,7 +1,6 @@ use std::env; use std::fs; use std::path::PathBuf; -use std::process::Command; #[cfg(windows)] extern crate winapi; @@ -13,7 +12,6 @@ fn main() { 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)] { @@ -27,15 +25,3 @@ fn main() { res.compile().expect("Unable to generate windows resources"); } } - - -fn commit_date() -> String { - let output = Command::new("git") - .args(&["log", "-1", "--date=short", "--pretty=format:%cd"]) - .output() - .expect("Unable to get git commit date"); - ::std::str::from_utf8(&output.stdout) - .unwrap() - .trim() - .to_owned() -} diff --git a/mullvad-problem-report/src/metadata.rs b/mullvad-problem-report/src/metadata.rs index d176d66c45..cddbe57892 100644 --- a/mullvad-problem-report/src/metadata.rs +++ b/mullvad-problem-report/src/metadata.rs @@ -2,11 +2,7 @@ use std::collections::HashMap; use std::process::Command; use uuid; -pub const PRODUCT_VERSION: &str = concat!( - include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")), - " ", - include_str!(concat!(env!("OUT_DIR"), "/git-commit-date.txt")) -); +pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")); pub fn collect() -> HashMap<String, String> { let mut metadata = HashMap::new(); |
