dep

package
v0.0.0-...-69d9307 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package dep provides data structures for representing dependency types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrKey

type AttrKey int8

AttrKey represents an attribute key that may be applied to a Type.

Its specific values are an implementation detail of this package; only use the named constants in client code.

const (

	// Dev indicates the dependency is required to develop a package.
	// Its value is ignored; its presence is the indicator.
	Dev AttrKey = -0x01

	// Opt indicates the dependency is optional; it is not
	// necessary but may provide additional functionality.
	// Its value is ignored; its presence is the indicator.
	Opt AttrKey = -0x02

	// Test indicates the dependency is required to build a package's tests.
	// Its value is ignored; its presence is the indicator.
	Test AttrKey = -0x04

	// XTest indicates the dependency is from a Go XTest.
	XTest AttrKey = 1

	// Framework indicates the dependency belongs to a NuGet target framework.
	Framework AttrKey = 2

	// Scope indicates the scope of a dependency.
	// Its value should be one of these:
	// - For Maven dependencies: provided, runtime, system, import
	// - For Cargo dependencies: build
	// - For NPM dependencies: peer, bundle
	// Maven scopes 'compile' and 'test' are not valid here. They are
	// modeled as regular dependency and test dependency. NPM scope 'bundle'
	// means the dependency was declared as such, not necessarily that it
	// was found inside the tarball.
	Scope AttrKey = 3

	// Attribute keys for Maven dependencies.
	//
	// MavenClassifier and MavenArtifactType are part of Maven dependency key.
	// They are both free text defined by Maven package maintainers.
	//
	// MavenDependencyOrigin indicates the origin of a Maven dependency.
	// Its value should be one of these: import, management, parent.
	//
	// MavenExclusions holds the list of exclusions for the given dependency.
	// Each item of the list is separated by | (a pipe) and is of the form
	// groupID:artifactID where groupID and/or artifactID may be a * (wildcard).
	MavenClassifier       AttrKey = 4
	MavenArtifactType     AttrKey = 5
	MavenDependencyOrigin AttrKey = 6
	MavenExclusions       AttrKey = 9

	// EnabledDependencies represents which optional dependencies
	// are enabled by this dependent in its dependency.
	//
	// In Cargo, this is a comma-separated list of features/optional
	// dependencies that are activated by this dependency.
	EnabledDependencies AttrKey = 7

	// KnownAs is the name under which this dependency is referenced
	// by the package.
	KnownAs AttrKey = 8

	// Environment holds conditions used to filter dependencies according to
	// local context.
	//
	// In PyPI this holds a PEP 508 environment marker.
	Environment AttrKey = 10

	// Selector is used in the context of resolved graphs and flags whether
	// the dependency is the selector of the concrete version.
	// In the case of NPM, this is set for all the edges that are not marked
	// as dedup in the install tree.
	// For Maven, this is set for all the edges that would appear in the
	// dependency tree.
	Selector AttrKey = 11
)

func (AttrKey) String

func (i AttrKey) String() string

type Type

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

Type indicates the type of a dependency edge.

The zero value of Type is a regular dependency. Attributes may be added to a Type to annotate it with extra details or restrictions.

func NewType

func NewType(attrs ...AttrKey) Type

NewType constructs a Type with the given attributes set. This is a convenience constructor for Types with value-less attributes.

func (*Type) AddAttr

func (t *Type) AddAttr(key AttrKey, value string)

AddAttr adds an attribute to the Type.

func (*Type) Clone

func (t *Type) Clone() Type

Clone returns a clone of the given Type.

func (Type) Compare

func (t Type) Compare(other Type) int

Compare returns -1, 0 or 1 depending on whether the Type is ordered before, equal to or after the other Type.

func (Type) Equal

func (t Type) Equal(other Type) bool

Equal reports whether the Type is identical to other.

func (*Type) GetAttr

func (t *Type) GetAttr(key AttrKey) (value string, ok bool)

GetAttr gets an attribute from the Type.

func (*Type) HasAttr

func (t *Type) HasAttr(key AttrKey) bool

HasAttr reports whether the type has the given attribute. This is a convenience method when the key is used as a flag.

func (Type) IsRegular

func (t Type) IsRegular() bool

IsRegular reports whether the Type is a regular, unattributed Type.

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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