Documentation
¶
Index ¶
- Constants
- Variables
- func AnalyzeCliImports(ctx context.Context, le *logrus.Entry, sourcePath string, cliPkgs []string, ...) (map[string]CliImport, error)
- func FormatCliEntrypoint(appName string, projectID string, factoryImports map[string]FactoryImport, ...) ([]byte, error)
- func NewFactory(b bus.Bus) controller.Factory
- func ResolveComposePackage(pkg, rootModule string) string
- type CliImport
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (x *Config) GetCliPkgs() []string
- func (x *Config) GetComposePackage() string
- func (c *Config) GetConfigID() string
- func (x *Config) GetConfigSet() map[string]*proto.ControllerConfig
- func (x *Config) GetGoPkgs() []string
- func (x *Config) GetProjectId() string
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Config_ConfigSetEntry
- func (x *Config_ConfigSetEntry) GetKey() string
- func (x *Config_ConfigSetEntry) GetValue() *proto.ControllerConfig
- func (x *Config_ConfigSetEntry) MarshalJSON() ([]byte, error)
- func (x *Config_ConfigSetEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_ConfigSetEntry) MarshalProtoText() string
- func (*Config_ConfigSetEntry) ProtoMessage()
- func (x *Config_ConfigSetEntry) Reset()
- func (x *Config_ConfigSetEntry) String() string
- func (x *Config_ConfigSetEntry) UnmarshalJSON(b []byte) error
- func (x *Config_ConfigSetEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Controller
- type Factory
- type FactoryImport
Constants ¶
const ConfigID = "bldr/cli/compiler"
ConfigID is the config identifier.
const ControllerID = ConfigID
ControllerID is the compiler controller ID.
Variables ¶
var Version = controller.MustParseVersion("0.0.1")
Version is the controller version.
Functions ¶
func AnalyzeCliImports ¶ added in v0.57.3
func AnalyzeCliImports(ctx context.Context, le *logrus.Entry, sourcePath string, cliPkgs []string, goos, goarch string) (map[string]CliImport, error)
AnalyzeCliImports validates the command builders of cliPkgs for a target platform.
func FormatCliEntrypoint ¶
func FormatCliEntrypoint( appName string, projectID string, factoryImports map[string]FactoryImport, cliImports map[string]CliImport, composePackage string, ) ([]byte, error)
FormatCliEntrypoint formats the generated CLI entrypoint code.
When composePackage is set, the generated main calls its Compose function once. Its configured factories register before discovered defaults, so the static resolver retains the configured factory at an equal version.
func NewFactory ¶
func NewFactory(b bus.Bus) controller.Factory
NewFactory constructs a new CLI compiler controller factory.
func ResolveComposePackage ¶
ResolveComposePackage resolves a compose package path relative to the project module. Empty stays empty.
Types ¶
type CliImport ¶ added in v0.57.2
type CliImport struct {
// Alias is the import alias for the package.
Alias string
}
CliImport describes a discovered NewCliCommands in a Go package.
type Config ¶
type Config struct {
// GoPkgs is a list of Go packages to scan for controller factories.
// Looks for package-level NewFactory(b bus.Bus) controller.Factory functions.
GoPkgs []string `protobuf:"bytes,1,rep,name=go_pkgs,json=goPkgs,proto3" json:"goPkgs,omitempty"`
// CliPkgs is a list of Go packages providing CLI commands.
// Each package must export NewCliCommands.
CliPkgs []string `protobuf:"bytes,2,rep,name=cli_pkgs,json=cliPkgs,proto3" json:"cliPkgs,omitempty"`
// ConfigSet is a ConfigSet to apply on CLI startup.
// This will be embedded in the CLI binary.
ConfigSet map[string]*proto.ControllerConfig `` /* 175-byte string literal not displayed */
// ProjectId overrides the project id set in the project config.
ProjectId string `protobuf:"bytes,4,opt,name=project_id,json=projectId,proto3" json:"projectId,omitempty"`
// ComposePackage is a Go package exporting Compose() *compose.Composition
// from bldr/entrypoint/compose. The CLI calls it once at startup and adds the
// returned factories and commands. May be relative to the project module.
ComposePackage string `protobuf:"bytes,5,opt,name=compose_package,json=composePackage,proto3" json:"composePackage,omitempty"`
// contains filtered or unexported fields
}
Config configures the CLI compiler controller.
Builds a standalone CLI binary from a bldr.yaml manifest. Scans go_pkgs for controller factories and cli_pkgs for CLI commands.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the config is equal to another.
func (*Config) GetCliPkgs ¶
func (*Config) GetComposePackage ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetConfigSet ¶
func (x *Config) GetConfigSet() map[string]*proto.ControllerConfig
func (*Config) GetProjectId ¶
func (*Config) MarshalJSON ¶
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type Config_ConfigSetEntry ¶
type Config_ConfigSetEntry struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value *proto.ControllerConfig `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*Config_ConfigSetEntry) GetKey ¶
func (x *Config_ConfigSetEntry) GetKey() string
func (*Config_ConfigSetEntry) GetValue ¶
func (x *Config_ConfigSetEntry) GetValue() *proto.ControllerConfig
func (*Config_ConfigSetEntry) MarshalJSON ¶
func (x *Config_ConfigSetEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Config_ConfigSetEntry to JSON.
func (*Config_ConfigSetEntry) MarshalProtoJSON ¶
func (x *Config_ConfigSetEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config_ConfigSetEntry message to JSON.
func (*Config_ConfigSetEntry) MarshalProtoText ¶
func (x *Config_ConfigSetEntry) MarshalProtoText() string
func (*Config_ConfigSetEntry) ProtoMessage ¶
func (*Config_ConfigSetEntry) ProtoMessage()
func (*Config_ConfigSetEntry) Reset ¶
func (x *Config_ConfigSetEntry) Reset()
func (*Config_ConfigSetEntry) String ¶
func (x *Config_ConfigSetEntry) String() string
func (*Config_ConfigSetEntry) UnmarshalJSON ¶
func (x *Config_ConfigSetEntry) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the Config_ConfigSetEntry from JSON.
func (*Config_ConfigSetEntry) UnmarshalProtoJSON ¶
func (x *Config_ConfigSetEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config_ConfigSetEntry message from JSON.
type Controller ¶
type Controller struct {
*bus.BusController[*Config]
}
Controller is the CLI compiler controller.
func (*Controller) BuildManifest ¶
func (c *Controller) BuildManifest( ctx context.Context, args *bldr_manifest_builder.BuildManifestArgs, host bldr_manifest_builder.BuildManifestHost, ) (*bldr_manifest_builder.BuilderResult, error)
BuildManifest compiles the CLI manifest once with the given builder args.
func (*Controller) GetSupportedPlatforms ¶
func (c *Controller) GetSupportedPlatforms() []string
GetSupportedPlatforms returns the base platform IDs this compiler supports.
func (*Controller) SupportsStartupManifestCache ¶
func (c *Controller) SupportsStartupManifestCache() bool
SupportsStartupManifestCache returns true if startup cache reuse is safe.
type Factory ¶
type Factory = bus.BusFactory[*Config, *Controller]
Factory is the factory for the CLI compiler controller.
type FactoryImport ¶
type FactoryImport struct {
// Path is the import path of the package.
Path string
// Alias is the import alias for the package.
Alias string
// PassBus is true when NewFactory takes a single bus.Bus argument.
// When false, NewFactory takes no arguments.
PassBus bool
}
FactoryImport describes a discovered NewFactory in a Go package.