rules

package
v0.0.0-...-18fadf5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 12 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 ImportPathToBazelRepoName

func ImportPathToBazelRepoName(importpath string) string

ImportPathToBazelRepoName converts a Go import path into a bazel repo name following the guidelines in http://bazel.io/docs/be/functions.html#workspace

Types

type ExternalResolver

type ExternalResolver int

ExternalResolver resolves external packages.

const (
	// External resolves external packages as external packages with
	// go_repository.
	External ExternalResolver = iota
	// Vendored resolves external packages as vendored packages in vendor/.
	Vendored
)

type Generator

type Generator interface {
	// Generate generates build rules for build targets in a Go package in a
	// repository.
	//
	// "rel" is a relative slash-separated path from the repostiry root
	// directory to the Go package directory. It is empty if the package
	// directory is the repository root itself.
	// "pkg" is a description about the package.
	Generate(rel string, pkg *build.Package) ([]*bzl.Rule, error)
}

Generator generates Bazel build rules for Go build targets

func NewGenerator

func NewGenerator(repoRoot string, goPrefix string, external ExternalResolver) Generator

NewGenerator returns an implementation of Generator.

"repoRoot" is a path to the root directory of the repository. "goPrefix" is the go_prefix corresponding to the repository root. See also https://github.com/bazelbuild/rules_go#go_prefix. "external" is how external packages should be resolved.

Jump to

Keyboard shortcuts

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