spdump

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

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

View Source
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

type FileSystem struct {
	Identity string
	Path     string
}

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

func NewManifestFromJSON(bytes []byte) (*Manifest, error)

NewManifestFromJSON creates a manifest from package dump JSON.

type Platform

type Platform struct {
	Name    string `json:"platformName"`
	Version string
}

A Platform represents a Swift platform.

type Product

type Product struct {
	Name    string
	Targets []string
	Type    ProductType
}

A Product represents a Swift product.

type ProductReference

type ProductReference struct {
	ProductName    string
	DependencyName string
}

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.

func (*Target) Imports

func (t *Target) Imports() []string

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

func (ts Targets) FindByName(name string) *Target

FindByName returns the target with the matching name. Otherwise, it returns nil.

type ToolType

type ToolType int

A ToolType is an enum representing tool setting type.

const (
	UnknownToolType ToolType = iota
	ClangToolType
)

type VersionRange

type VersionRange struct {
	LowerBound string
	UpperBound string
}

A VersionRange represents a semver range for an external dependency.

Jump to

Keyboard shortcuts

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