Documentation ¶
Overview ¶
Package swiftpkg represents the unified information about a Swift package.
Information from the Swift description JSON and the Swit dump JSON is merged to create the types in this package.
Index ¶
- type ByNameReference
- type ClangSettings
- type Dependencies
- type Dependency
- type DependencyRequirement
- type FileSystem
- type ModuleType
- type PackageInfo
- type Platform
- type Product
- type ProductReference
- type ProductType
- type RemoteLocation
- type SourceControl
- type SourceControlLocation
- type SourceType
- type Target
- type TargetDependency
- type TargetReference
- type TargetType
- type Targets
- type VersionRange
Constants ¶
This section is empty.
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 references a product or target by name.
func NewByNameReferenceFromManifestInfo ¶
func NewByNameReferenceFromManifestInfo(dumpBNR *spdump.ByNameReference) *ByNameReference
NewByNameReferenceFromManifestInfo returns a by-name reference from manifest information.
type ClangSettings ¶
type ClangSettings struct {
Defines []string
}
A ClangSettings represents the clang-specific settings for a Swift target.
func NewClangSettingsFromManifestInfo ¶
func NewClangSettingsFromManifestInfo(dumpTS []spdump.TargetSetting) (*ClangSettings, error)
NewClangSettingsFromManifestInfo returns the clang settings from manfiest information.
type Dependencies ¶
type Dependencies []*Dependency
A Dependencies represents a list of external dependencies.
func (Dependencies) Identities ¶
func (deps Dependencies) Identities() []string
Identities returns the identity values for the dependencies.
type Dependency ¶
type Dependency struct { SourceControl *SourceControl FileSystem *FileSystem }
A Dependency represents an external dependency.
func NewDependencyFromManifestInfo ¶
func NewDependencyFromManifestInfo(dumpD *spdump.Dependency) (*Dependency, error)
NewDependencyFromManifestInfo returns an external dependency based upon the manifest information.
func (*Dependency) Identity ¶
func (d *Dependency) Identity() string
Identity returns the unique identity for the external dependency.
func (*Dependency) URL ¶
func (d *Dependency) URL() string
URL returns the URL for the external dependency.
type DependencyRequirement ¶
type DependencyRequirement struct {
Ranges []*VersionRange
}
func NewDependencyRequirementFromManifestInfo ¶
func NewDependencyRequirementFromManifestInfo(dr *spdump.DependencyRequirement) *DependencyRequirement
type FileSystem ¶
func NewFileSystemFromManifestInfo ¶
func NewFileSystemFromManifestInfo(fs *spdump.FileSystem) *FileSystem
type ModuleType ¶
type ModuleType int
A ModuleType is an enum for the Swift manifest module type.
const ( UnknownModuleType ModuleType = iota SwiftModuleType ClangModuleType BinaryModuleType PluginModuleType )
func NewModuleType ¶
func NewModuleType(str string) ModuleType
NewModuleType returns the module type from the provided string value.
type PackageInfo ¶
type PackageInfo struct { Name string DisplayName string Path string ToolsVersion string Targets Targets Platforms []*Platform Products []*Product Dependencies Dependencies }
A PackageInfo encapsulates all of the information about a Swift package.
func NewPackageInfo ¶
func NewPackageInfo(sw swiftbin.Executor, dir string) (*PackageInfo, error)
NewPackageInfo returns the Swift package information from a Swift package on disk.
func (*PackageInfo) ExportedTargets ¶
func (pi *PackageInfo) ExportedTargets() ([]*Target, error)
ExportedTargets returns targets that are made available outside of the package via a Product reference.
func (*PackageInfo) ProductReferences ¶
func (pi *PackageInfo) ProductReferences() []*ProductReference
ProductReferences returns a uniq slice of the product references used in the manifest.
type Platform ¶
A Platform represents a Swift package platform.
func NewPlatfromFromManifestInfo ¶
NewPlatfromFromManifestInfo returns a Swift package platform from manifest information.
type Product ¶
type Product struct { Name string Targets []string Type ProductType }
A Product represents a Swift product.
type ProductReference ¶
type ProductReference struct { // Product name ProductName string // External dependency identity Identity string }
A ProductReference represents a reference to a product.
func NewProductReferenceFromManifestInfo ¶
func NewProductReferenceFromManifestInfo(dumpPR *spdump.ProductReference) *ProductReference
NewProductReferenceFromManifestInfo returns a product reference from manifest information.
func (*ProductReference) UniqKey ¶
func (pr *ProductReference) UniqKey() string
UniqKey returns the value used to lookup a Swift product from a reference.
type ProductType ¶
type ProductType int
A ProductType is an enum for the type of Swift product.
const ( UnknownProductType ProductType = iota ExecutableProductType LibraryProductType PluginProductType )
type RemoteLocation ¶
type RemoteLocation struct {
URL string
}
func NewRemoteLocationFromManifestInfo ¶
func NewRemoteLocationFromManifestInfo(rl *spdump.RemoteLocation) *RemoteLocation
type SourceControl ¶
type SourceControl struct { Identity string Location *SourceControlLocation Requirement *DependencyRequirement }
A SourceControl represents the source control information for an external dependency.
func NewSourceControlFromManifestInfo ¶
func NewSourceControlFromManifestInfo(dumpSC *spdump.SourceControl) *SourceControl
NewSourceControlFromManifestInfo returns the source control info from manifest information.
type SourceControlLocation ¶
type SourceControlLocation struct {
Remote *RemoteLocation
}
func NewSourceControlLocationFromManifestInfo ¶
func NewSourceControlLocationFromManifestInfo(dumpL *spdump.SourceControlLocation) *SourceControlLocation
type SourceType ¶
type SourceType int
A SourceType is an enum that identifies the type of source files use to implement a Swift manifest target.
const ( UnknownSourceType SourceType = iota SwiftSourceType ClangSourceType ObjcSourceType BinarySourceType )
func NewSourceType ¶
func NewSourceType(moduleType ModuleType, srcPaths []string) SourceType
NewSourceType returns the source type given the module type and a list of the sources for a target.
func (SourceType) MarshalJSON ¶
func (m SourceType) MarshalJSON() ([]byte, error)
func (*SourceType) UnmarshalJSON ¶
func (m *SourceType) UnmarshalJSON(b []byte) error
type Target ¶
type Target struct { Name string C99name string Type TargetType ModuleType ModuleType Path string Sources []string Dependencies []*TargetDependency CSettings *ClangSettings SrcType SourceType ProductMemberships []string }
A Target represents a Swift target.
type TargetDependency ¶
type TargetDependency struct { Product *ProductReference ByName *ByNameReference Target *TargetReference }
A TargetDependency represents a Swift target dependency.
func NewTargetDependencyFromManifestInfo ¶
func NewTargetDependencyFromManifestInfo(dumpTD *spdump.TargetDependency) (*TargetDependency, error)
NewTargetDependencyFromManifestInfo returns a target dependency from manifest information.
func (*TargetDependency) ImportName ¶
func (td *TargetDependency) ImportName() string
ImportName returns the name used to import the dependency.
type TargetReference ¶
type TargetReference struct {
TargetName string
}
TargetReference references a target by name.
func NewTargetReferenceFromManifestInfo ¶
func NewTargetReferenceFromManifestInfo(dumpTR *spdump.TargetReference) *TargetReference
NewTargetReferenceFromManifestInfo returns a target reference from manifest information.
type TargetType ¶
type TargetType int
A TargetType is an enum for a Swift target type.
const ( UnknownTargetType TargetType = iota ExecutableTargetType LibraryTargetType TestTargetType PluginTargetType )
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, returns nil.
func (Targets) FindByPath ¶
FindByPath returns the target with the matching path. Otherwise, returns nil.
type VersionRange ¶
func NewVersionRangeFromManifestInfo ¶
func NewVersionRangeFromManifestInfo(vr *spdump.VersionRange) *VersionRange