10
10
//
11
11
//===----------------------------------------------------------------------===//
12
12
13
- public import SWBUtil
13
+
14
14
public import SWBCore
15
15
16
+ import SWBUtil
16
17
import Foundation
17
18
18
19
// A harness for use in a task action implementation to perform trace-file-based dependency verification
@@ -153,7 +154,7 @@ extension TaskDependencyVerification.Adapter {
153
154
// Group used files by inferred logical dependency name
154
155
var used = Dictionary (
155
156
grouping: files,
156
- by: { $0 . inferDependencyName ( ) ?? " " }
157
+ by: { inferDependencyName ( $0 ) ?? " " }
157
158
)
158
159
. mapValues { OrderedSet ( $0) }
159
160
@@ -179,23 +180,24 @@ extension TaskDependencyVerification.Adapter {
179
180
180
181
return true
181
182
}
182
- }
183
183
184
- public extension Path {
185
- func inferDependencyName( ) -> String ? {
186
- findFrameworkName ( ) ?? findLibraryName ( )
184
+ // The following is a provisional/incomplete mechanism for resolving a logical dependency from a file path.
185
+ // Ultimately, a discrete subsystem will be required that is more sophisticated than just interrogating components of the path.
186
+ // This is currently the minimal viable implementation to satisfy a functional milestone and is not intended for general use.
187
+ private func inferDependencyName( _ file: Path ) -> String ? {
188
+ findFrameworkName ( file) ?? findLibraryName ( file)
187
189
}
188
190
189
- func findFrameworkName( ) -> String ? {
190
- if fileExtension == " framework " {
191
- return basenameWithoutSuffix
191
+ private func findFrameworkName( _ file : Path ) -> String ? {
192
+ if file . fileExtension == " framework " {
193
+ return file . basenameWithoutSuffix
192
194
}
193
- return dirname. isEmpty || dirname. isRoot ? nil : dirname . findFrameworkName ( )
195
+ return file . dirname. isEmpty || file . dirname. isRoot ? nil : findFrameworkName ( file . dirname )
194
196
}
195
197
196
- func findLibraryName( ) -> String ? {
197
- if fileExtension == " a " && basename. starts ( with: " lib " ) {
198
- return String ( basenameWithoutSuffix. suffix ( from: str. index ( str. startIndex, offsetBy: 3 ) ) )
198
+ private func findLibraryName( _ file : Path ) -> String ? {
199
+ if file . fileExtension == " a " && file . basename. starts ( with: " lib " ) {
200
+ return String ( file . basenameWithoutSuffix. suffix ( from: file . str. index ( file . str. startIndex, offsetBy: 3 ) ) )
199
201
}
200
202
return nil
201
203
}
0 commit comments