Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TestBzlmodDir = ""
TestBzlmodDir can be set in order to override the normal bzlmod cache dir for testing. Usage:
func TestSomething(t *testing.T) { fetch.TestBzlmodDir = t.TempDir() defer func() { fetch.TestBzlmodDir = "" }() ... }
Functions ¶
func HTTPCacheFilePath ¶
func SharedRepoDir ¶
SharedRepoDir returns the path to the directory under which the shared repo identified by the given hash is placed.
Types ¶
type Archive ¶
type Archive struct { URLs []string Integrity string StripPrefix string Patches []Patch // Fprint should be a hash computed from information that is enough to distinguish this archive fetch from // others. It will be used as the name of the shared repo directory. // The field is not called Fingerprint to avoid conflict with the method name. Fprint string }
Archive represents an archive to be fetched from one of multiple equivalent URLs.
func (*Archive) AppendPatches ¶
func (*Archive) Fingerprint ¶
type Fetcher ¶
type Fetcher interface { // Fetch performs the fetch and returns the absolute path to the local directory where the fetched contents can be // accessed. // If vendorDir is non-empty, we're operating in vendoring mode; Fetch should make the contents available under // vendorDir if appropriate. Otherwise, Fetch is free to place the contents wherever. Fetch(vendorDir string) (string, error) // Fingerprint returns a fingerprint of the fetched contents. When the fingerprint changes, it's a signal that the // repo should be re-fetched. Note that the fingerprint need not necessarily be calculated from the actual bytes of // fetched contents. Fingerprint() string // AppendPatches appends an extra set of patches to the Fetcher. This can return an error if, for example, this // Fetcher doesn't support patches. AppendPatches(patches []Patch) error }
Fetcher contains all the information needed to "fetch" a repo. "Fetch" here is simply defined as making the contents of a repo available in a local directory through some means.
type LocalPath ¶
type LocalPath struct {
Path string
}
LocalPath represents a locally available unpacked directory.
func (*LocalPath) AppendPatches ¶
func (*LocalPath) Fingerprint ¶
type Wrapper ¶
type Wrapper struct { Archive *Archive `json:",omitempty"` Git *Git `json:",omitempty"` LocalPath *LocalPath `json:",omitempty"` }
Wrapper wraps all known implementations of the Fetcher interface and acts as a multiplexer (only 1 member should be non-nil). It's useful in JSON marshalling/unmarshalling.