starlark

package
v0.0.0-...-20d847b Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseModuleDotBazel

func ParseModuleDotBazel(contents string, filename label.CanonicalLabel, localPathFormat path.Format, handler RootModuleDotBazelHandler) error

Parse a MODULE.bazel file, and call into ModuleDotBazelHandler for every observed declaration.

Types

type ChildModuleDotBazelHandler

type ChildModuleDotBazelHandler interface {
	BazelDep(name label.Module, version *label.ModuleVersion, maxCompatibilityLevel int, repoName label.ApparentRepo, devDependency bool) error
	Module(name label.Module, version *label.ModuleVersion, compatibilityLevel int, repoName label.ApparentRepo, bazelCompatibility []string) error
	RegisterExecutionPlatforms(platformLabels []label.ApparentLabel, devDependency bool) error
	RegisterToolchains(toolchainLabels []label.ApparentLabel, devDependency bool) error
	UseExtension(extensionBzlFile label.ApparentLabel, extensionName label.StarlarkIdentifier, devDependency, isolate bool) (ModuleExtensionProxy, error)
	UseRepoRule(repoRuleBzlFile label.ApparentLabel, repoRuleName string) (RepoRuleProxy, error)
}

ChildModuleDotBazelHandler contains the methods that may be called in MODULE.bazel, omitting any methods that should be ignored in child modules.

type ModuleExtensionProxy

type ModuleExtensionProxy interface {
	Tag(className string, attrs map[string]starlark.Value) error
	UseRepo(repos map[label.ApparentRepo]label.ApparentRepo) error
}

ModuleExtensionProxy is called into by ParseModuleDotBazel() whenever module extension tags are declared, or if use_repo() is called against a given module extension.

var NullModuleExtensionProxy ModuleExtensionProxy = nullModuleExtensionProxy{}

NullModuleExtensionProxy is an implementation of ModuleExtensionProxy that merely discards any tag declarations and use_repo() calls.

type PatchOptions

type PatchOptions struct {
	Patches    []label.ApparentLabel
	PatchCmds  []string
	PatchStrip int
}

PatchOptions contains the common set of properties that are accepted by MODULE.bazel's archive_override(), git_override() and single_version_override().

type RepoRuleProxy

type RepoRuleProxy func(name label.ApparentRepo, devDependency bool, attrs map[string]starlark.Value) error

RepoRuleProxy is called into by ParseModuleDotBazel() whenever a repository rule is invoked.

type RootModuleDotBazelHandler

type RootModuleDotBazelHandler interface {
	ChildModuleDotBazelHandler

	ArchiveOverride(moduleName label.Module, urls []*url.URL, integrity string, stripPrefix path.Parser, patchOptions *PatchOptions) error
	GitOverride(moduleName label.Module, remote *url.URL, commit string, patchOptions *PatchOptions, initSubmodules bool, stripPrefix path.Parser) error
	LocalPathOverride(moduleName label.Module, path path.Parser) error
	MultipleVersionOverride(moduleName label.Module, versions []label.ModuleVersion, registry *url.URL) error
	SingleVersionOverride(moduleName label.Module, version *label.ModuleVersion, registry *url.URL, patchOptions *PatchOptions) error
}

RootModuleDotBazelHandler is called into by ParseModuleDotBazel() for each top-level declaration. It contains all methods that have an effect within the root module.

func NewOverrideIgnoringRootModuleDotBazelHandler

func NewOverrideIgnoringRootModuleDotBazelHandler(base ChildModuleDotBazelHandler) RootModuleDotBazelHandler

NewOverrideIgnoringRootModuleDotBazelHandler wraps a ChildModuleDotBazelHandler, providing stubs for methods that only have an effect in the root module.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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