spreso

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package spreso provides types that represent the contents of a `Package.resolved` file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchPinState

type BranchPinState struct {
	Name     string
	Revision string
}

A BranchPinState represents a source control branch.

func NewBranchPinState

func NewBranchPinState(name, revision string) *BranchPinState

NewBranchPinState returns a branch pin state.

func (*BranchPinState) Commit

func (bps *BranchPinState) Commit() string

Commit returns the source control commit value (e.g., hash).

func (*BranchPinState) PinStateType

func (bps *BranchPinState) PinStateType() PinStateType

PinStateType returns the type of pin state.

type PackageReference

type PackageReference struct {
	Identity string
	Kind     PkgRefKind
	Location string
	Name     string
}

A PackageReference represents a serialized form of PackageModel.PackageReference https://github.com/apple/swift-package-manager/blob/main/Sources/PackageModel/PackageReference.swift

func NewPkgRefFromV1Pin

func NewPkgRefFromV1Pin(v1p *V1Pin) (*PackageReference, error)

func NewPkgRefFromV2Pin

func NewPkgRefFromV2Pin(v2p *V2Pin) (*PackageReference, error)

func (*PackageReference) Remote

func (pr *PackageReference) Remote() string

Remote returns the location of the remote package.

type Pin

type Pin struct {
	PkgRef *PackageReference
	State  PinState
}

A Pin is the normalized representation for a resolved Swift package.

func NewPinFromV1Pin

func NewPinFromV1Pin(v1p *V1Pin) (*Pin, error)

func NewPinFromV2Pin

func NewPinFromV2Pin(v2p *V2Pin) (*Pin, error)

func NewPinsFromResolvedPackageJSON

func NewPinsFromResolvedPackageJSON(b []byte) ([]*Pin, error)

NewPinsFromResolvedPackageJSON returns the pins (resolved Swift package details) from `Package.resolved` JSON.

func NewPinsFromV1PinStore

func NewPinsFromV1PinStore(ps *V1PinStore) ([]*Pin, error)

func NewPinsFromV2PinStore

func NewPinsFromV2PinStore(ps *V2PinStore) ([]*Pin, error)

type PinState

type PinState interface {
	PinStateType() PinStateType
}

A PinState is the interface that all underlying pin state representations must implement.

func NewPinStateFromV1PinState

func NewPinStateFromV1PinState(ps *V1PinState) PinState

func NewPinStateFromV2PinState

func NewPinStateFromV2PinState(ps *V2PinState) (PinState, error)

type PinStateType

type PinStateType int

A PinStateType is an enum for the representation type for the pin state.

const (
	UnknownPinStateType PinStateType = iota
	BranchPinStateType
	VersionPinStateType
	RevisionPinStateType
)

type PkgRefKind

type PkgRefKind int

A PkgRefKind is an enum representing the kind of package reference.

const (
	UnknownPkgRefKind PkgRefKind = iota
	RootPkgRefKind
	FileSystemPkgRefKind
	LocalSourceControlPkgRefKind
	RemoteSourceControlPkgRefKind
	RegistryPkgRefKind
)

func (*PkgRefKind) UnmarshalJSON

func (prk *PkgRefKind) UnmarshalJSON(b []byte) error

type RevisionPinState

type RevisionPinState struct {
	Revision string
}

A RevisionPinState represents a commit value/hash pin state.

func NewRevisionPinState

func NewRevisionPinState(revision string) *RevisionPinState

NewRevisionPinState returns a commit value pin state.

func (*RevisionPinState) Commit

func (rps *RevisionPinState) Commit() string

Commit returns the source control commit value (e.g., hash).

func (*RevisionPinState) PinStateType

func (rps *RevisionPinState) PinStateType() PinStateType

PinStateType returns the type of pin state.

type V1Container

type V1Container struct {
	Pins []*V1Pin
}

type V1Pin

type V1Pin struct {
	Package       string
	RepositoryURL string
	State         *V1PinState
}

type V1PinState

type V1PinState struct {
	Revision string
	Branch   string
	Version  string
}

type V1PinStore

type V1PinStore struct {
	Version int
	Object  *V1Container
}

A V1PinStore represents PinStorage.V1. https://github.com/apple/swift-package-manager/blob/main/Sources/PackageGraph/PinsStore.swift#L230

type V2Pin

type V2Pin struct {
	Identity string
	Kind     V2PinKind
	Location string
	State    *V2PinState
}

type V2PinKind

type V2PinKind int
const (
	UnknownV2PinKind V2PinKind = iota
	LocalSourceControlV2PinKind
	RemoteSourceControlV2PinKind
	RegistryV2PinKind
)

func (V2PinKind) PkgRefKind

func (vpk V2PinKind) PkgRefKind() PkgRefKind

func (*V2PinKind) UnmarshalJSON

func (vpk *V2PinKind) UnmarshalJSON(b []byte) error

type V2PinState

type V2PinState struct {
	Version  string
	Branch   string
	Revision string
}

type V2PinStore

type V2PinStore struct {
	Version int
	Pins    []*V2Pin
}

A V2PinStore represents PinStorage.V2. https://github.com/apple/swift-package-manager/blob/main/Sources/PackageGraph/PinsStore.swift#L230

type VersionPinState

type VersionPinState struct {
	Version  string
	Revision string
}

A VersionPinState represents a semver tagged pin state.

func NewVersionPinState

func NewVersionPinState(version, revision string) *VersionPinState

NewVersionPinState returns a semver tagged pin state.

func (*VersionPinState) Commit

func (vps *VersionPinState) Commit() string

Commit returns the source control commit value (e.g., hash).

func (*VersionPinState) PinStateType

func (vps *VersionPinState) PinStateType() PinStateType

PinStateType returns the type of pin state.

Jump to

Keyboard shortcuts

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