diff --git a/Cargo.lock b/Cargo.lock index 9b6b288311..126dbb0121 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -426,6 +426,7 @@ dependencies = [ "webpki", "webpki-roots", "winapi 0.3.9", + "winres", ] [[package]] @@ -2522,6 +2523,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +dependencies = [ + "serde", +] + [[package]] name = "tower-service" version = "0.3.0" @@ -2919,6 +2929,15 @@ dependencies = [ "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]] name = "ws2_32-sys" version = "0.2.1" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 082782d5b3..25e0bdc31c 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -18,6 +18,10 @@ path = "main.rs" deno_core = { path = "../core", 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] deno_core = { path = "../core", version = "0.49.0" } deno_lint = "0.1.16" @@ -77,3 +81,10 @@ test_util = { path = "../test_util" } [target.'cfg(unix)'.dev-dependencies] 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." diff --git a/cli/build.rs b/cli/build.rs index 5cf4b02e2b..5d343c5f35 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -6,6 +6,11 @@ use std::collections::HashMap; use std::env; use std::path::PathBuf; +#[cfg(target_os = "windows")] +extern crate winapi; +#[cfg(target_os = "windows")] +extern crate winres; + fn main() { // Don't build V8 if "cargo doc" is being run. This is to support docs.rs. if env::var_os("RUSTDOCFLAGS").is_some() { @@ -111,4 +116,20 @@ fn main() { &main_module_name, ) .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() {} diff --git a/cli/deno.ico b/cli/deno.ico new file mode 100644 index 0000000000..6bb4a04530 Binary files /dev/null and b/cli/deno.ico differ