config

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

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
}

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