Documentation ¶
Overview ¶
Package spdump provides types and utility functions for reading Swift package dump JSON.
The JSON formats described in this file are for the swift package dump-package JSON output.
Index ¶
- Constants
- type ByNameReference
- type Dependency
- type DependencyRequirement
- type FileSystem
- type Manifest
- type Platform
- type Product
- type ProductReference
- type ProductType
- type RemoteLocation
- type SourceControl
- type SourceControlLocation
- type Target
- type TargetDependency
- type TargetReference
- type TargetSetting
- type TargetSettingKind
- type TargetType
- type Targets
- type ToolType
- type VersionRange
Constants ¶
const ( UnknownTargetSettingKind = iota DefineTargetSettingKind )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByNameReference ¶
type ByNameReference struct { // Product name or target name Name string }
A ByNameReference represents a byName reference. It can be a product name or a target name.
func (*ByNameReference) UnmarshalJSON ¶
func (bnr *ByNameReference) UnmarshalJSON(b []byte) error
type Dependency ¶
type Dependency struct { SourceControl *SourceControl `json:"sourceControl"` FileSystem *FileSystem `json:"fileSystem"` }
A Dependency represents an external dependency.
func (*Dependency) Identity ¶
func (d *Dependency) Identity() string
Identity returns the value that identifies the external dependency in the manifest.
func (*Dependency) URL ¶
func (d *Dependency) URL() string
URL returns the URL for the external dependency.
type DependencyRequirement ¶
type DependencyRequirement struct {
Ranges []*VersionRange `json:"range"`
}
A DependencyRequirement represents the eligibility requirements for an external dependency.
type FileSystem ¶
FileSystem represents the location of an external dependency as a local Swift package.
func (*FileSystem) UnmarshalJSON ¶
func (fs *FileSystem) UnmarshalJSON(b []byte) error
type Manifest ¶
type Manifest struct { Name string Dependencies []Dependency Platforms []Platform Products []Product Targets Targets CLanguageStandard string `json:"cLanguageStandard"` CxxLanguageStandard string `json:"cxxLanguageStandard"` }
A Manifest represents a Swift manifest as serialized by `swift package dump-package`.
func NewManifestFromJSON ¶
NewManifestFromJSON creates a manifest from package dump JSON.
type Product ¶
type Product struct { Name string Targets []string Type ProductType }
A Product represents a Swift product.
type ProductReference ¶
A ProductReference encapsulates a reference to a Swift product.
func (*ProductReference) UniqKey ¶
func (pr *ProductReference) UniqKey() string
UniqKey returns a string that can be used as a map key for the product.
func (*ProductReference) UnmarshalJSON ¶
func (pr *ProductReference) UnmarshalJSON(b []byte) error
type ProductType ¶
type ProductType int
A ProductType is an enum for identifying the type of Swift product.
const ( UnknownProductType ProductType = iota ExecutableProductType LibraryProductType PluginProductType )
func (*ProductType) UnmarshalJSON ¶
func (pt *ProductType) UnmarshalJSON(b []byte) error
type RemoteLocation ¶
type RemoteLocation struct {
URL string
}
A RemoteLocation represents a remote location for a source control repository.
func (*RemoteLocation) UnmarshalJSON ¶
func (rl *RemoteLocation) UnmarshalJSON(b []byte) error
type SourceControl ¶
type SourceControl struct { Identity string Location *SourceControlLocation Requirement *DependencyRequirement }
A SourceControl represents the retrieval information for an external dependency in a source control server.
func (*SourceControl) UnmarshalJSON ¶
func (sc *SourceControl) UnmarshalJSON(b []byte) error
type SourceControlLocation ¶
type SourceControlLocation struct {
Remote *RemoteLocation
}
A SourceControlLocation represents the location of a source control repository.
func (*SourceControlLocation) UnmarshalJSON ¶ added in v0.13.0
func (scl *SourceControlLocation) UnmarshalJSON(b []byte) error
type Target ¶
type Target struct { Name string Type TargetType Dependencies []TargetDependency Settings []TargetSetting }
A Target represents a Swift target.
type TargetDependency ¶
type TargetDependency struct { Product *ProductReference ByName *ByNameReference Target *TargetReference }
A TargetDependency represents a reference to a target's dependency.
func (*TargetDependency) ImportName ¶
func (td *TargetDependency) ImportName() string
ImportName returns the name used to import the dependency.
type TargetReference ¶
type TargetReference struct {
TargetName string
}
A TargetReference represents a reference to a Swift target.
func (*TargetReference) UnmarshalJSON ¶
func (tr *TargetReference) UnmarshalJSON(b []byte) error
type TargetSetting ¶
type TargetSetting struct { Tool ToolType Kind TargetSettingKind Defines []string }
A TargetSetting represents customized settings for a target.
func (*TargetSetting) UnmarshalJSON ¶
func (ts *TargetSetting) UnmarshalJSON(b []byte) error
type TargetSettingKind ¶
type TargetSettingKind int
A TargetSettingKind is an enum represeting the kind for a tool setting.
type TargetType ¶
type TargetType int
A TargetType is an enum for a Swift target type.
const ( UnknownTargetType TargetType = iota ExecutableTargetType LibraryTargetType TestTargetType PluginTargetType )
func (*TargetType) UnmarshalJSON ¶
func (tt *TargetType) UnmarshalJSON(b []byte) error
type Targets ¶
type Targets []Target
A Targets represents a slice of Swift targets.
func (Targets) FindByName ¶
FindByName returns the target with the matching name. Otherwise, it returns nil.
type VersionRange ¶
A VersionRange represents a semver range for an external dependency.