Add basic resource file for Windows binary (#4745)

This commit is contained in:
Genna Wingert 2022-03-05 22:56:23 +01:00 committed by GitHub
parent 4aa9a18c63
commit fa7d66347f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 1 deletions

45
Cargo.lock generated
View file

@ -925,6 +925,19 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "embed-resource"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e813aabad49e547de6abcc81004dfced79226fb3a14d73c26aabc2816ee8c7f"
dependencies = [
"cc",
"rustc_version",
"toml",
"vswhom",
"winreg 0.10.1",
]
[[package]]
name = "eml-parser"
version = "0.1.2"
@ -2123,6 +2136,7 @@ dependencies = [
"crossterm",
"crossterm_winapi",
"ctrlc",
"embed-resource",
"hamcrest2",
"is_executable",
"itertools",
@ -3471,7 +3485,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"winreg",
"winreg 0.7.0",
]
[[package]]
@ -4530,6 +4544,26 @@ 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"
@ -4836,6 +4870,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
[[package]]
name = "xmlparser"
version = "0.13.3"

View file

@ -74,6 +74,9 @@ hamcrest2 = "0.3.0"
rstest = "0.12.0"
itertools = "0.10.3"
[target.'cfg(windows)'.build-dependencies]
embed-resource = "1"
[features]
plugin = ["nu-plugin", "nu-parser/plugin", "nu-command/plugin", "nu-protocol/plugin", "nu-engine/plugin"]
default = ["plugin", "inc", "example", "which"]

BIN
assets/nu_logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

50
assets/nushell.rc Normal file
View file

@ -0,0 +1,50 @@
#include <winver.h>
#include <ntdef.h>
#define VER_FILEVERSION 0,59,1,0
#define VER_FILEVERSION_STR "0.59.1"
#define VER_PRODUCTVERSION 0,59,1,0
#define VER_PRODUCTVERSION_STR "0.59.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

7
build.rs Normal file
View file

@ -0,0 +1,7 @@
#[cfg(windows)]
fn main() {
embed_resource::compile_for("assets/nushell.rc", &["nu"])
}
#[cfg(not(windows))]
fn main() {}