This PR contains enhancements for the binapi-generator and binapigen package. The aim was to finish the implementation of generator plugins and allow adding custom plugins by users.
This change contains the following changes:
[x] adds support for running external plugins in generator
external plugin is a binary (*.so) compiled from Go main package using go build -buildmode=plugin ...
this Go package must contain at least one exported function:
GenerateFile(g *binapigen.Generator, f *binapigen.File) *binapigen.GenFile (runs once for each file)
GenerateAll(g *binapigen.Generator) []*binapigen.GenFile (runs only once for all)
the binapi-generator accepts path to an external plugin and loads its symbol (via plugin package)
[x] adds universal input reference URI to the generator, resolving the VPP input parameters depending on the format
supporte formats are:
path to directory to VPP API files (e.g. /usr/share/vpp/api)
path to directory containing VPP repository (runs make json-api-files automatically)
(more formats will be added in the future..)
[x] adds new helper functions and constructors to generated code for converting address types like Address, MacAddress, Prefix, .. into types from net package (IP, IPNet...)
[x] minor cleanups/refactorings of code in binapigen package
This PR includes collective changes from Nathan's PRs: #67 #68
This PR contains enhancements for the binapi-generator and binapigen package. The aim was to finish the implementation of generator plugins and allow adding custom plugins by users.
This change contains the following changes:
*.so
) compiled from Go main package usinggo build -buildmode=plugin ...
GenerateFile(g *binapigen.Generator, f *binapigen.File) *binapigen.GenFile
(runs once for each file)GenerateAll(g *binapigen.Generator) []*binapigen.GenFile
(runs only once for all)plugin
package)/usr/share/vpp/api
)make json-api-files
automatically)Address
,MacAddress
,Prefix
, .. into types fromnet
package (IP
,IPNet
...)binapigen
packageThis PR includes collective changes from Nathan's PRs: #67 #68
There is a discussion created for design and overall info for this feature: https://github.com/FDio/govpp/discussions/94