ManagedDependency
An individual managed dependency.
struct ManagedDependency
Each dependency will have a checkout containing the sources at a particular revision, and may have an associated version.
An individual managed dependency.
struct ManagedDependency
Each dependency will have a checkout containing the sources at a particular revision, and may have an associated version.
import Workspace
class Workspace
A workspace represents the state of a working project directory.
convenience init(fileSystem: FileSystem? = .none, environment: Environment = .current, forRootPackage packagePath: AbsolutePath, authorizationProvider: AuthorizationProvider? = .none, registryAuthorizationProvider: AuthorizationProvider? = .none, configuration: WorkspaceConfiguration? = .none, cancellator: Cancellator? = .none, initializationWarningHandler: ((String) -> Void)? = .none, customHostToolchain: UserToolchain? = .none, customManifestLoader: ManifestLoaderProtocol? = .none, customPackageContainerProvider: PackageContainerProvider? = .none, customRepositoryProvider: RepositoryProvider? = .none, delegate: Delegate? = .none) throws
A convenience method for creating a workspace for the given root package path.
convenience init(fileSystem: any FileSystem, environment: Environment = .current, location: Location, authorizationProvider: (any AuthorizationProvider)? = .none, registryAuthorizationProvider: (any AuthorizationProvider)? = .none, configuration: WorkspaceConfiguration? = .none, cancellator: Cancellator? = .none, initializationWarningHandler: ((String) -> Void)? = .none, customHostToolchain: UserToolchain? = .none, customManifestLoader: (any ManifestLoaderProtocol)? = .none, customPackageContainerProvider: (any PackageContainerProvider)? = .none, customRepositoryProvider: (any RepositoryProvider)? = .none, delegate: Delegate? = .none) throws
Create a new package workspace.
convenience init(fileSystem: FileSystem? = .none, forRootPackage packagePath: AbsolutePath, authorizationProvider: AuthorizationProvider? = .none, registryAuthorizationProvider: AuthorizationProvider? = .none, configuration: WorkspaceConfiguration? = .none, cancellator: Cancellator? = .none, initializationWarningHandler: ((String) -> Void)? = .none, customHostToolchain: UserToolchain, customPackageContainerProvider: PackageContainerProvider? = .none, customRepositoryProvider: RepositoryProvider? = .none, delegate: Delegate? = .none) throws
A convenience method for creating a workspace for the given root package path.
static func _init(fileSystem: FileSystem, environment: Environment, location: Location, authorizationProvider: AuthorizationProvider? = .none, registryAuthorizationProvider: AuthorizationProvider? = .none, configuration: WorkspaceConfiguration? = .none, cancellator: Cancellator? = .none, initializationWarningHandler: ((String) -> Void)? = .none, customRegistriesConfiguration: RegistryConfiguration? = .none, customFingerprints: PackageFingerprintStorage? = .none, customSigningEntities: PackageSigningEntityStorage? = .none, skipSignatureValidation: Bool = false, customMirrors: DependencyMirrors? = .none, customToolsVersion: ToolsVersion? = .none, customHostToolchain: UserToolchain? = .none, customManifestLoader: ManifestLoaderProtocol? = .none, customPackageContainerProvider: PackageContainerProvider? = .none, customRepositoryManager: RepositoryManager? = .none, customRepositoryProvider: RepositoryProvider? = .none, customRegistryClient: RegistryClient? = .none, customBinaryArtifactsManager: CustomBinaryArtifactsManager? = .none, customIdentityResolver: IdentityResolver? = .none, customDependencyMapper: DependencyMapper? = .none, customChecksumAlgorithm: HashAlgorithm? = .none, delegate: Delegate? = .none) throws -> Workspace
Initializer for testing purposes only. Use non underscored initializers instead.
static func format(workspaceResolveReason reason: WorkspaceResolveReason) -> String
static func migrateMirrorsConfiguration(from legacyPath: AbsolutePath, to newPath: AbsolutePath, observabilityScope: ObservabilityScope) throws -> AbsolutePath
let fileSystem: any FileSystem
The file system on which the workspace will operate.
let location: Location
The workspace location.
let pinsStore: LoadableResult<PinsStore>
The Pins store. The pins file will be created when first pin is added to pins store.
let state: WorkspaceState
The current persisted state of the workspace.
func acceptIdentityChange(package: PackageIdentity, version: Version, signingEntity: SigningEntity, origin: SigningEntity.Origin, observabilityScope: ObservabilityScope, callbackQueue: DispatchQueue, completion: @escaping (Result<Void, Error>) -> Void)
func cancelActiveResolverOperation()
Cancel the active dependency resolution operation.
func clean(observabilityScope: ObservabilityScope)
Cleans the build artifacts from workspace data.
func edit(packageName: String, path: AbsolutePath? = nil, revision: Revision? = nil, checkoutBranch: String? = nil, observabilityScope: ObservabilityScope)
Puts a dependency in edit mode creating a checkout in editables directory.
func getContainer(for package: PackageReference, updateStrategy: ContainerUpdateStrategy, observabilityScope: ObservabilityScope, on queue: DispatchQueue, completion: @escaping (Result<any PackageContainer, any Swift.Error>) -> Void)
func interpreterFlags(for packagePath: AbsolutePath) -> [String]
Returns manifest interpreter flags for a package.
func loadDependencyManifests(root: PackageGraphRoot, automaticallyAddManagedDependencies: Bool = false, observabilityScope: ObservabilityScope) throws -> DependencyManifests
Load the manifests for the current dependency tree.
func loadPackage(with identity: PackageIdentity, packageGraph: ModulesGraph, observabilityScope: ObservabilityScope) async throws -> Package
func loadPackage(with identity: PackageIdentity, packageGraph: ModulesGraph, observabilityScope: ObservabilityScope, completion: @escaping (Result<Package, Error>) -> Void)
Loads a single package in the context of a previously loaded graph. This can be useful for incremental loading in a longer-lived program, like an IDE.
@discardableResult func loadPackageGraph(rootInput root: PackageGraphRootInput, explicitProduct: String? = nil, forceResolvedVersions: Bool = false, customXCTestMinimumDeploymentTargets: [PackageModel.Platform : PlatformVersion]? = .none, testEntryPointPath: AbsolutePath? = nil, expectedSigningEntities: [PackageIdentity : RegistryReleaseMetadata.SigningEntity] = [:], observabilityScope: ObservabilityScope) throws -> ModulesGraph
@discardableResult func loadPackageGraph(rootPath: AbsolutePath, explicitProduct: String? = nil, observabilityScope: ObservabilityScope) throws -> ModulesGraph
func loadPluginImports(packageGraph: ModulesGraph) async throws -> [PackageIdentity : [String : [String]]]
func loadRootManifest(at path: AbsolutePath, observabilityScope: ObservabilityScope) async throws -> Manifest
Loads and returns manifest at the given path.
func loadRootManifest(at path: AbsolutePath, observabilityScope: ObservabilityScope, completion: @escaping (Result<Manifest, Error>) -> Void)
Loads and returns manifest at the given path.
func loadRootManifests(packages: [AbsolutePath], observabilityScope: ObservabilityScope) async throws -> [AbsolutePath : Manifest]
Loads and returns manifests at the given paths.
func loadRootManifests(packages: [AbsolutePath], observabilityScope: ObservabilityScope, completion: @escaping (Result<[AbsolutePath : Manifest], Error>) -> Void)
Loads and returns manifests at the given paths.
func loadRootPackage(at path: AbsolutePath, observabilityScope: ObservabilityScope) async throws -> Package
Loads root package
func loadRootPackage(at path: AbsolutePath, observabilityScope: ObservabilityScope, completion: @escaping (Result<Package, Error>) -> Void)
Loads root package
func path(to dependency: Workspace.ManagedDependency) -> AbsolutePath
Returns the location of the dependency.
func precomputeResolution(root: PackageGraphRoot, dependencyManifests: DependencyManifests, pinsStore: PinsStore, constraints: [PackageContainerConstraint], observabilityScope: ObservabilityScope) throws -> ResolutionPrecomputationResult
Computes if dependency resolution is required based on input constraints and pins.
func purgeCache(observabilityScope: ObservabilityScope)
Cleans the build artifacts from workspace data.
func reset(observabilityScope: ObservabilityScope)
Resets the entire workspace by removing the data directory.
func resetState() throws
func resolve(packageName: String, root: PackageGraphRootInput, version: Version? = nil, branch: String? = nil, revision: String? = nil, observabilityScope: ObservabilityScope) throws
Resolve a package at the given state.
func resolve(root: PackageGraphRootInput, explicitProduct: String? = .none, forceResolution: Bool = false, forceResolvedVersions: Bool = false, observabilityScope: ObservabilityScope) throws
Perform dependency resolution if needed.
func resolveBasedOnResolvedVersionsFile(root: PackageGraphRootInput, observabilityScope: ObservabilityScope) throws
Resolves the dependencies according to the entries present in the Package.resolved file.
func unedit(packageName: String, forceRemove: Bool, root: PackageGraphRootInput, observabilityScope: ObservabilityScope) throws
Ends the edit mode of an edited dependency.
@discardableResult func updateDependencies(root: PackageGraphRootInput, packages: [String] = [], dryRun: Bool = false, observabilityScope: ObservabilityScope) throws -> [(PackageReference, Workspace.PackageStateChange)]?
Updates the current dependencies.
func watchResolvedFile() throws
Watch the Package.resolved for changes.
struct BinaryArtifactsManager
final class Configuration
Manages a package workspace’s configuration.
struct CustomBinaryArtifactsManager
struct DefaultLocations
Workspace default locations utilities
struct DependencyManifests
A struct representing all the current manifests (root + external) in a package graph.
struct Location
Workspace location configuration
struct ManagedArtifact
A downloaded artifact managed by the workspace.
final class ManagedArtifacts
A collection of managed artifacts which have been downloaded.
final class ManagedDependencies
A collection of managed dependencies.
enum PackageStateChange
This enum represents state of an external package.
enum ResolutionPrecomputationResult
enum SigningError
typealias Delegate = WorkspaceDelegate
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
static func edited(packageRef: PackageReference, subpath: RelativePath, basedOn: ManagedDependency?, unmanagedPath: AbsolutePath?) -> ManagedDependency
Create an edited dependency
static func fileSystem(packageRef: PackageReference) throws -> ManagedDependency
Create a dependency present locally on the filesystem.
static func registryDownload(packageRef: PackageReference, version: Version, subpath: RelativePath) throws -> ManagedDependency
Create a registry dependency downloaded
static func sourceControlCheckout(packageRef: PackageReference, state: CheckoutState, subpath: RelativePath) throws -> ManagedDependency
Create a source control dependency checked out
var description: String { get }
let packageRef: PackageReference
The package reference.
let state: State
The state of the managed dependency.
let subpath: RelativePath
The checked out path of the dependency on disk, relative to the workspace checkouts path.
func edited(subpath: RelativePath, unmanagedPath: AbsolutePath?) throws -> ManagedDependency
Create an editable managed dependency based on a dependency which was not in edit state.
indirect enum State
Represents the state of the managed dependency.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.