Documentation
¶
Overview ¶
Package vendeps provides functionality for managing vendored external dependencies.
Index ¶
- Constants
- Variables
- func AcceptableLicense(options string) (license string, ok bool)
- func ApplyPatches(dir string, patchArgs []string, patches []string) error
- func DigestDirectory(fsys fs.FS, dir string, ignore ...string) (string, error)
- func DigestFiles(fsys fs.FS, filenames []string) (string, error)
- func FetchGoModule(ctx context.Context, mod *GoModule, dir string) error
- func UpdateGoModule(ctx context.Context, mod *UpdateDep) (updated bool, err error)
- type Action
- type CopyBUILD
- type Deps
- type DownloadGoModule
- type GoModule
- type GoPackage
- type RemoveAll
- type TextFiles
- type UpdateDep
- type UpdateDeps
Constants ¶
const ( BuildBazel = "BUILD.bazel" DepsBzl = "deps.bzl" ManifestBzl = "manifest.bzl" Vendor = "vendor" )
Variables ¶
var Licenses = map[string]string{
"0BSD": "BSD Zero Clause License",
"Apache-2.0": "Apache License 2.0",
"BSD-2-Clause": "BSD 2-Clause \"Simplified\" License",
"BSD-3-Clause": "BSD 3-Clause \"New\" or \"Revised\" License",
"MIT": "MIT License",
}
Licenses is the set of acceptable software licenses, referenced by their SPDX id.
Functions ¶
func AcceptableLicense ¶
AcceptableLicense determines whether the given set of licenses includes at least one acceptable license as described above.
func ApplyPatches ¶
ApplyPatches applies the given set of patch files to the directory specified.
func DigestDirectory ¶
DigestDirectory produces the digest for a directory and its contents in a filesystem. This is performed by hashing one line of text for each file, with the files sorted into lexographical order. Each line consists of the hexadecimal digest of the file's contents, two spaces (\x20), the relative filename, and a newline (\x0a).
Filenames containing a newline (\x0a) are not allowed.
Any filenames listed in ignore are not included in the hashing process.
The final digest is formatted as the hash algorithm name, a colon (\x3a), and the hexadecimal digest.
func DigestFiles ¶
DigestFiles produces the digest for a set of named files and their contents in a filesystem. This is performed by hashing one line of text for each file, with the files sorted into lexographical order. Each line consists of the hexadecimal digest of the file's contents, two spaces (\x20), the relative filename, and a newline (\x0a).
Filenames containing a newline (\x0a) are not allowed.
The final digest is formatted as the hash algorithm name, a colon (\x3a), and the hexadecimal digest.
func FetchGoModule ¶
FetchGoModule downloads a Go module using the proxy.golang.org Go module proxy API.
Types ¶
type Action ¶
Action represents a logical action that should be taken to progress the vendoring of a set of software dependencies.
An action should contain any context necessary to perform its tasks.
func StripCachedActions ¶
StripCachedActions processes the action sequence, removing any actions that the cache can prove are unnecessary, returning the resulting action sequence.
If no actions can be cached, or if there is no cache, the unmodified action sequence is returned.
type Deps ¶
type Deps struct {
Go []*GoModule `bzl:"go/module"`
}
Deps describes a set of software dependencies.
type DownloadGoModule ¶
DownloadModule indicates that the named module should be downloaded from the module proxy and extracted into the given path.
func (DownloadGoModule) String ¶
func (c DownloadGoModule) String() string
type GoModule ¶
type GoModule struct { // Dependency details. Name string `bzl:"name"` Version string `bzl:"version"` // Patches to be applied to the // downloaded module, before the // BUILD file is copied/generated. PatchArgs []string `bzl:"patch_args"` Patches []string `bzl:"patches"` // Packages that should be used. Packages []*GoPackage `bzl:"packages/package"` // Directories containing plain files. Directories []*TextFiles `bzl:"directories/files"` // Generation details. Digest string `bzl:"digest"` PatchDigest string `bzl:"patch_digest"` }
GoModule contains the information necessary to vendor a Go module, specifying the set of packages within the module that are used.
type GoPackage ¶
type GoPackage struct { // Dependency details. Name string `bzl:"name"` Files []string // Whether to use Bzlmod names // (eg rules_go, rather than io_bazel_rules_go). Bzlmod bool // Manually-managed BUILD file. BuildFile string `bzl:"build_file"` // Build configuration. Deps []string `bzl:"deps"` Embed []string `bzl:"embed"` EmbedGlobs []string `bzl:"embed_globs"` // Binary configuration. Binary bool `bzl:"binary"` BinaryDeps []string `bzl:"binary_deps"` // Test configuration. NoTests bool `bzl:"no_tests"` TestFiles []string TestSize string `bzl:"test_size"` TestData []string `bzl:"test_data"` TestDataGlobs []string `bzl:"test_data_globs"` TestDeps []string `bzl:"test_deps"` }
GoPackage describes a package within a Go module.
type RemoveAll ¶
type RemoveAll string
RemoveAll deletes a directory, along with any child nodes that exist. If the path does not exist, there is no effect.
type TextFiles ¶
type TextFiles struct { // Dependency details. Name string `bzl:"name"` // Export files publicly. ExportsFiles []string `bzl:"exports_files"` }
TextFiles contains information necessary to manage text files.
type UpdateDep ¶
UpdateDep describes the least information necessary to determine a third-party software library. This is used when determining whether updates are available.
type UpdateDeps ¶
type UpdateDeps struct {
Go []*UpdateDep
}
UpdateDeps includes a set of dependencies for the purposes of updating them.