-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[v3] New binding generator #3468
Merged
leaanthony
merged 158 commits into
wailsapp:v3-alpha
from
fbbdev:feat/bindgen_v2_alltypes
May 19, 2024
Merged
[v3] New binding generator #3468
leaanthony
merged 158 commits into
wailsapp:v3-alpha
from
fbbdev:feat/bindgen_v2_alltypes
May 19, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Additionally: * fixes generation of tuple return type * improves imports and namespacing in JS mode * general cleanup of generated code
Improves support for unknown types (encoded as any) and maps (using Typescript index signatures)
* Makes call by ID the default
fbbdev
force-pushed
the
feat/bindgen_v2_alltypes
branch
2 times, most recently
from
May 18, 2024 13:16
609611c
to
6d42438
Compare
leaanthony
approved these changes
May 19, 2024
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.
Legendary!
leaanthony
requested changes
May 19, 2024
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.
Looks like there's some newline issues when running the tests on Windows
leaanthony
approved these changes
May 19, 2024
fbbdev
force-pushed
the
feat/bindgen_v2_alltypes
branch
from
May 19, 2024 10:01
de27a63
to
dc1dd61
Compare
leaanthony
approved these changes
May 19, 2024
fbbdev
force-pushed
the
feat/bindgen_v2_alltypes
branch
from
May 19, 2024 10:30
3d253b2
to
d0d615a
Compare
leaanthony
approved these changes
May 19, 2024
fbbdev
force-pushed
the
feat/bindgen_v2_alltypes
branch
from
May 19, 2024 10:38
d0d615a
to
bc598cb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR proposes an entirely new binding generator for Wails v3, based upon the official type-checker package
go/types
.Details have been (and still are being) discussed in the dedicated forum on the Discord server. A preliminary feature list is available here (combine all features marked 'essential' and 'optional'). An improved and more complete feature list is being prepared.
The PR branch has a tortuous commit history that goes through multiple refactorings and rewrites. Things are very entangled and cleaning it up would not be easy. Older commits hide sometimes massive amounts of test data with multiple updates. Should the PR be merged at some point, I suggest squashing it into a single commit and erasing the whole commit history from the commit message.
A few heads-ups for testers and reviewers:
golang.org/x/tools
module (v0.21.0) due to bugs that have been patched only recently; thego.mod
file has been updated accordingly;generate bindings
command now generates calls by ID by default; the-names
option can be used to switch to calls by name;application.NewService
(see theexamples/binding
for an example).This PR introduces some (hopefully non-breaking) changes to the binding backend and the JS runtime:
BoundMethod
andCallOptions
have been changed to store fully qualified names (strings of the form"[path].[type].[method]"
) instead of path-type-method triples;Todos
The last point is not essential for functionality but I've come to see it as critical for maintainability: there is too much duplicated code and it is way too easy for the various copies to get out of sync. The resulting bugs are often hard to notice because they do not produce hard failures or warning messages. This has happened to me many many times while working on the patch and I fear it is going to happen to others too. Templates are based upon the
text/template
package. Knowledgeable people are welcome to contribute!Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Dedicated test suite (that has been enriched with new tests) passes fully. Its output has been examined carefully (please do review it!). The binding example works fine.
Test Configuration
Checklist:
website/src/pages/changelog.mdx
with details of this PR