-
Notifications
You must be signed in to change notification settings - Fork 15
improve flexibility of gethwrapper helpers #316
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
Conversation
| } else { | ||
| outDirSuffix = "latest" | ||
| } | ||
| outDirSuffix := "latest" |
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.
Wrappers are always generated into latest. Teams that wish to adopt this new wrapper generation should also adopt the versioned gethwrappers.
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.
Pull request overview
This PR improves the flexibility of gethwrapper helpers by removing the hardcoded relative location for the abigen executable. Instead, the changes allow passing the abigen executable path as an argument, making the wrapper generation more configurable.
Changes:
- Removed
GetProjectRoot()helper function that walked the filesystem to find the project root - Refactored wrapper generation logic into a reusable
wrappackage - Added
AbiGenPathparameter toAbigenArgsstruct to accept the abigen executable path as an argument
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| gethwrappers/helpers/utils.go | Removed unused GetProjectRoot() function and filepath import |
| gethwrappers/helpers/generate/wrap/wrap.go | New package containing extracted GenWrapper() and GetOutDir() functions |
| gethwrappers/helpers/generate/wrap.go | Refactored to use new wrap package and accept abiGenPath as command-line argument |
| gethwrappers/helpers/abigen.go | Updated to accept and use AbiGenPath parameter instead of computing path via GetProjectRoot() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // <project>/generated/<pkgName>/<pkgName>.go. The suffix will take place after | ||
| // the <project>/generated, so the overridden location would be | ||
| // <project>/generated/<outDirSuffixInput>/<pkgName>/<pkgName>.go. | ||
| func GenWrapper(projectRoot, contract, pkgName, outDirSuffixInput, abiGenPath string) { |
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.
q: is this function not used in this repo and only intended to be a helper for other repos? it looks to me like this repo only uses https://github.com/smartcontractkit/chainlink-evm/blob/modify-gethwrapper-helpers/gethwrappers/generation/generate/genwrapper/genwrapper.go?
nit: could we add a comment/example of what the projectRoot arg is?
The previous helpers required abigen to be in a hard coded relative location. These changes allow us to call the gethwrapper logic directly with args for the abigen executable.