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
Add icon & file info to syncthing.exe #4645
Add icon & file info to syncthing.exe #4645
Conversation
6e39325
to
24b8901
Compare
I think vendoring is not done the right way. You should use gvt tool which should then update the manifest. I am not sure this syso file should live in the cmd directory, perhaps the build directory or some temp directory? Also, I assume you only want to do this for GOOS=windows only, yet potentially support cross compiling. |
We should also potentially populate File Version. |
Got it.
I believe it has to be put in the
Doesn't really matter since it doesn't impact other builds but this is only needed when building for Windows. I could add a platform check to
I wasn't sure what to update it to. Unfortunately, contrary to what the |
Right, I misunderstood how the syso stuff works. It seem the compiler takes care of it. Well our version as it stands now is 0.14.something, so that fits in nicely with 0.14.something.somethingelse. Where something else could be 0 in most cases, or N if we are ahead of some specific version tag by N commits (N is that +5 in the log version tag). Or even start of the commit hash converted from hex to dec. |
For the file version, as long as we stick with the XX.YY.ZZ versioning we have the first 3 number of the version. For the 4th number we could use the release candidate number but that would tightly couple us to the tag format/layout. I'll look into using the commit hash converted into a decimal number. |
24b8901
to
7441f12
Compare
Here's what file properties looks like with the new code: From the failing checks I'm going to need some help with the vendoring. I ran the command |
@@ -427,7 +429,13 @@ func install(target target, tags []string) { | |||
|
|||
os.Setenv("GOOS", goos) | |||
os.Setenv("GOARCH", goarch) | |||
|
|||
// The syso file doesn't affect non-Windows builds so it's fine to build it even when goos!=windows. | |||
sysoPath := mustBuildSyso(cwd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if not strictly necessary, I would still wrap it in if goos == "windows"
- it's clear and more concise than the comment. Using defer you can put shouldCleanupSyso
into the same if block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Hopefully I can blame completely forgetting defer
exists on being sick :|
What is the purpose of the file version as opposed to the product version? Generally I think it is a bad idea to put the number of commits since release as the last version number - that will create more confusion than be of help to anyone. I would just set it to 0 (if we need file version anyway). The vendoring seems perfectly fine and works locally for me, I don't know what the build servers problem is (it's the first external dependency in build.go, but I don't see how that's different). |
If we had some way to track different versions for each binary As for the final "build" version, I like the idea of making it equal to the number of commits ahead as it (should) make it easier to determine the exact commit the binary was built from. Why do you think it would cause confusion? How do you test the vendoring locally? |
I just build it (without having it in my normal GOPATH, only vendor dir) and it works. I can't follow how the time when a binary was built has anything to do with its version. For me a version is a tagged commit - it doesn't matter when the binary is built (I know about the reproducible build issue, but that's hardly what you are after here). I don't think commits ahead are relevant for developers, at least I never came into the situation where I came upon a syncthing binary and needed to know which commit it is from - I just remove it and build whatever commit I need. For the user it is just as useless (what is a commit?) and might prompt confusion about a version that doesn't seem to exist in our releases at all. |
Sorry, I wasn't super clear. "Time" doesn't really matter here. What I was trying to suggest was that if we set the "product version" to the release version "0.14.43" and we somehow built the binaries from different commits the file versions could be different than the product version. We don't do that however.
It might be useful in bug reports. If a user files a bug we could ask for the full version and then we'd know exactly what commit their version was compiled from. |
That information in the product version as per your screenshot and it's also obtainable with Also we are bikeshedding hard here, the actual issue is the weird build problem - hopefully it's obvious and @AudriusButkevicius or @calmh will see it (tomorrow). |
Let's put it this way, what's the downside of adding commits ahead? This just adds yet another way to find non-clean builds. |
So yeah the build issue is nontrivial. Or, I mean, it's trivial to the extent that a However, this could be moved into a separate script in The only way to get it to use vendored dependencies even in that case would be to build it to a binary and then run it. But what we typically do instead is mention the dependency in the But if we're going down that path we might as well go install the goversioninfo binary and use that directly to generate the thing. To do that, just add it to the I'm not entirely up to date on Windows versioning semantics, but the "product version" being the full string as in the screenshot looks reasonable. If another field is limited to four digits, setting the last digits to the +commits part of the version string seems perfectly fine to me. (I think in Windows the fourth number is an ever increasing build number, which is bizarre when you're used to more minor number resetting when a more major component is bumped, but I don't think this matters.) |
@calmh I'm new to vendoring but why don't the build machines use the vendored version of |
They do. But you're not building anything. build.go is run as I'd also be sort of happy if that didn't matter, but that's how the go compiler works. |
And the "reason" why |
This is still very cool and we should still do this. |
So practically I suggest,
I'll make sure it gets installed in our build environment. |
Thanks for the guidance. I'll attempt to address this this weekend. |
I'd still love this to be there 😢 |
Finally found time for this. new PR: #4839 |
Purpose
This change fixes/addresses #3668 by adding an Icon to the Windows
syncthing.exe
binary.Testing
go run build.go
- successbinary was created at
bin/syncthing.exe` - successNote, I tested this build on a Windows machine.
Screenshots
Documentation
I don't believe this requires a documentation change.
Authorship
Every author of a code contribution (Go, Javascript, HTML, CSS etc, with the
possible exception of minor typo corrections and similar) is recorded in the
AUTHORS and NICKS files and the in-GUI credits. If this is your first
contribution, a maintainer will add you properly before accepting the
contribution. You need not do so yourself or worry about the fact that the
"authors" automated test fails. However, if your name (such as you want it
presented in the credits) is not visible on your Github profile or in your
commit messages, please assist by providing it here.