Documentation ¶
Overview ¶
Package buildengine provides a framework for building FTL modules.
Index ¶
- Variables
- func Build(ctx context.Context, module Module) error
- func BuildOrder(modules []Module) ([][]Module, error)
- func DiscoverModules(dirs ...string) ([]moduleconfig.ModuleConfig, error)
- func SetPOMProperties(ctx context.Context, baseDir string) error
- func WalkDir(dir string, fn func(path string, d fs.DirEntry) error) error
- func Watch(ctx context.Context, period time.Duration, dirs ...string) *pubsub.Topic[WatchEvent]
- type FileChangeType
- type FileHashes
- type Module
- type WatchEvent
- type WatchEventModuleAdded
- type WatchEventModuleChanged
- type WatchEventModuleRemoved
Constants ¶
This section is empty.
Variables ¶
var ErrSkip = errors.New("skip directory")
ErrSkip can be returned by the WalkDir callback to skip a file or directory.
Functions ¶
func BuildOrder ¶
BuildOrder returns groups of modules in topological order that can be built in parallel.
func DiscoverModules ¶
func DiscoverModules(dirs ...string) ([]moduleconfig.ModuleConfig, error)
DiscoverModules recursively loads all modules under the given directories.
If no directories are provided, the current working directory is used.
func SetPOMProperties ¶ added in v0.133.1
SetPOMProperties updates the ftl.version and ftlEndpoint properties in the pom.xml file in the given base directory.
Types ¶
type FileChangeType ¶ added in v0.131.0
type FileChangeType rune
const ( FileAdded FileChangeType = '+' FileRemoved FileChangeType = '-' FileChanged FileChangeType = '*' )
func CompareFileHashes ¶
func CompareFileHashes(oldFiles, newFiles FileHashes) (FileChangeType, string, bool)
CompareFileHashes compares the hashes of the files in the oldFiles and newFiles maps.
Returns true if the hashes are equal, false otherwise.
If false, the returned string will be a file that caused the difference and the returned FileChangeType will be the type of change that occurred.
func (FileChangeType) GoString ¶ added in v0.131.0
func (f FileChangeType) GoString() string
func (FileChangeType) String ¶ added in v0.131.0
func (f FileChangeType) String() string
type FileHashes ¶ added in v0.131.0
func ComputeFileHashes ¶
func ComputeFileHashes(config moduleconfig.ModuleConfig) (FileHashes, error)
ComputeFileHashes computes the SHA256 hash of all (non-git-ignored) files in the given directory.
type Module ¶ added in v0.131.0
type Module struct { moduleconfig.ModuleConfig Dependencies []string }
A Module is a ModuleConfig with its dependencies populated.
func LoadModule ¶ added in v0.133.1
LoadModule loads a module from the given directory.
A Module includes the module configuration as well as its dependencies extracted from source code.
func UpdateAllDependencies ¶
func UpdateAllDependencies(modules []moduleconfig.ModuleConfig) ([]Module, error)
UpdateAllDependencies calls UpdateDependencies on each module in the list.
func UpdateDependencies ¶
func UpdateDependencies(config moduleconfig.ModuleConfig) (Module, error)
UpdateDependencies finds the dependencies for an FTL module and returns a Module with those dependencies populated.
type WatchEvent ¶ added in v0.131.0
type WatchEvent interface {
// contains filtered or unexported methods
}
A WatchEvent is an event that occurs when a module is added, removed, or changed.
type WatchEventModuleAdded ¶ added in v0.131.0
type WatchEventModuleAdded struct{ Module Module }
type WatchEventModuleChanged ¶ added in v0.131.0
type WatchEventModuleChanged struct { Module Module Change FileChangeType Path string }
type WatchEventModuleRemoved ¶ added in v0.131.0
type WatchEventModuleRemoved struct{ Module Module }