label

package
v0.0.0-...-d04b29a Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLabel = errors.New("label couldn't be parsed")
)

Functions

func Package

func Package(s string) *string

Types

type Label

type Label string

Label represents a perforce label we plan on adding more providers

func New

func New(pkg, name string) Label

func Parse

func Parse(s string) (Label, error)

func (Label) Attr

func (l Label) Attr(attr string) (skylark.Value, error)

func (Label) AttrNames

func (l Label) AttrNames() []string

func (Label) Freeze

func (l Label) Freeze()

func (Label) Hash

func (l Label) Hash() (uint32, error)

func (Label) IsAbs

func (l Label) IsAbs() bool

func (Label) Name

func (l Label) Name() string

func (Label) Package

func (l Label) Package() string

func (Label) Repo

func (l Label) Repo() string

func (Label) Split

func (l Label) Split() (map[string]string, error)

Split splits an label.Label into package and label pair

<label> := //<package name>:<target name>

<package name> :=

https://docs.bazel.build/versions/master/build-ref.html#package-names-package-name

The name of a package is the name of the directory containing its BUILD file,
relative to the top-level directory of the source tree. For example: my/app.
Package names must be composed entirely of characters drawn from the
set A-Z, a–z, 0–9, '/', '-', '.', and '_', and cannot start with a slash.

For a language with a directory structure that is significant to its module system
(e.g. Java), it is important to choose directory names that are valid identifiers in the language.

Although Bazel allows a package at the build root (e.g. //:foo), this is not advised
and projects should attempt to use more descriptively named packages.

Package names may not contain the substring //, nor end with a slash.

<target name> :=

https://docs.bazel.build/versions/master/build-ref.html#name

Target names must be composed entirely of characters drawn from
the set a–z, A–Z, 0–9, and the punctuation symbols _/.+-=,@~.
Do not use .. to refer to files in other packages; use //packagename:filename instead.
Filenames must be relative pathnames in normal form, which
means they must neither start nor end with a slash (e.g. /foo and foo/ are forbidden)
nor contain multiple consecutive slashes as path separators (e.g. foo//bar).
Similarly, up-level references (..) and current-directory references (./) are forbidden.
The sole exception to this rule is that a target name may consist of exactly '.'.

While it is common to use / in the name of a file target, we recommend
that you avoid the use of / in the names of rules. Especially when the shorthand form
of a label is used, it may confuse the reader. The label //foo/bar/wiz is always a
shorthand for //foo/bar/wiz:wiz, even if there is no such package foo/bar/wiz;
it never refers to //foo:bar/wiz, even if that target exists.

However, there are some situations where use of a slash is convenient, or sometimes
even necessary. For example, the name of certain rules must match their principal
source file, which may reside in a subdirectory of the package.

func (Label) String

func (l Label) String() string

func (Label) Truth

func (l Label) Truth() skylark.Bool

func (Label) Type

func (l Label) Type() string

func (Label) Valid

func (l Label) Valid() error

Jump to

Keyboard shortcuts

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