spdesc

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package spdesc provides types and utility functions for reading Swift package description JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Identity    string
	Type        string
	URL         string
	Requirement DependencyRequirement
}

A Dependency represents a Swift external dependency.

type DependencyRequirement

type DependencyRequirement struct {
	Range []VersionRange
}

A DependencyRequirement represents the eligibility requirements for an external dependency.

type Manifest

type Manifest struct {
	Name                string
	ManifestDisplayName string `json:"manifest_display_name"`
	Path                string
	ToolsVersion        string `json:"tools_version"`
	Targets             Targets
	Platforms           []Platform
	Products            []Product
	Dependencies        []Dependency
}

A Manifest represents the root of the description JSON. The members of the struct provide access to the Swift manifest parts.

func NewManifestFromJSON

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

NewManifestFromJSON creates a Swift manifest from description JSON.

type Platform

type Platform struct {
	Name    string
	Version string
}

A Platform represents a Swift package platform.

type Product

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

A Product represents a Swift product.

type ProductType

type ProductType int

A ProductType is an enum that identifies the type of Swift product.

const (
	UnknownProductType ProductType = iota
	ExecutableProductType
	LibraryProductType
	PluginProductType
)

func (*ProductType) UnmarshalJSON

func (pt *ProductType) UnmarshalJSON(b []byte) error

type Target

type Target struct {
	Name                string
	C99name             string `json:"c99name"`
	Type                string
	ModuleType          string `json:"module_type"`
	Path                string
	Sources             []string
	TargetDependencies  []string `json:"target_dependencies"`
	ProductDependencies []string `json:"product_dependencies"`
	ProductMemberships  []string `json:"product_memberships"`
}

A Target represents a Swift target.

func (*Target) SourcesWithPath

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

SourcesWithPath returns the sources prepended by the target's path.

type Targets

type Targets []Target

Targets represents a slice of Swift targets.

func (Targets) FindByName

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

FindByName returns the Swift target that matches the provided name. It returns nil, if a match is not found.

func (Targets) FindByPath

func (ts Targets) FindByPath(path string) *Target

FindByPath returns the Swift target that matches the provided path. It returns nil, if a match is not found.

type VersionRange

type VersionRange struct {
	LowerBound string `json:"lower_bound"`
	UpperBound string `json:"upper_bound"`
}

A VersionRange represents an upper and lower bound for the elgibility of an external dependency.

Jump to

Keyboard shortcuts

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