Help us shape the future of Go! Take the 2026 Go Developer Survey

bldr_cli_compiler

package
v0.57.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = "bldr/cli/compiler"

ConfigID is the config identifier.

View Source
const ControllerID = ConfigID

ControllerID is the compiler controller ID.

Variables

View Source
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

func ResolveComposePackage(pkg, rootModule string) string

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 NewConfig

func NewConfig() *Config

NewConfig constructs a new config.

func (*Config) CloneMessageVT

func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Config) CloneVT

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(other config.Config) bool

EqualsConfig checks if the config is equal to another.

func (*Config) GetCliPkgs

func (x *Config) GetCliPkgs() []string

func (*Config) GetComposePackage

func (x *Config) GetComposePackage() string

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type.

func (*Config) GetConfigSet

func (x *Config) GetConfigSet() map[string]*proto.ControllerConfig

func (*Config) GetGoPkgs

func (x *Config) GetGoPkgs() []string

func (*Config) GetProjectId

func (x *Config) GetProjectId() string

func (*Config) MarshalJSON

func (x *Config) MarshalJSON() ([]byte, error)

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 (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON

func (x *Config) UnmarshalJSON(b []byte) error

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

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

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 (*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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL