Documentation
¶
Index ¶
- Variables
- type BazelDep
- type Bazelmod
- func (b *Bazelmod) Changelog(from, to string) *result.Changelogs
- func (b *Bazelmod) Condition(_ context.Context, source string, scm scm.ScmHandler) (pass bool, message string, err error)
- func (b *Bazelmod) ReportConfig() interface{}
- func (b *Bazelmod) Source(_ context.Context, workingDir string, resultSource *result.Source) error
- func (b *Bazelmod) Target(_ context.Context, source string, scm scm.ScmHandler, dryRun bool, ...) error
- func (b *Bazelmod) Validate() error
- type ModuleFile
- type Spec
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSpecFileUndefined is returned if a file wasn't specified ErrSpecFileUndefined = errors.New("bazelmod file undefined") // ErrSpecModuleUndefined is returned if a module wasn't specified ErrSpecModuleUndefined = errors.New("bazelmod module undefined") // ErrWrongSpec is returned when the Spec has wrong content ErrWrongSpec = errors.New("wrong spec content") )
Functions ¶
This section is empty.
Types ¶
type BazelDep ¶
type BazelDep struct {
Name string
Version string
RepoName string // Optional repo_name parameter
LineNum int // Line number in the original file (1-indexed)
FullLine string // The complete line(s) for this bazel_dep call
}
BazelDep represents a bazel_dep() function call
type Bazelmod ¶
type Bazelmod struct {
// contains filtered or unexported fields
}
Bazelmod stores configuration about the MODULE.bazel file and the module to update
func New ¶
New returns a reference to a newly initialized Bazelmod object from a Spec or an error if the provided Spec triggers a validation error.
func (*Bazelmod) Changelog ¶
func (b *Bazelmod) Changelog(from, to string) *result.Changelogs
Changelog returns the changelog for this resource, or nil if not supported
func (*Bazelmod) Condition ¶
func (b *Bazelmod) Condition(_ context.Context, source string, scm scm.ScmHandler) (pass bool, message string, err error)
Condition checks if the version in MODULE.bazel matches the expected version
func (*Bazelmod) ReportConfig ¶
func (b *Bazelmod) ReportConfig() interface{}
ReportConfig returns a new configuration object with only the necessary fields to identify the resource without any sensitive information or context specific data.
type ModuleFile ¶
ModuleFile represents a parsed MODULE.bazel file
func ParseModuleFile ¶
func ParseModuleFile(content string) (*ModuleFile, error)
ParseModuleFile parses a MODULE.bazel file and extracts all bazel_dep() calls
func (*ModuleFile) FindDepByName ¶
func (mf *ModuleFile) FindDepByName(name string) *BazelDep
FindDepByName finds a bazel_dep by module name
func (*ModuleFile) UpdateDepVersion ¶
func (mf *ModuleFile) UpdateDepVersion(moduleName, newVersion string) (string, error)
UpdateDepVersion updates the version of a specific module in the file content
type Spec ¶
type Spec struct {
// File specifies the path to the MODULE.bazel file
//
// compatible:
// * source
// * condition
// * target
//
// example:
// * MODULE.bazel
// * path/to/MODULE.bazel
File string `yaml:",omitempty" jsonschema:"required"`
// Module specifies the Bazel module name to target
//
// compatible:
// * source
// * condition
// * target
//
// example:
// * rules_go
// * gazelle
// * protobuf
Module string `yaml:",omitempty" jsonschema:"required"`
}
Spec defines a specification for a "bazelmod" resource parsed from an updatecli manifest file