bazelfiles

package
v2.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

package bazelfiles is used to find and handle Bazel WORKSPACE and bzl files.

Index

Constants

View Source
const (
	BazelFileTypeBzl       = iota // BazelFileTypeBzl is a .bzl file
	BazelFileTypeWorkspace        // BazelFileTypeWorkspace is a WORKSPACE or WORKSPACE.bazel file
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BazelFile

type BazelFile struct {
	RelPath string
	AbsPath string
	Type    BazelFileType
}

BazelFile is a reference (path) to a Bazel file.

type BazelFileType

type BazelFileType int

BazelFileType is the type of a Bazel file.

type Helper

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

Helper is used to find and handle Bazel WORKSPACE and bzl files.

func New

func New() (*Helper, error)

New creates a new BazelFilesHelper.

func (*Helper) Diff

func (h *Helper) Diff(bf BazelFile, buildfile *build.File) (string, error)

Diff returns the diff between the saved and the updated (in-memory) version of a Bazel file.

func (*Helper) FindFiles

func (h *Helper) FindFiles() ([]BazelFile, error)

FindFiles returns the paths to all Bazel files in the Bazel workspace.

func (*Helper) LoadFile

func (h *Helper) LoadFile(bf BazelFile) (*build.File, error)

LoadFile loads a Bazel file.

func (*Helper) WriteFile

func (h *Helper) WriteFile(bf BazelFile, buildfile *build.File) error

WriteFile writes (updates) a Bazel file.

type LookupEnv

type LookupEnv func(key string) (string, bool)

LookupEnv can be the real os.LookupEnv or a mock for testing.

Jump to

Keyboard shortcuts

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