Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Windows: set exe file icon and PE metadata #6693

Merged
merged 12 commits into from
Jul 15, 2020

Conversation

Spoonbender
Copy link
Contributor

Fix: #6593

Windows: set executable icon and PE metadata

Result:
image
image

cli/Cargo.toml Outdated
[package.metadata.winres]
# On Windows, this section defines the metadata that appears in the Deno.exe Portable Executable header
OriginalFilename = "Deno.exe"
LegalCopyright = "Copyright © 2018-2020 the Deno authors. All rights reserved. MIT license."
Copy link
Contributor

@caspervonb caspervonb Jul 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's correct here so this is just a side note.

Was poking around on my Windows VM and for Microsoft products (notepad, explorer) etc this doesn't contain a year, it's just "© Microsoft Corporation. All Rights Reserved."

"Copyright: Copyright © 2018-2020 The Deno Authors" has a bit of an echo to it.

Copy link
Contributor Author

@Spoonbender Spoonbender Jul 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on what the deno project prefers really.

PuTTY has: Copyright © 1997 - 2017 Simon Tatham
RealVNC has: Copyright © 2002-2020 RealVNC Ltd.
nodejs has: Copyright Node.js contributors. MIT license.
Wireshark has: Copyright © 2000 Gerald Combs [email protected]
Firefox has: ©Firefox and Mozilla Developers: available under the MPL 2 license.
Chrome has: Copyright 2019 Google LLC. All rights reserved.

I guess I'll remove the "Copyright" and the years and the ©

cli/Cargo.toml Outdated Show resolved Hide resolved
cli/Cargo.toml Outdated Show resolved Hide resolved
@MarkTiedemann
Copy link
Contributor

When using the Windows dark mode, the dino and the rain aren't white so the icon looks a little bit off:

Capture

@Spoonbender
Copy link
Contributor Author

When using the Windows dark mode, the dino and the rain aren't white so the icon looks a little bit off:

Fixed - kept it transparent on the outside and white on the inside

@MarkTiedemann
Copy link
Contributor

MarkTiedemann commented Jul 10, 2020

Fixed - kept it transparent on the outside and white on the inside

Nice!

Minor nitpick: Now, the border has a few white pixels on my machine:

Capture

Note that the white pixels only appear when zooming out, e.g. "Large Icon" view. In the smaller "Tiles" view, for example, you can't see them.

@Spoonbender
Copy link
Contributor Author

Fixed - kept it transparent on the outside and white on the inside

Nice!

Minor nitpick: Now, the border has a few white pixels on my machine:

Capture

Note that the white pixels only appear when zooming out, e.g. "Large Icon" view. In the smaller "Tiles" view, for example, you can't see them.

Yeah, that is as far as my graphic skills go... maybe we can get one of the deno artists to provide an icon file that works well in light and dark themes?

@MarkTiedemann
Copy link
Contributor

@Spoonbender The default language seems to be "Language Neutral". Since Deno is only available in English so far, do you think it makes sense to set the language as well?

@Spoonbender
Copy link
Contributor Author

@Spoonbender The default language seems to be "Language Neutral". Since Deno is only available in English so far, do you think it makes sense to set the language as well?

Yes, because I can't resist the detailitis!

@ry ry requested a review from piscisaureus July 10, 2020 16:37
@MarkTiedemann
Copy link
Contributor

Yeah, that is as far as my graphic skills go... maybe we can get one of the deno artists to provide an icon file that works well in light and dark themes?

According to https://deno.land/artwork, @kevinkassimo created this logo. Perhaps he can help?

@lucacasonato
Copy link
Member

Now, the border has a few white pixels on my machine

@MarkTiedemann Image with infill, without the white border:

image

@MarkTiedemann
Copy link
Contributor

@lucacasonato Can you export the image as an .ico file for @Spoonbender?

@lucacasonato
Copy link
Member

@Spoonbender
Copy link
Contributor Author

Thanks @lucacasonato
This ICO file indeed solves the white lining.
I think it lacks the bigger sizes (shows small size even when displaying "Large" or "Extra Large" icons), though it could be just some issue on my machine.
Anyhow, committing this version for now.

@MarkTiedemann
Copy link
Contributor

I think it lacks the bigger sizes (shows small size even when displaying "Large" or "Extra Large" icons), though it could be just some issue on my machine.

Can confirm that this is an issue on my machine as well.

Capture

@lucacasonato
Copy link
Member

Huh that is weird. I exported it at the largest possible .ico size of 255x255. I'll take a look

@bartlomieju bartlomieju added build build system or continuous integration related cli related to cli/ dir windows Related to Windows platform labels Jul 14, 2020
@ry
Copy link
Member

ry commented Jul 14, 2020

I would lean towards just landing this. We can improve it in the future. Is there more work to be done here?

@piscisaureus
Copy link
Member

The white border is a conversion artefact I suspect - some tool was used to make the ICO and it dropped the alpha (transparency) channel.

But let's land it as-is. We can always improve it further, PR numbers are cheap :)

@lucacasonato
Copy link
Member

Can you try this .ico as a final attempt before landing? https://drive.google.com/file/d/1-10fAAErCQWQ-yVTCrcIXZEbeGMjDM-w/view?usp=sharing

@MarkTiedemann
Copy link
Contributor

Can you try this .ico as a final attempt before landing? https://drive.google.com/file/d/1-10fAAErCQWQ-yVTCrcIXZEbeGMjDM-w/view?usp=sharing

That one looks perfect to me, even with "Extra large icons". :)

Capture

@Spoonbender
Copy link
Contributor Author

Can you try this .ico as a final attempt before landing? https://drive.google.com/file/d/1-10fAAErCQWQ-yVTCrcIXZEbeGMjDM-w/view?usp=sharing

That one looks perfect to me, even with "Extra large icons". :)

Looks great! I committed and pushed this new icon, I guess we can move forward now @piscisaureus


#[cfg(target_os = "windows")]
fn set_binary_metadata() {
let mut res = winres::WindowsResource::new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really dig that we can pull this in as a cargo dep, rather than figuring out how to get rc.exe installed on every user's machine. I wish we could do that with our ninja/gn/python build dependencies too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through the implementation a couple of days ago, it doesn't bring it's rc.exe. It has to be in PATH which is the case if you have the Windows SDK.

Definitively agree that it is is clean and convenient how this works out tho!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why my original implementation did not treat winres compilation errors as fatal - so users without rc.exe can keep building Deno on their machines. I guess we can always improve this in the future, perhaps by fetching rc.exe on-demand, if the need arises.

Copy link
Member

@piscisaureus piscisaureus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@piscisaureus piscisaureus merged commit b0f2bd4 into denoland:master Jul 15, 2020
@MarkTiedemann MarkTiedemann mentioned this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build system or continuous integration related cli related to cli/ dir windows Related to Windows platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deno executable on Windows should have an icon
7 participants