bldr_project_controller

package
v0.51.3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = "bldr/project"

ConfigID is the identifier for the config type.

View Source
const ControllerID = ConfigID

ControllerID is the ID of the controller.

Variables

View Source
var Version = semver.MustParse("0.0.1")

Version is the version of the controller implementation.

Functions

func FilterPlatformIDsByBase

func FilterPlatformIDsByBase(platformIDs []string, basePlatformIDs []string) []string

FilterPlatformIDsByBase filters platform IDs to only those matching the given base platform IDs.

func ForManifestSelector

func ForManifestSelector(manifestIDs, platformIDs []string, cb func(manifestID, platformID string) (bool, error)) error

ForManifestSelector iterates over all combinations of platform id & manifest id in the given sets.

Callback returns cntu, err

func GetBuildConfigTargets

func GetBuildConfigTargets(buildConfig *bldr_project.BuildConfig) ([]*bldr_platform.Target, error)

GetBuildConfigTargets returns the parsed Targets for a BuildConfig, if specified. Returns nil if no targets are specified.

func MergePlatformIDs

func MergePlatformIDs(platformIDLists ...[]string) []string

MergePlatformIDs merges multiple platform ID lists, preserving order and deduplicating.

func ResolveBuildConfigPlatformIDs

func ResolveBuildConfigPlatformIDs(buildConfig *bldr_project.BuildConfig, targetsOverride []string) ([]string, error)

ResolveBuildConfigPlatformIDs resolves the platform IDs for a BuildConfig. If targetsOverride is specified, it takes precedence over the config's targets field. Platform IDs from all targets and explicit platform_ids are merged.

Types

type Config

type Config struct {

	// SourcePath is the path to the source code working dir.
	SourcePath string `protobuf:"bytes,1,opt,name=source_path,json=sourcePath,proto3" json:"sourcePath,omitempty"`
	// WorkingPath is the path to use for codegen and working state.
	// Usually source_path/.bldr
	// We expect the bldr dist sources to be under working_path/bldr
	WorkingPath string `protobuf:"bytes,2,opt,name=working_path,json=workingPath,proto3" json:"workingPath,omitempty"`
	// ProjectConfig contains the project configuration.
	ProjectConfig *project.ProjectConfig `protobuf:"bytes,3,opt,name=project_config,json=projectConfig,proto3" json:"projectConfig,omitempty"`
	// BuildBackoff is the backoff config for building manifests.
	// If unset, defaults to reasonable defaults.
	BuildBackoff *backoff.Backoff `protobuf:"bytes,4,opt,name=build_backoff,json=buildBackoff,proto3" json:"buildBackoff,omitempty"`
	// Watch enables watching for changes.
	Watch bool `protobuf:"varint,5,opt,name=watch,proto3" json:"watch,omitempty"`
	// Start enables loading the plugins in the "start" portion of the config.
	Start bool `protobuf:"varint,6,opt,name=start,proto3" json:"start,omitempty"`
	// FetchManifestRemote is the remote to use for the FetchManifest request.
	// When FetchManifest is applied, we will compile the plugin manifest to the remote.
	// If unset, we don't service FetchManifest directives.
	FetchManifestRemote string `protobuf:"bytes,7,opt,name=fetch_manifest_remote,json=fetchManifestRemote,proto3" json:"fetchManifestRemote,omitempty"`
	// contains filtered or unexported fields
}

Config is the Project controller configuration.

func NewConfig

func NewConfig(
	repoRoot,
	workingPath string,
	projConfig *bldr_project.ProjectConfig,
	watch, start bool,
) *Config

NewConfig constructs the configuration.

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(c2 config.Config) bool

EqualsConfig checks equality between two configs.

func (*Config) GetBuildBackoff

func (x *Config) GetBuildBackoff() *backoff.Backoff

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the config identifier.

func (*Config) GetFetchManifestRemote

func (x *Config) GetFetchManifestRemote() string

func (*Config) GetProjectConfig

func (x *Config) GetProjectConfig() *project.ProjectConfig

func (*Config) GetSourcePath

func (x *Config) GetSourcePath() string

func (*Config) GetStart

func (x *Config) GetStart() bool

func (*Config) GetWatch

func (x *Config) GetWatch() bool

func (*Config) GetWorkingPath

func (x *Config) GetWorkingPath() 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 Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the bldr Project controller.

func NewController

func NewController(le *logrus.Entry, bus bus.Bus, cc *Config) *Controller

NewController constructs a new controller.

func (*Controller) AddFetchManifestBuilderRef

func (c *Controller) AddFetchManifestBuilderRef(ctx context.Context, manifestMeta *bldr_manifest.ManifestMeta) (*ManifestBuilderRef, *RemoteRef, error)

AddFetchManifestBuilderRef adds a ManifestBuilderRef for a FetchManifest directive.

func (*Controller) AddManifestBuilderRef

func (c *Controller) AddManifestBuilderRef(conf *ManifestBuilderConfig) (*ManifestBuilderRef, error)

AddManifestBuilderRef adds a reference to a manifest compiler.

func (*Controller) AddRemoteRef

func (c *Controller) AddRemoteRef(remoteID string) (*RemoteRef, error)

AddRemoteRef adds a reference to a Remote. Returns ErrRemoteNotFound if the remote was not found.

func (*Controller) BuildManifestBuilderConfigs

func (c *Controller) BuildManifestBuilderConfigs(
	ctx context.Context,
	manifestBuilderConfigs []*ManifestBuilderConfig,
) ([]*bldr_manifest.ManifestRef, []string, error)

BuildManifestBuilderConfigs compiles a set of manifests linking them to the remote object key.

Returns the list of created manifest refs and corresponding object keys.

func (*Controller) BuildManifests

func (c *Controller) BuildManifests(
	ctx context.Context,
	remote string,
	manifestIDs []string,
	buildType bldr_manifest.BuildType,
	manifestOverrides map[string]*configset_proto.ControllerConfig,
) ([]*bldr_manifest.ManifestRef, []string, error)

BuildManifests compiles the given manifest IDs for the native platform.

If manifestOverrides is non-nil, each matching manifest id has its builder config replaced with the override (REPLACE semantics, same as the BuildConfig-driven path in BuildTargets). The override's id is ignored; the manifest's declared builder id wins. Callers that do not need overrides should pass nil.

Returns the manifest refs and object keys for the built manifests.

func (*Controller) BuildTargets

func (c *Controller) BuildTargets(ctx context.Context, remote string, targets []string, buildType bldr_manifest.BuildType, targetsOverride []string) error

BuildTargets compiles the given build target(s)

If the targets list is empty, builds all targets. If targetsOverride is specified, it overrides the targets field in all build configs.

func (*Controller) Close

func (c *Controller) Close() error

Close releases any resources used by the controller. Error indicates any issue encountered releasing.

func (*Controller) Execute

func (c *Controller) Execute(ctx context.Context) error

Execute executes the controller goroutine. Returning nil ends execution. Returning an error triggers a retry with backoff.

func (*Controller) GetConfig

func (c *Controller) GetConfig() *Config

GetConfig returns the current config.

func (*Controller) GetControllerInfo

func (c *Controller) GetControllerInfo() *controller.Info

GetControllerInfo returns information about the controller.

func (*Controller) HandleDirective

func (c *Controller) HandleDirective(
	ctx context.Context,
	di directive.Instance,
) ([]directive.Resolver, error)

HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any unexpected errors are returned for logging. It is safe to add a reference to the directive during this call.

func (*Controller) PublishTargets

func (c *Controller) PublishTargets(ctx context.Context, remote string, targets []string, buildType bldr_manifest.BuildType) error

PublishTargets publishes to the given publish target(s) Filters manifests to the given build type. If the given build type is empty, skips filtering.

func (*Controller) SetManifestBuilderStatusSink added in v0.51.3

func (c *Controller) SetManifestBuilderStatusSink(sink ManifestBuilderStatusSink)

SetManifestBuilderStatusSink sets the manifest builder status sink.

func (*Controller) StartStartup added in v0.51.2

func (c *Controller) StartStartup(ctx context.Context)

StartStartup loads the plugins in the project start config while ctx is active.

func (*Controller) UpdateProjectConfig

func (c *Controller) UpdateProjectConfig(nextConf *bldr_project.ProjectConfig) error

UpdateProjectConfig applies an updated project config restarting affected manifest builders.

func (*Controller) WaitRemote

func (c *Controller) WaitRemote(ctx context.Context, remoteID string) (world.Engine, *RemoteRef, error)

WaitRemote adds a reference to a remote and waits for it to be ready.

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory constructs a bldr project controller.

func NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds the controller factory.

func (*Factory) Construct

func (t *Factory) Construct(
	ctx context.Context,
	conf config.Config,
	opts controller.ConstructOpts,
) (controller.Controller, error)

Construct constructs the associated controller given configuration.

func (*Factory) ConstructConfig

func (t *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (t *Factory) GetConfigID() string

GetConfigID returns the configuration ID for the controller.

func (*Factory) GetControllerID

func (t *Factory) GetControllerID() string

GetControllerID returns the unique ID for the controller.

func (*Factory) GetVersion

func (t *Factory) GetVersion() semver.Version

GetVersion returns the version of this controller.

type ManifestBuilderConfig

type ManifestBuilderConfig struct {

	// ManifestId is the manifest identifier to build.
	ManifestId string `protobuf:"bytes,1,opt,name=manifest_id,json=manifestId,proto3" json:"manifestId,omitempty"`
	// BuildType is the type of build this is.
	BuildType string `protobuf:"bytes,2,opt,name=build_type,json=buildType,proto3" json:"buildType,omitempty"`
	// PlatformId is the platform ID to build.
	PlatformId string `protobuf:"bytes,3,opt,name=platform_id,json=platformId,proto3" json:"platformId,omitempty"`
	// RemoteId is the identifier of the remote to attach to.
	RemoteId string `protobuf:"bytes,4,opt,name=remote_id,json=remoteId,proto3" json:"remoteId,omitempty"`
	// TargetPlatformIds is the full list of platform IDs belonging to the
	// build target that spawned this slot. Informational only; the dist
	// compiler no longer uses this field to pick which manifests to embed.
	// Embed selection is driven by the per-slot BuilderConfigOverride sourced
	// from BuildConfig.manifest_overrides, which carries explicit
	// (manifest_id, platform_id) tuples.
	TargetPlatformIds []string `protobuf:"bytes,5,rep,name=target_platform_ids,json=targetPlatformIds,proto3" json:"targetPlatformIds,omitempty"`
	// BuilderConfigOverride optionally replaces the builder config of the
	// manifest for this build slot. The override's controller id is ignored;
	// the manifest's declared builder id always wins. This is REPLACE
	// semantics: the static manifest builder config is not merged with the
	// override. Sourced from BuildConfig.manifest_overrides.
	BuilderConfigOverride *proto.ControllerConfig `protobuf:"bytes,6,opt,name=builder_config_override,json=builderConfigOverride,proto3" json:"builderConfigOverride,omitempty"`
	// contains filtered or unexported fields
}

ManifestBuilderConfig is a configuration for a ManifestBuilder.

func NewManifestBuilderConfig

func NewManifestBuilderConfig(manifestID, buildType, platformID, remoteID string) *ManifestBuilderConfig

NewManifestBuilderConfig constructs a new ManifestBuilderConfig.

func NewManifestBuilderConfigWithTargetPlatforms

func NewManifestBuilderConfigWithTargetPlatforms(manifestID, buildType, platformID, remoteID string, targetPlatformIDs []string) *ManifestBuilderConfig

NewManifestBuilderConfigWithTargetPlatforms constructs a new ManifestBuilderConfig with target platform IDs.

func UnmarshalManifestBuilderConfigB58

func UnmarshalManifestBuilderConfigB58(str string) (*ManifestBuilderConfig, error)

UnmarshalManifestBuilderConfigB58 unmarshals a b58 manifest builder config.

func (*ManifestBuilderConfig) CloneMessageVT

func (*ManifestBuilderConfig) CloneVT

func (*ManifestBuilderConfig) EqualMessageVT

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

func (*ManifestBuilderConfig) EqualVT

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

func (*ManifestBuilderConfig) GetBuildType

func (x *ManifestBuilderConfig) GetBuildType() string

func (*ManifestBuilderConfig) GetBuilderConfigOverride

func (x *ManifestBuilderConfig) GetBuilderConfigOverride() *proto.ControllerConfig

func (*ManifestBuilderConfig) GetManifestId

func (x *ManifestBuilderConfig) GetManifestId() string

func (*ManifestBuilderConfig) GetPlatformId

func (x *ManifestBuilderConfig) GetPlatformId() string

func (*ManifestBuilderConfig) GetRemoteId

func (x *ManifestBuilderConfig) GetRemoteId() string

func (*ManifestBuilderConfig) GetTargetPlatformIds

func (x *ManifestBuilderConfig) GetTargetPlatformIds() []string

func (*ManifestBuilderConfig) MarshalB58

func (m *ManifestBuilderConfig) MarshalB58() string

MarshalB58 marshals the conf to a b58 string.

func (*ManifestBuilderConfig) MarshalJSON

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

MarshalJSON marshals the ManifestBuilderConfig to JSON.

func (*ManifestBuilderConfig) MarshalProtoJSON

func (x *ManifestBuilderConfig) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ManifestBuilderConfig message to JSON.

func (*ManifestBuilderConfig) MarshalProtoText

func (x *ManifestBuilderConfig) MarshalProtoText() string

func (*ManifestBuilderConfig) MarshalToSizedBufferVT

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

func (*ManifestBuilderConfig) MarshalToVT

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

func (*ManifestBuilderConfig) MarshalVT

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

func (*ManifestBuilderConfig) ProtoMessage

func (*ManifestBuilderConfig) ProtoMessage()

func (*ManifestBuilderConfig) Reset

func (x *ManifestBuilderConfig) Reset()

func (*ManifestBuilderConfig) SizeVT

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

func (*ManifestBuilderConfig) String

func (x *ManifestBuilderConfig) String() string

func (*ManifestBuilderConfig) UnmarshalJSON

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

UnmarshalJSON unmarshals the ManifestBuilderConfig from JSON.

func (*ManifestBuilderConfig) UnmarshalProtoJSON

func (x *ManifestBuilderConfig) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ManifestBuilderConfig message from JSON.

func (*ManifestBuilderConfig) UnmarshalVT

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

func (*ManifestBuilderConfig) Validate

func (m *ManifestBuilderConfig) Validate() error

Validate validates the config.

type ManifestBuilderRef

type ManifestBuilderRef struct {
	// contains filtered or unexported fields
}

ManifestBuilderRef is a reference to a manifest builder.

func (*ManifestBuilderRef) GetManifestBuilderConfig

func (r *ManifestBuilderRef) GetManifestBuilderConfig() *ManifestBuilderConfig

GetManifestBuilderConfig returns the manifest bundle config.

func (*ManifestBuilderRef) GetResultPromiseContainer

func (r *ManifestBuilderRef) GetResultPromiseContainer() *promise.PromiseContainer[*ManifestBuilderResult]

GetResultPromiseContainer returns the result promise container.

func (*ManifestBuilderRef) Release

func (r *ManifestBuilderRef) Release()

Release releases the reference.

type ManifestBuilderResult

type ManifestBuilderResult struct {

	// BuilderConfig was the config passed to the builder.
	BuilderConfig *builder.BuilderConfig `protobuf:"bytes,1,opt,name=builder_config,json=builderConfig,proto3" json:"builderConfig,omitempty"`
	// BuilderResult is the result of running the builder.
	BuilderResult *builder.BuilderResult `protobuf:"bytes,2,opt,name=builder_result,json=builderResult,proto3" json:"builderResult,omitempty"`
	// contains filtered or unexported fields
}

ManifestBuilderResult is the result of a ManifestBuilder build.

func NewManifestBuilderResult

func NewManifestBuilderResult(
	builderConf *bldr_manifest_builder.BuilderConfig,
	builderRes *bldr_manifest_builder.BuilderResult,
) *ManifestBuilderResult

NewManifestBuilderResult constructs a new ManifestBuilderResult.

func (*ManifestBuilderResult) CloneMessageVT

func (*ManifestBuilderResult) CloneVT

func (*ManifestBuilderResult) EqualMessageVT

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

func (*ManifestBuilderResult) EqualVT

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

func (*ManifestBuilderResult) GetBuilderConfig

func (x *ManifestBuilderResult) GetBuilderConfig() *builder.BuilderConfig

func (*ManifestBuilderResult) GetBuilderResult

func (x *ManifestBuilderResult) GetBuilderResult() *builder.BuilderResult

func (*ManifestBuilderResult) MarshalJSON

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

MarshalJSON marshals the ManifestBuilderResult to JSON.

func (*ManifestBuilderResult) MarshalProtoJSON

func (x *ManifestBuilderResult) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ManifestBuilderResult message to JSON.

func (*ManifestBuilderResult) MarshalProtoText

func (x *ManifestBuilderResult) MarshalProtoText() string

func (*ManifestBuilderResult) MarshalToSizedBufferVT

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

func (*ManifestBuilderResult) MarshalToVT

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

func (*ManifestBuilderResult) MarshalVT

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

func (*ManifestBuilderResult) ProtoMessage

func (*ManifestBuilderResult) ProtoMessage()

func (*ManifestBuilderResult) Reset

func (x *ManifestBuilderResult) Reset()

func (*ManifestBuilderResult) SizeVT

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

func (*ManifestBuilderResult) String

func (x *ManifestBuilderResult) String() string

func (*ManifestBuilderResult) UnmarshalJSON

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

UnmarshalJSON unmarshals the ManifestBuilderResult from JSON.

func (*ManifestBuilderResult) UnmarshalProtoJSON

func (x *ManifestBuilderResult) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ManifestBuilderResult message from JSON.

func (*ManifestBuilderResult) UnmarshalVT

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

type ManifestBuilderStatus added in v0.51.3

type ManifestBuilderStatus struct {
	ID                      string
	BuildTargetIDs          []string
	ManifestID              string
	PlatformID              string
	TargetPlatformIDs       []string
	BuildType               string
	RemoteID                string
	State                   ManifestBuilderStatusState
	CacheHit                bool
	FullRebuild             bool
	HotRebuild              bool
	WatchedFileCount        int
	DependencyRebuildReason string
	Summary                 string
	Error                   string
}

ManifestBuilderStatus is the ProjectController manifest build status surface.

type ManifestBuilderStatusSink added in v0.51.3

type ManifestBuilderStatusSink interface {
	SetManifestBuilderStatus(status ManifestBuilderStatus)
}

ManifestBuilderStatusSink consumes ProjectController manifest build status.

type ManifestBuilderStatusState added in v0.51.3

type ManifestBuilderStatusState int32

ManifestBuilderStatusState describes ProjectController manifest build status.

const (
	// ManifestBuilderStatusStateQueued means the manifest build is waiting.
	ManifestBuilderStatusStateQueued ManifestBuilderStatusState = iota
	// ManifestBuilderStatusStateRunning means the manifest build is active.
	ManifestBuilderStatusStateRunning
	// ManifestBuilderStatusStateDone means the manifest build has a result.
	ManifestBuilderStatusStateDone
	// ManifestBuilderStatusStateError means the manifest build failed.
	ManifestBuilderStatusStateError
	// ManifestBuilderStatusStateCanceled means the manifest build was canceled.
	ManifestBuilderStatusStateCanceled
)

type RemoteRef

type RemoteRef struct {
	// contains filtered or unexported fields
}

RemoteRef is a reference to a remote.

func (*RemoteRef) GetRemoteConfig

func (r *RemoteRef) GetRemoteConfig() *bldr_project.RemoteConfig

GetRemoteConfig returns the config of the remote.

func (*RemoteRef) GetRemoteID

func (r *RemoteRef) GetRemoteID() string

GetRemoteID returns the ID of the remote.

func (*RemoteRef) GetResultPromise

func (r *RemoteRef) GetResultPromise() promise.PromiseLike[*world.Engine]

GetResultPromise returns the result promise.

func (*RemoteRef) Release

func (r *RemoteRef) Release()

Release releases the reference.

Jump to

Keyboard shortcuts

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