1010//
1111//===----------------------------------------------------------------------===//
1212
13- public import SWBUtil
13+
1414public import SWBCore
1515
16+ import SWBUtil
1617import Foundation
1718
1819// A harness for use in a task action implementation to perform trace-file-based dependency verification
@@ -153,7 +154,7 @@ extension TaskDependencyVerification.Adapter {
153154 // Group used files by inferred logical dependency name
154155 var used = Dictionary (
155156 grouping: files,
156- by: { $0 . inferDependencyName ( ) ?? " " }
157+ by: { inferDependencyName ( $0 ) ?? " " }
157158 )
158159 . mapValues { OrderedSet ( $0) }
159160
@@ -179,23 +180,24 @@ extension TaskDependencyVerification.Adapter {
179180
180181 return true
181182 }
182- }
183183
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)
187189 }
188190
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
192194 }
193- return dirname. isEmpty || dirname. isRoot ? nil : dirname . findFrameworkName ( )
195+ return file . dirname. isEmpty || file . dirname. isRoot ? nil : findFrameworkName ( file . dirname )
194196 }
195197
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 ) ) )
199201 }
200202 return nil
201203 }
0 commit comments