From afcacda35fc1a08d2e11330f72a5a70b415eb11c Mon Sep 17 00:00:00 2001 From: Reilly Wood <26268125+rgwood@users.noreply.github.com> Date: Tue, 24 May 2022 23:28:10 -0400 Subject: [PATCH] Change `embed-resource` dep to slimmer `winres` (#5630) --- Cargo.lock | 44 ++++++++++-------------------------------- Cargo.toml | 2 +- assets/nushell.rc | 49 ----------------------------------------------- build.rs | 8 +++++++- 4 files changed, 18 insertions(+), 85 deletions(-) delete mode 100644 assets/nushell.rc diff --git a/Cargo.lock b/Cargo.lock index 6cebf66d75..280d9dbaa6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -910,19 +910,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "embed-resource" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc24ff8d764818e9ab17963b0593c535f077a513f565e75e4352d758bc4d8c0" -dependencies = [ - "cc", - "rustc_version", - "toml", - "vswhom", - "winreg", -] - [[package]] name = "eml-parser" version = "0.1.3" @@ -2413,7 +2400,6 @@ dependencies = [ "chrono", "crossterm", "ctrlc", - "embed-resource", "hamcrest2", "is_executable", "itertools", @@ -2443,6 +2429,7 @@ dependencies = [ "rstest", "serial_test", "tempfile", + "winres", ] [[package]] @@ -4931,26 +4918,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "vswhom" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" -dependencies = [ - "libc", - "vswhom-sys", -] - -[[package]] -name = "vswhom-sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22025f6d8eb903ebf920ea6933b70b1e495be37e2cb4099e62c80454aaf57c39" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "vte" version = "0.10.1" @@ -5295,6 +5262,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index 0791d462e9..a6ef2c7619 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ rstest = "0.12.0" itertools = "0.10.3" [target.'cfg(windows)'.build-dependencies] -embed-resource = "1" +winres = "0.1" [features] plugin = ["nu-plugin", "nu-cli/plugin", "nu-parser/plugin", "nu-command/plugin", "nu-protocol/plugin", "nu-engine/plugin"] diff --git a/assets/nushell.rc b/assets/nushell.rc deleted file mode 100644 index db3d18f42f..0000000000 --- a/assets/nushell.rc +++ /dev/null @@ -1,49 +0,0 @@ -#include - -#define VER_FILEVERSION 0,62,1,0 -#define VER_FILEVERSION_STR "0.62.1" - -#define VER_PRODUCTVERSION 0,62,1,0 -#define VER_PRODUCTVERSION_STR "0.62.1" - -#ifdef RC_INVOKED - -#ifdef DEBUG // TODO: Actually define DEBUG -#define VER_DEBUG VS_FF_DEBUG -#else -#define VER_DEBUG 0 -#endif - -VS_VERSION_INFO VERSIONINFO -FILEVERSION VER_FILEVERSION -PRODUCTVERSION VER_PRODUCTVERSION -FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -FILEFLAGS VER_DEBUG -FILEOS VOS__WINDOWS32 -FILETYPE VFT_APP -FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "nushell" - VALUE "FileDescription", "Nushell" - VALUE "FileVersion", VER_FILEVERSION_STR - VALUE "InternalName", "nu.exe" - VALUE "LegalCopyright", "Copyright (C) 2022" - VALUE "OriginalFilename", "nu.exe" - VALUE "ProductName", "Nushell" - VALUE "ProductVersion", VER_PRODUCTVERSION_STR - END - END - - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#define IDI_ICON 0x101 -IDI_ICON ICON "assets/nu_logo.ico" -#endif \ No newline at end of file diff --git a/build.rs b/build.rs index 7b2ee7082a..5eefb36956 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,12 @@ #[cfg(windows)] fn main() { - embed_resource::compile_for("assets/nushell.rc", &["nu"]) + let mut res = winres::WindowsResource::new(); + res.set("ProductName", "Nushell"); + res.set("FileDescription", "Nushell"); + res.set("LegalCopyright", "Copyright (C) 2022"); + res.set_icon("assets/nu_logo.ico"); + res.compile() + .expect("Failed to run the Windows resource compiler (rc.exe)"); } #[cfg(not(windows))]