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

return 0.0.0.0 if no tag found #16

Merged
merged 1 commit into from
Oct 13, 2023
Merged

return 0.0.0.0 if no tag found #16

merged 1 commit into from
Oct 13, 2023

Conversation

ginglis13
Copy link
Contributor

Description

The git-tag value means the current tag will be retrieved from git describe --tags and add it to the properties of the executable: https://github.com/tc-hib/go-winres#automatic-version-from-git This does not work if the current working repository has no tags in its history, such as my fork of this repo.

Instead use git describe --tags --always to always return a value from git describe - defaulting to the latest commit if no tags found: https://git-scm.com/docs/git-describe#Documentation/git-describe.txt---always

Also, updates go.mod and go.sum

Testing

go test ./...

Context

In cmd/finch/main_windows.go, we are calling go-winres make with flags set to git-tag:

https://github.com/runfinch/finch/blob/76adf59588b1455a535f389eb4c714e1b9daede3/cmd/finch/main_windows.go#L6

//go:generate go-winres make --file-version=git-tag --product-version=git-tag --arch amd64 --in ../../winres/winres.json

Building is failing if the build occurs in a repository with no local tags. It’s only after I have my upstream remote set to the main finch repo and run git fetch upstream --tags that I can successfully build finch.

ginglis13 added a commit to runfinch/finch that referenced this pull request Oct 6, 2023
Issue #, if available:

*Description of changes:*

upstream dependency go-winres uses `git tag` to embed versioning in
Windows binary. However, if the repo from which finch is being built has
no tags, build will fail. Add note on how to fetch upstream finch tags.

See tc-hib/go-winres#16

*Testing done:*



- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Signed-off-by: Gavin Inglis <[email protected]>
@tc-hib
Copy link
Owner

tc-hib commented Oct 6, 2023

Hi,

Thank you for this pull request.
The product-version argument is expected to be an actual version number.
IIRC, it is parsed to extract the 4 levels of the version number.
So I'm not sure an abbreviated git object name would be appropriate as a fallback.

Maybe we should use "0.0.0.0" instead ?

The git-tag value means the current tag will be retrieved from git
describe --tags and add it to the properties of the executable:
https://github.com/tc-hib/go-winres#automatic-version-from-git
This does not work if the current working repository has no tags
in its history, such as my fork of this repo.

Instead, return a "0.0.0.0" version.

Signed-off-by: Gavin Inglis <[email protected]>
@ginglis13 ginglis13 changed the title use --always in git describe --tags return 0.0.0.0 if no tag found Oct 6, 2023
@ginglis13
Copy link
Contributor Author

Hi,

Thank you for this pull request. The product-version argument is expected to be an actual version number. IIRC, it is parsed to extract the 4 levels of the version number. So I'm not sure an abbreviated git object name would be appropriate as a fallback.

Maybe we should use "0.0.0.0" instead ?

Sounds good to me. Added a revision that uses "0.0.0.0"

@tc-hib tc-hib merged commit d743268 into tc-hib:main Oct 13, 2023
vsiravar pushed a commit to runfinch/finch that referenced this pull request Oct 17, 2023
Issue #, if available:

*Description of changes:*

upstream dependency go-winres uses `git tag` to embed versioning in
Windows binary. However, if the repo from which finch is being built has
no tags, build will fail. Add note on how to fetch upstream finch tags.

See tc-hib/go-winres#16

*Testing done:*



- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Signed-off-by: Gavin Inglis <[email protected]>
vsiravar pushed a commit to runfinch/finch that referenced this pull request Oct 17, 2023
Issue #, if available:

*Description of changes:*

upstream dependency go-winres uses `git tag` to embed versioning in
Windows binary. However, if the repo from which finch is being built has
no tags, build will fail. Add note on how to fetch upstream finch tags.

See tc-hib/go-winres#16

*Testing done:*

- [x] I've reviewed the guidance in CONTRIBUTING.md

#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Signed-off-by: Gavin Inglis <[email protected]>
Signed-off-by: Vishwas Siravara <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants