mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(cli): add icon and metadata to deno.exe on Windows (#6693)
Co-authored-by: Mark Tiedemann <www.marktiedemann@gmail.com> Co-authored-by: Luca Casonato <lucacasonato@yahoo.com> Co-authored-by: Bert Belder <bertbelder@gmail.com>
This commit is contained in:
parent
73a9036089
commit
b0f2bd4a2d
4 changed files with 51 additions and 0 deletions
19
Cargo.lock
generated
19
Cargo.lock
generated
|
@ -426,6 +426,7 @@ dependencies = [
|
||||||
"webpki",
|
"webpki",
|
||||||
"webpki-roots",
|
"webpki-roots",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
|
"winres",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2522,6 +2523,15 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.5.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-service"
|
name = "tower-service"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -2919,6 +2929,15 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winres"
|
||||||
|
version = "0.1.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff4fb510bbfe5b8992ff15f77a2e6fe6cf062878f0eda00c0f44963a807ca5dc"
|
||||||
|
dependencies = [
|
||||||
|
"toml",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ws2_32-sys"
|
name = "ws2_32-sys"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|
|
@ -18,6 +18,10 @@ path = "main.rs"
|
||||||
deno_core = { path = "../core", version = "0.49.0" }
|
deno_core = { path = "../core", version = "0.49.0" }
|
||||||
deno_typescript = { path = "../deno_typescript", version = "0.49.0" }
|
deno_typescript = { path = "../deno_typescript", version = "0.49.0" }
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.build-dependencies]
|
||||||
|
winres = "0.1"
|
||||||
|
winapi = "0.3.8"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deno_core = { path = "../core", version = "0.49.0" }
|
deno_core = { path = "../core", version = "0.49.0" }
|
||||||
deno_lint = "0.1.16"
|
deno_lint = "0.1.16"
|
||||||
|
@ -77,3 +81,10 @@ test_util = { path = "../test_util" }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dev-dependencies]
|
[target.'cfg(unix)'.dev-dependencies]
|
||||||
pty = "0.2.2"
|
pty = "0.2.2"
|
||||||
|
|
||||||
|
[package.metadata.winres]
|
||||||
|
# This section defines the metadata that appears in the deno.exe PE header.
|
||||||
|
OriginalFilename = "deno.exe"
|
||||||
|
LegalCopyright = "© Deno contributors & Deno Land Inc. MIT licensed."
|
||||||
|
ProductName = "Deno"
|
||||||
|
FileDescription = "A secure JavaScript/TypeScript runtime, built on V8 and Rust."
|
||||||
|
|
21
cli/build.rs
21
cli/build.rs
|
@ -6,6 +6,11 @@ use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
extern crate winapi;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
extern crate winres;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Don't build V8 if "cargo doc" is being run. This is to support docs.rs.
|
// Don't build V8 if "cargo doc" is being run. This is to support docs.rs.
|
||||||
if env::var_os("RUSTDOCFLAGS").is_some() {
|
if env::var_os("RUSTDOCFLAGS").is_some() {
|
||||||
|
@ -111,4 +116,20 @@ fn main() {
|
||||||
&main_module_name,
|
&main_module_name,
|
||||||
)
|
)
|
||||||
.expect("Failed to create snapshot");
|
.expect("Failed to create snapshot");
|
||||||
|
|
||||||
|
set_binary_metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn set_binary_metadata() {
|
||||||
|
let mut res = winres::WindowsResource::new();
|
||||||
|
res.set_icon("deno.ico");
|
||||||
|
res.set_language(winapi::um::winnt::MAKELANGID(
|
||||||
|
winapi::um::winnt::LANG_ENGLISH,
|
||||||
|
winapi::um::winnt::SUBLANG_ENGLISH_US,
|
||||||
|
));
|
||||||
|
res.compile().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn set_binary_metadata() {}
|
||||||
|
|
BIN
cli/deno.ico
Normal file
BIN
cli/deno.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
Loading…
Reference in a new issue