label

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApparentLabel

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

ApparentLabel is a label string that is prefixed with either a canonical or apparent repo name. This type can be used to refer to targets within the context of a given repository.

func MustNewApparentLabel

func MustNewApparentLabel(value string) ApparentLabel

func NewApparentLabel

func NewApparentLabel(value string) (ApparentLabel, error)

func (ApparentLabel) AsCanonicalLabel

func (l ApparentLabel) AsCanonicalLabel() (CanonicalLabel, bool)

AsCanonicalLabel upgrades an existing ApparentLabel to a CanonicalLabel if it prefixed with a canonical repo name.

func (ApparentLabel) GetApparentRepo

func (l ApparentLabel) GetApparentRepo() (ApparentRepo, bool)

GetApparentRepo returns the apparent repo name of the label, if the label is not prefixed with a canonical repo name.

func (ApparentLabel) String

func (l ApparentLabel) String() string

func (ApparentLabel) WithCanonicalRepo

func (l ApparentLabel) WithCanonicalRepo(canonicalRepo CanonicalRepo) CanonicalLabel

WithCanonicalRepo replaces the repo name of the label with a provided canonical repo name.

type ApparentRepo

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

func MustNewApparentRepo

func MustNewApparentRepo(value string) ApparentRepo

func NewApparentRepo

func NewApparentRepo(value string) (ApparentRepo, error)

func (ApparentRepo) String

func (r ApparentRepo) String() string

type CanonicalLabel

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

CanonicalLabel is a label string that is prefixed with a canonical repo name. This type can be used to refer to targets in an unambiguous way.

func MustNewCanonicalLabel

func MustNewCanonicalLabel(value string) CanonicalLabel

func NewCanonicalLabel

func NewCanonicalLabel(value string) (CanonicalLabel, error)

NewCanonicalLabel creates a new CanonicalLabel based on the provided label value.

func (CanonicalLabel) AppendStarlarkIdentifier

func (l CanonicalLabel) AppendStarlarkIdentifier(identifier StarlarkIdentifier) CanonicalStarlarkIdentifier

func (CanonicalLabel) GetCanonicalPackage

func (l CanonicalLabel) GetCanonicalPackage() CanonicalPackage

GetCanonicalPackage strips the target name from a label, thereby returning the canonical package name.

func (CanonicalLabel) GetCanonicalRepo

func (l CanonicalLabel) GetCanonicalRepo() CanonicalRepo

func (CanonicalLabel) GetRepoRelativePath

func (l CanonicalLabel) GetRepoRelativePath() string

GetRepoRelativePath converts a label to a pathname string that is relative to the root of the repo. This can be used in contexts where labels refer to paths of input files.

func (CanonicalLabel) GetTargetName

func (l CanonicalLabel) GetTargetName() TargetName

GetTargetName returns the name of the target within a package.

func (CanonicalLabel) String

func (l CanonicalLabel) String() string

type CanonicalPackage

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

CanonicalPackage is a label string that refers to a package, meaning it does not include a target name. Furthermore, it is prefixed with a canonical repo name.

func MustNewCanonicalPackage

func MustNewCanonicalPackage(value string) CanonicalPackage

func NewCanonicalPackage

func NewCanonicalPackage(value string) (CanonicalPackage, error)

func (CanonicalPackage) AppendLabel

func (p CanonicalPackage) AppendLabel(value string) (ApparentLabel, error)

AppendLabel appends a provided label value to a canonical package name. The resulting label is apparent, because the provided label value may be prefixed with an apparent repo. It is the caller's responsibility to resolve the apparent repo to a canonical one.

func (CanonicalPackage) AppendTargetName

func (p CanonicalPackage) AppendTargetName(targetName TargetName) CanonicalLabel

AppendTargetName appends a target name to a canonical package name, thereby turning it into a canonical label.

func (CanonicalPackage) GetCanonicalRepo

func (p CanonicalPackage) GetCanonicalRepo() CanonicalRepo

func (CanonicalPackage) GetPackagePath

func (p CanonicalPackage) GetPackagePath() string

func (CanonicalPackage) String

func (p CanonicalPackage) String() string

type CanonicalRepo

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

func MustNewCanonicalRepo

func MustNewCanonicalRepo(value string) CanonicalRepo

func NewCanonicalRepo

func NewCanonicalRepo(value string) (CanonicalRepo, error)

func (CanonicalRepo) GetModuleExtension

func (r CanonicalRepo) GetModuleExtension() (ModuleExtension, ApparentRepo, bool)

func (CanonicalRepo) GetModuleInstance

func (r CanonicalRepo) GetModuleInstance() ModuleInstance

func (CanonicalRepo) GetRootPackage

func (r CanonicalRepo) GetRootPackage() CanonicalPackage

func (CanonicalRepo) String

func (r CanonicalRepo) String() string

type CanonicalStarlarkIdentifier

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

func MustNewCanonicalStarlarkIdentifier

func MustNewCanonicalStarlarkIdentifier(value string) CanonicalStarlarkIdentifier

func NewCanonicalStarlarkIdentifier

func NewCanonicalStarlarkIdentifier(value string) (CanonicalStarlarkIdentifier, error)

func (CanonicalStarlarkIdentifier) GetCanonicalLabel

func (i CanonicalStarlarkIdentifier) GetCanonicalLabel() CanonicalLabel

func (CanonicalStarlarkIdentifier) GetStarlarkIdentifier

func (i CanonicalStarlarkIdentifier) GetStarlarkIdentifier() StarlarkIdentifier

func (CanonicalStarlarkIdentifier) String

func (CanonicalStarlarkIdentifier) ToModuleExtension

func (i CanonicalStarlarkIdentifier) ToModuleExtension() ModuleExtension

ToModuleExtension converts a Starlark identifier of a module extension declared in a .bzl file and converts it to a string that can be prefixed to repos that are declared by the module extension.

type Module

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

func MustNewModule

func MustNewModule(value string) Module

func NewModule

func NewModule(value string) (Module, error)

func (Module) String

func (m Module) String() string

func (Module) ToApparentRepo

func (m Module) ToApparentRepo() ApparentRepo

func (Module) ToModuleInstance

func (m Module) ToModuleInstance(mv *ModuleVersion) ModuleInstance

type ModuleExtension

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

ModuleExtension is a Starlark identifier that corresponds to the name of the module extension object declared in a .bzl file, prefixed with the name of the module instance containing the module extension. Its value is used as a prefix for the names of repos declared by the module extension.

func MustNewModuleExtension

func MustNewModuleExtension(value string) ModuleExtension

func NewModuleExtension

func NewModuleExtension(value string) (ModuleExtension, error)

func (ModuleExtension) GetCanonicalRepoWithModuleExtension

func (me ModuleExtension) GetCanonicalRepoWithModuleExtension(repo ApparentRepo) CanonicalRepo

func (ModuleExtension) GetModuleInstance

func (me ModuleExtension) GetModuleInstance() ModuleInstance

func (ModuleExtension) String

func (me ModuleExtension) String() string

type ModuleInstance

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

ModuleInstance is a pair of a module name and an optional module version. It is the leading part of a canonical repo name.

func MustNewModuleInstance

func MustNewModuleInstance(value string) ModuleInstance

func NewModuleInstance

func NewModuleInstance(value string) (ModuleInstance, error)

func (ModuleInstance) GetBareCanonicalRepo

func (mi ModuleInstance) GetBareCanonicalRepo() CanonicalRepo

func (ModuleInstance) GetModule

func (mi ModuleInstance) GetModule() Module

func (ModuleInstance) GetModuleExtension

func (mi ModuleInstance) GetModuleExtension(extensionName StarlarkIdentifier) ModuleExtension

func (ModuleInstance) GetModuleVersion

func (mi ModuleInstance) GetModuleVersion() (ModuleVersion, bool)

func (ModuleInstance) String

func (mi ModuleInstance) String() string

type ModuleVersion

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

ModuleVersion are version number strings that correspond to the format that Bazel uses to version modules. The format is similar, but not identical to Semantic Versions.

More details: https://bazel.build/external/module#version_format

func MustNewModuleVersion

func MustNewModuleVersion(value string) ModuleVersion

func NewModuleVersion

func NewModuleVersion(value string) (ModuleVersion, error)

func (ModuleVersion) Compare

func (mv ModuleVersion) Compare(other ModuleVersion) int

func (ModuleVersion) String

func (mv ModuleVersion) String() string

type StarlarkIdentifier

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

func MustNewStarlarkIdentifier

func MustNewStarlarkIdentifier(value string) StarlarkIdentifier

func NewStarlarkIdentifier

func NewStarlarkIdentifier(value string) (StarlarkIdentifier, error)

func (StarlarkIdentifier) IsPublic

func (i StarlarkIdentifier) IsPublic() bool

func (StarlarkIdentifier) String

func (i StarlarkIdentifier) String() string

type TargetName

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

TargetName corresponds to the name of an addressable and/or buildable target within a package.

func MustNewTargetName

func MustNewTargetName(value string) TargetName

func NewTargetName

func NewTargetName(value string) (TargetName, error)

func (TargetName) String

func (tn TargetName) String() string

Jump to

Keyboard shortcuts

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