@@ -24,7 +24,7 @@ import Workspace
24
24
import protocol TSCBasic. OutputByteStream
25
25
import struct TSCUtility. Version
26
26
27
- final class CommandWorkspaceDelegate : WorkspaceDelegate {
27
+ package final class CommandWorkspaceDelegate : WorkspaceDelegate {
28
28
private struct DownloadProgress {
29
29
let bytesDownloaded : Int64
30
30
let totalBytesToDownload : Int64
@@ -49,7 +49,7 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
49
49
private let progressHandler : ( Int64 , Int64 , String ? ) -> Void
50
50
private let inputHandler : ( String , ( String ? ) -> Void ) -> Void
51
51
52
- init (
52
+ package init (
53
53
observabilityScope: ObservabilityScope ,
54
54
outputHandler: @escaping ( String , Bool ) -> Void ,
55
55
progressHandler: @escaping ( Int64 , Int64 , String ? ) -> Void ,
@@ -61,11 +61,11 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
61
61
self . inputHandler = inputHandler
62
62
}
63
63
64
- func willFetchPackage( package : PackageIdentity , packageLocation: String ? , fetchDetails: PackageFetchDetails ) {
64
+ package func willFetchPackage( package : PackageIdentity , packageLocation: String ? , fetchDetails: PackageFetchDetails ) {
65
65
self . outputHandler ( " Fetching \( packageLocation ?? package . description) \( fetchDetails. fromCache ? " from cache " : " " ) " , false )
66
66
}
67
67
68
- func didFetchPackage( package : PackageIdentity , packageLocation: String ? , result: Result < PackageFetchDetails , Error > , duration: DispatchTimeInterval ) {
68
+ package func didFetchPackage( package : PackageIdentity , packageLocation: String ? , result: Result < PackageFetchDetails , Error > , duration: DispatchTimeInterval ) {
69
69
guard case . success = result, !self . observabilityScope. errorsReported else {
70
70
return
71
71
}
@@ -84,7 +84,7 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
84
84
self . outputHandler ( " Fetched \( packageLocation ?? package . description) from cache ( \( duration. descriptionInSeconds) ) " , false )
85
85
}
86
86
87
- func fetchingPackage( package : PackageIdentity , packageLocation: String ? , progress: Int64 , total: Int64 ? ) {
87
+ package func fetchingPackage( package : PackageIdentity , packageLocation: String ? , progress: Int64 , total: Int64 ? ) {
88
88
let ( step, total, packages) = self . fetchProgressLock. withLock { ( ) -> ( Int64 , Int64 , String ) in
89
89
self . fetchProgress [ package ] = FetchProgress (
90
90
progress: progress,
@@ -99,51 +99,51 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
99
99
self . progressHandler ( step, total, " Fetching \( packages) " )
100
100
}
101
101
102
- func willUpdateRepository( package : PackageIdentity , repository url: String ) {
102
+ package func willUpdateRepository( package : PackageIdentity , repository url: String ) {
103
103
self . outputHandler ( " Updating \( url) " , false )
104
104
}
105
105
106
- func didUpdateRepository( package : PackageIdentity , repository url: String , duration: DispatchTimeInterval ) {
106
+ package func didUpdateRepository( package : PackageIdentity , repository url: String , duration: DispatchTimeInterval ) {
107
107
self . outputHandler ( " Updated \( url) ( \( duration. descriptionInSeconds) ) " , false )
108
108
}
109
109
110
- func dependenciesUpToDate( ) {
110
+ package func dependenciesUpToDate( ) {
111
111
self . outputHandler ( " Everything is already up-to-date " , false )
112
112
}
113
113
114
- func willCreateWorkingCopy( package : PackageIdentity , repository url: String , at path: AbsolutePath ) {
114
+ package func willCreateWorkingCopy( package : PackageIdentity , repository url: String , at path: AbsolutePath ) {
115
115
self . outputHandler ( " Creating working copy for \( url) " , false )
116
116
}
117
117
118
- func didCheckOut( package : PackageIdentity , repository url: String , revision: String , at path: AbsolutePath , duration: DispatchTimeInterval ) {
118
+ package func didCheckOut( package : PackageIdentity , repository url: String , revision: String , at path: AbsolutePath , duration: DispatchTimeInterval ) {
119
119
self . outputHandler ( " Working copy of \( url) resolved at \( revision) " , false )
120
120
}
121
121
122
- func removing( package : PackageIdentity , packageLocation: String ? ) {
122
+ package func removing( package : PackageIdentity , packageLocation: String ? ) {
123
123
self . outputHandler ( " Removing \( packageLocation ?? package . description) " , false )
124
124
}
125
125
126
- func willResolveDependencies( reason: WorkspaceResolveReason ) {
126
+ package func willResolveDependencies( reason: WorkspaceResolveReason ) {
127
127
self . outputHandler ( Workspace . format ( workspaceResolveReason: reason) , true )
128
128
}
129
129
130
- func willComputeVersion( package : PackageIdentity , location: String ) {
130
+ package func willComputeVersion( package : PackageIdentity , location: String ) {
131
131
self . outputHandler ( " Computing version for \( location) " , false )
132
132
}
133
133
134
- func didComputeVersion( package : PackageIdentity , location: String , version: String , duration: DispatchTimeInterval ) {
134
+ package func didComputeVersion( package : PackageIdentity , location: String , version: String , duration: DispatchTimeInterval ) {
135
135
self . outputHandler ( " Computed \( location) at \( version) ( \( duration. descriptionInSeconds) ) " , false )
136
136
}
137
137
138
- func willDownloadBinaryArtifact( from url: String , fromCache: Bool ) {
138
+ package func willDownloadBinaryArtifact( from url: String , fromCache: Bool ) {
139
139
if fromCache {
140
140
self . outputHandler ( " Fetching binary artifact \( url) from cache " , false )
141
141
} else {
142
142
self . outputHandler ( " Downloading binary artifact \( url) " , false )
143
143
}
144
144
}
145
145
146
- func didDownloadBinaryArtifact( from url: String , result: Result < ( path: AbsolutePath , fromCache: Bool ) , Error > , duration: DispatchTimeInterval ) {
146
+ package func didDownloadBinaryArtifact( from url: String , result: Result < ( path: AbsolutePath , fromCache: Bool ) , Error > , duration: DispatchTimeInterval ) {
147
147
guard case . success( let fetchDetails) = result, !self . observabilityScope. errorsReported else {
148
148
return
149
149
}
@@ -166,7 +166,7 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
166
166
}
167
167
}
168
168
169
- func downloadingBinaryArtifact( from url: String , bytesDownloaded: Int64 , totalBytesToDownload: Int64 ? ) {
169
+ package func downloadingBinaryArtifact( from url: String , bytesDownloaded: Int64 , totalBytesToDownload: Int64 ? ) {
170
170
let ( step, total, artifacts) = self . binaryDownloadProgressLock. withLock { ( ) -> ( Int64 , Int64 , String ) in
171
171
self . binaryDownloadProgress [ url] = DownloadProgress (
172
172
bytesDownloaded: bytesDownloaded,
@@ -183,7 +183,7 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
183
183
}
184
184
185
185
/// The workspace has started downloading a binary artifact.
186
- func willDownloadPrebuilt( package : PackageIdentity , from url: String , fromCache: Bool ) {
186
+ package func willDownloadPrebuilt( package : PackageIdentity , from url: String , fromCache: Bool ) {
187
187
if fromCache {
188
188
self . outputHandler ( " Fetching package prebuilt \( url) from cache " , false )
189
189
} else {
@@ -192,7 +192,7 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
192
192
}
193
193
194
194
/// The workspace has finished downloading a binary artifact.
195
- func didDownloadPrebuilt(
195
+ package func didDownloadPrebuilt(
196
196
package : PackageIdentity ,
197
197
from url: String ,
198
198
result: Result < ( path: AbsolutePath , fromCache: Bool ) , Error > ,
@@ -210,18 +210,18 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
210
210
}
211
211
212
212
/// The workspace is downloading a binary artifact.
213
- func downloadingPrebuilt( package : PackageIdentity , from url: String , bytesDownloaded: Int64 , totalBytesToDownload: Int64 ? ) {
213
+ package func downloadingPrebuilt( package : PackageIdentity , from url: String , bytesDownloaded: Int64 , totalBytesToDownload: Int64 ? ) {
214
214
215
215
}
216
216
217
217
/// The workspace finished downloading all binary artifacts.
218
- func didDownloadAllPrebuilts( ) {
218
+ package func didDownloadAllPrebuilts( ) {
219
219
220
220
}
221
221
222
222
// registry signature handlers
223
223
224
- func onUnsignedRegistryPackage( registryURL: URL , package : PackageModel . PackageIdentity , version: TSCUtility . Version , completion: ( Bool ) -> Void ) {
224
+ package func onUnsignedRegistryPackage( registryURL: URL , package : PackageModel . PackageIdentity , version: TSCUtility . Version , completion: ( Bool ) -> Void ) {
225
225
self . inputHandler ( " \( package ) \( version) from \( registryURL) is unsigned. okay to proceed? (yes/no) " ) { response in
226
226
switch response? . lowercased ( ) {
227
227
case " yes " :
@@ -235,7 +235,7 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
235
235
}
236
236
}
237
237
238
- func onUntrustedRegistryPackage( registryURL: URL , package : PackageModel . PackageIdentity , version: TSCUtility . Version , completion: ( Bool ) -> Void ) {
238
+ package func onUntrustedRegistryPackage( registryURL: URL , package : PackageModel . PackageIdentity , version: TSCUtility . Version , completion: ( Bool ) -> Void ) {
239
239
self . inputHandler ( " \( package ) \( version) from \( registryURL) is signed with an untrusted certificate. okay to proceed? (yes/no) " ) { response in
240
240
switch response? . lowercased ( ) {
241
241
case " yes " :
@@ -269,36 +269,36 @@ final class CommandWorkspaceDelegate: WorkspaceDelegate {
269
269
os_signpost ( . end, name: SignpostName . resolvingDependencies)
270
270
}
271
271
272
- func willLoadGraph( ) {
272
+ package func willLoadGraph( ) {
273
273
self . observabilityScope. emit ( debug: " Loading and validating graph " )
274
274
os_signpost ( . begin, name: SignpostName . loadingGraph)
275
275
}
276
276
277
- func didLoadGraph( duration: DispatchTimeInterval ) {
277
+ package func didLoadGraph( duration: DispatchTimeInterval ) {
278
278
self . observabilityScope. emit ( debug: " Graph loaded in ( \( duration. descriptionInSeconds) ) " )
279
279
os_signpost ( . end, name: SignpostName . loadingGraph)
280
280
}
281
281
282
- func didCompileManifest( packageIdentity: PackageIdentity , packageLocation: String , duration: DispatchTimeInterval ) {
282
+ package func didCompileManifest( packageIdentity: PackageIdentity , packageLocation: String , duration: DispatchTimeInterval ) {
283
283
self . observabilityScope. emit ( debug: " Compiled manifest for ' \( packageIdentity) ' (from ' \( packageLocation) ') in \( duration. descriptionInSeconds) " )
284
284
}
285
285
286
- func didEvaluateManifest( packageIdentity: PackageIdentity , packageLocation: String , duration: DispatchTimeInterval ) {
286
+ package func didEvaluateManifest( packageIdentity: PackageIdentity , packageLocation: String , duration: DispatchTimeInterval ) {
287
287
self . observabilityScope. emit ( debug: " Evaluated manifest for ' \( packageIdentity) ' (from ' \( packageLocation) ') in \( duration. descriptionInSeconds) " )
288
288
}
289
289
290
- func didLoadManifest( packageIdentity: PackageIdentity , packagePath: AbsolutePath , url: String , version: Version ? , packageKind: PackageReference . Kind , manifest: Manifest ? , diagnostics: [ Basics . Diagnostic ] , duration: DispatchTimeInterval ) {
290
+ package func didLoadManifest( packageIdentity: PackageIdentity , packagePath: AbsolutePath , url: String , version: Version ? , packageKind: PackageReference . Kind , manifest: Manifest ? , diagnostics: [ Basics . Diagnostic ] , duration: DispatchTimeInterval ) {
291
291
self . observabilityScope. emit ( debug: " Loaded manifest for ' \( packageIdentity) ' (from ' \( url) ') in \( duration. descriptionInSeconds) " )
292
292
}
293
293
294
294
// noop
295
- func willCheckOut( package : PackageIdentity , repository url: String , revision: String , at path: AbsolutePath ) { }
296
- func didCreateWorkingCopy( package : PackageIdentity , repository url: String , at path: AbsolutePath , duration: DispatchTimeInterval ) { }
297
- func resolvedFileChanged( ) { }
298
- func didDownloadAllBinaryArtifacts( ) { }
299
- func willCompileManifest( packageIdentity: PackageIdentity , packageLocation: String ) { }
300
- func willEvaluateManifest( packageIdentity: PackageIdentity , packageLocation: String ) { }
301
- func willLoadManifest( packageIdentity: PackageIdentity , packagePath: AbsolutePath , url: String , version: Version ? , packageKind: PackageReference . Kind ) { }
295
+ package func willCheckOut( package : PackageIdentity , repository url: String , revision: String , at path: AbsolutePath ) { }
296
+ package func didCreateWorkingCopy( package : PackageIdentity , repository url: String , at path: AbsolutePath , duration: DispatchTimeInterval ) { }
297
+ package func resolvedFileChanged( ) { }
298
+ package func didDownloadAllBinaryArtifacts( ) { }
299
+ package func willCompileManifest( packageIdentity: PackageIdentity , packageLocation: String ) { }
300
+ package func willEvaluateManifest( packageIdentity: PackageIdentity , packageLocation: String ) { }
301
+ package func willLoadManifest( packageIdentity: PackageIdentity , packagePath: AbsolutePath , url: String , version: Version ? , packageKind: PackageReference . Kind ) { }
302
302
}
303
303
304
304
public extension _SwiftCommand {
0 commit comments