config

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RulesGoRepoName is the canonical name of the rules_go repository. It must
	// match the workspace name in WORKSPACE.
	RulesGoRepoName = "io_bazel_rules_go"
	// RulesGoDefBzlLabel is the canonical label for def.bzl, where all
	// Go-related rules are defined.
	RulesGoDefBzlLabel = "@io_bazel_rules_go//go:def.bzl"
	// DefaultLibName is the name of the default go_library rule in a Go
	// package directory. It must be consistent to DEFAULT_LIB in go/private/common.bf.
	DefaultLibName = "go_default_library"
	// DefaultTestName is a name of an internal test corresponding to
	// DefaultLibName. It does not need to be consistent to something but it
	// just needs to be unique in the Bazel package
	DefaultTestName = "go_default_test"
	// DefaultXTestName is a name of an external test corresponding to
	// DefaultLibName.
	DefaultXTestName = "go_default_xtest"
	// DefaultProtosName is the name of a filegroup created
	// whenever the library contains .pb.go files
	DefaultProtosName = "go_default_library_protos"
	// DefaultCgoLibName is the name of the default cgo_library rule in a Go package directory.
	DefaultCgoLibName = "cgo_default_library"
)

Variables

View Source
var DefaultValidBuildFileNames = []string{"BUILD.bazel", "BUILD"}

Functions

This section is empty.

Types

type BuildTags

type BuildTags map[string]bool

BuildTags is a set of build constraints.

type Config

type Config struct {
	// Dirs is a list of absolute paths to directories where Gazelle should run.
	Dirs []string

	// RepoRoot is the absolute path to the root directory of the repository.
	RepoRoot string

	// ValidBuildFileNames is a list of base names that are considered valid
	// build files. Some repositories may have files named "BUILD" that are not
	// used by Bazel and should be ignored. Must contain at least one string.
	ValidBuildFileNames []string

	// GenericTags is a set of build constraints that are true on all platforms.
	// It should not be nil.
	GenericTags BuildTags

	// Platforms contains a set of build constraints for each platform. Each set
	// should include GenericTags. It should not be nil.
	Platforms PlatformTags

	// GoPrefix is the portion of the import path for the root of this repository.
	// This is used to map imports to labels within the repository.
	GoPrefix string

	// DepMode determines how imports outside of GoPrefix are resolved.
	DepMode DependencyMode

	// KnownImports is a list of imports to add to the external resolver cache
	KnownImports []string
}

Config holds information about how Gazelle should run. This is mostly based on command-line arguments.

func (*Config) DefaultBuildFileName

func (c *Config) DefaultBuildFileName() string

func (*Config) IsValidBuildFileName

func (c *Config) IsValidBuildFileName(name string) bool

func (*Config) PreprocessTags

func (c *Config) PreprocessTags()

PreprocessTags performs some automatic processing on generic and platform-specific tags before they are used to match files.

type DependencyMode

type DependencyMode int

DependencyMode determines how imports of packages outside of the prefix are resolved.

const (
	// ExternalMode indicates imports should be resolved to external dependencies
	// (declared in WORKSPACE).
	ExternalMode DependencyMode = iota

	// VendorMode indicates imports should be resolved to libraries in the
	// vendor directory.
	VendorMode
)

func DependencyModeFromString

func DependencyModeFromString(s string) (DependencyMode, error)

DependencyModeFromString converts a string from the command line to a DependencyMode. Valid strings are "external", "vendor". An error will be returned for an invalid string.

type PlatformTags

type PlatformTags map[string]BuildTags

PlatformTags is a map from config_setting labels (for example, "@io_bazel_rules_go//go/platform:linux_amd64") to a sets of build tags that are true on each platform (for example, "linux,amd64").

var DefaultPlatformTags PlatformTags

DefaultPlatformTags is the default set of platforms that Gazelle will generate files for. These are the platforms that both Go and Bazel support.

Jump to

Keyboard shortcuts

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