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

Place khrplatform.h side-by-side with generated Go files #126

Closed
wants to merge 1 commit into from

Conversation

myaaaaaaaaa
Copy link

go-gl/gl#159 clobbers go-gl/gl#141 and go-gl/gl#142 , so this is an attempt at a different fix from the glow side.

@andydotxyz Can you check to see if vendoring works with this patch applied? Instructions for using glow are available here

@andydotxyz
Copy link

Sorry for the delay, I had a long backlog and this was not set up on my current dev computer. Will attempt to get to it next...

@andydotxyz
Copy link

andydotxyz commented Dec 31, 2023

Unfortunately following the instructions doesn't work - I think Go does not allow relative package lookup any more?

[master] ><> go generate -tags gen .
go: no packages loaded from ../glow/
generate.go:4: running "go": exit status 1

Do you know how to work around this?

@dmitshur
Copy link
Member

dmitshur commented Jan 1, 2024

@andydotxyz It could be convenient to use a go workspace for this.
Try go work init . ../glow or something along those lines.

@andydotxyz
Copy link

@andydotxyz It could be convenient to use a go workspace for this. Try go work init . ../glow or something along those lines.

Thanks so much, that is the perfect solution - was not familiar with workspace!

@andydotxyz
Copy link

When I vendor a project built in this way I get the header file both inside the KHR folder and outside it...

If I remove the KHR folders the app still works, so it seems like this patch is going to be successful, but currently leaves artifacts of the old way...

@myaaaaaaaaa
Copy link
Author

When I vendor a project built in this way I get the header file both inside the KHR folder and outside it...

The CI bot in go-gl/gl#159 removes all subdirectories before regenerating the files, so there shouldn't be any problems in this regard once it's up and running.

If I remove the KHR folders the app still works, so it seems like this patch is going to be successful, but currently leaves artifacts of the old way...

Great, thanks for confirming!

@andydotxyz
Copy link

The CI bot in go-gl/gl#159 removes all subdirectories before regenerating the files, so there shouldn't be any problems in this regard once it's up and running.

I don't understand how this relates.
If I run vendor locally it doesn't use the CI at all, but I get two copies of the header file in my project (the vendor folder was created newly by the command I ran).

@myaaaaaaaaa
Copy link
Author

The CI bot in go-gl/gl#159 removes all subdirectories before regenerating the files, so there shouldn't be any problems in this regard once it's up and running.

I don't understand how this relates. If I run vendor locally it doesn't use the CI at all, but I get two copies of the header file in my project (the vendor folder was created newly by the command I ran).

The bot in go-gl/gl#159 essentially works by periodically running rm -r */ && go generate and automatically opening a PR directly from CI if there were any changes.

The motivation behind this PR in the first place was that the rm -r */ line would have clobbered your own patches (go-gl/gl#141 and go-gl/gl#142), necessitating a different fix.

For an example of a PR created by this bot, see myaaaaaaaaa/gl#5

@andydotxyz
Copy link

andydotxyz commented Jan 5, 2024

Hmm, maybe I follow - a conflict with what was in the repo and what the generation overlaid I guess.
I forced removal of all KHR and re-generated.

Now when I use the project with a replace in my go.mod I get:

fyne.io/fyne/v2/internal/painter/gl imports
	github.com/go-gl/gl/v2.1/gl imports
	github.com/go-gl/gl/v2.1/gl/KHR: module github.com/go-gl/gl@latest found (v0.0.0-20231021071112-07e5d0ea2e71, replaced by ../../gl), but does not contain package github.com/go-gl/gl/v2.1/gl/KHR
fyne.io/fyne/v2/internal/painter/gl imports
	github.com/go-gl/gl/v3.1/gles2 imports
	github.com/go-gl/gl/v3.1/gles2/KHR: module github.com/go-gl/gl@latest found (v0.0.0-20231021071112-07e5d0ea2e71, replaced by ../../gl), but does not contain package github.com/go-gl/gl/v3.1/gles2/KHR

but I cannot figure out how this import is happening - maybe it's build_cgo_hack.go?

@andydotxyz
Copy link

andydotxyz commented Jan 5, 2024

Ah yes confirmed, the cgo hack files will need to be removed from go-gl as well - but I guess that is a different PR?

If so then this looks good to me, thanks.

@myaaaaaaaaa
Copy link
Author

Ah yes confirmed, the cgo hack files will need to be removed from go-gl as well - but I guess that is a different PR?

If so then this looks good to me, thanks.

Great, thanks for confirming!

The bot removes all child directories (meaning not only the KHR directories, but also its gl parent directories and their own v#.# parent directories), so the cgo hack files will also be removed.

@myaaaaaaaaa myaaaaaaaaa closed this by deleting the head repository Sep 22, 2024
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.

3 participants