rules

package
v0.0.0-...-a85b63b Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package rules provides Bazel rule generation for Go build targets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyRule

func EmptyRule(kind, name string) *bf.CallExpr

EmptyRule generates an empty rule with the given kind and name.

func NewRule

func NewRule(kind string, kwargs []KeyValue) *bf.CallExpr

NewRule generates a rule of the given kind with the given attributes.

func SortLabels

func SortLabels(f *bf.File)

SortLabels sorts lists of strings in "srcs" and "deps" attributes of Go rules using the same order as buildifier. Buildifier also sorts string lists, but not those involved with "select" expressions. TODO(jayconrod): remove this when bazelbuild/buildtools#122 is fixed.

Types

type Generator

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

Generator generates Bazel build rules for Go build targets.

func NewGenerator

func NewGenerator(c *config.Config, l *label.Labeler, oldFile *bf.File) *Generator

NewGenerator returns a new instance of Generator. "oldFile" is the existing build file. May be nil.

func (*Generator) GenerateRules

func (g *Generator) GenerateRules(pkg *packages.Package) (rules []bf.Expr, empty []bf.Expr, err error)

GenerateRules generates a list of rules for targets in "pkg". It also returns a list of empty rules that may be deleted from an existing file.

type GlobValue

type GlobValue struct {
	Patterns []string
	Excludes []string
}

GlobValue represents a Bazel glob expression.

type KeyValue

type KeyValue struct {
	Key   string
	Value interface{}
}

KeyValue represents a key-value pair. This gets converted into a rule attribute, i.e., a Skylark keyword argument.

Jump to

Keyboard shortcuts

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