Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(codegen): Include plugin information
Include the configured plugin's env, name, sha256 and URL
  • Loading branch information
kyleconroy committed Oct 13, 2023
commit e87feb7e2fad2e45dc6a4943fca391e99bd14c81
34 changes: 34 additions & 0 deletions internal/cmd/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func pluginSettings(r *compiler.Result, cs config.CombinedSettings) *plugin.Sett
Overrides: over,
Rename: cs.Rename,
Codegen: pluginCodegen(cs.Codegen),
Plugin: pluginPlugin(cs),
}
}

Expand All @@ -73,6 +74,39 @@ func pluginCodegen(s config.Codegen) *plugin.Codegen {
}
}

func pluginProcess(p config.Plugin) *plugin.Plugin_Process {
if p.Process != nil {
return &plugin.Plugin_Process{
Cmd: p.Process.Cmd,
}
}
return nil
}

func pluginWASM(p config.Plugin) *plugin.Plugin_WASM {
if p.WASM != nil {
return &plugin.Plugin_WASM{
Url: p.WASM.URL,
Sha256: p.WASM.SHA256,
}
}
return nil
}

func pluginPlugin(cs config.CombinedSettings) *plugin.Plugin {
for _, p := range cs.Global.Plugins {
if p.Name == cs.Codegen.Plugin {
return &plugin.Plugin{
Name: p.Name,
Env: p.Env,
Process: pluginProcess(p),
Wasm: pluginWASM(p),
}
}
}
return nil
}

func pluginGoType(o config.Override) *plugin.ParsedGoType {
// Note that there is a slight mismatch between this and the
// proto api. The GoType on the override is the unparsed type,
Expand Down
Loading