Skip to content

Commit 1f56372

Browse files
Support TBDs in BuildDependencyInfo (rdar://142294767)
1 parent 41553c1 commit 1f56372

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Sources/SWBBuildService/BuildDependencyInfo.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,18 @@ extension BuildDependencyInfo {
403403

404404
let filename = resolvedBuildFile.absolutePath.basename
405405

406+
// TODO: all of the below are using linkType: .searchPath, we aren't reporting .absolutePath
407+
406408
if resolvedBuildFile.fileType.conformsTo(identifier: "wrapper.framework") {
409+
// TODO: static frameworks?
407410
await inputs.addInput(TargetDependencyInfo.Input(inputType: .framework, name: .name(filename), linkType: .searchPath, libraryType: .dynamic))
408411
}
409412
else if resolvedBuildFile.fileType.conformsTo(identifier: "compiled.mach-o.dylib") {
410413
await inputs.addInput(TargetDependencyInfo.Input(inputType: .library, name: .name(filename), linkType: .searchPath, libraryType: .dynamic))
411414
}
415+
else if resolvedBuildFile.fileType.conformsTo(identifier: "sourcecode.text-based-dylib-definition") {
416+
await inputs.addInput(TargetDependencyInfo.Input(inputType: .library, name: .name(filename), linkType: .searchPath, libraryType: .dynamic))
417+
}
412418
else if resolvedBuildFile.fileType.conformsTo(identifier: "archive.ar") {
413419
await inputs.addInput(TargetDependencyInfo.Input(inputType: .library, name: .name(filename), linkType: .searchPath, libraryType: .static))
414420
}

Sources/SWBTestSupport/TestWorkspaces.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ package final class TestFile: TestInternalStructureItem, CustomStringConvertible
273273
return "text.json.xcstrings"
274274
case ".swift":
275275
return "sourcecode.swift"
276+
case ".tbd":
277+
return "sourcecode.text-based-dylib-definition"
276278
case ".tif", ".tiff":
277279
return "image.tiff"
278280
case ".txt":

Tests/SWBBuildServiceTests/BuildDependencyInfoTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import Foundation
4141
TestFile("libFoo.dylib"),
4242
TestFile("libBar.a"),
4343
TestFile("libBaz.a"),
44+
TestFile("libQux.tbd"),
4445
]),
4546
buildConfigurations: [
4647
TestBuildConfiguration(
@@ -124,6 +125,7 @@ import Foundation
124125
TestFrameworksBuildPhase([
125126
"Foundation.framework",
126127
"libBar.a",
128+
"libQux.tbd",
127129
])
128130
]
129131
),
@@ -221,6 +223,10 @@ import Foundation
221223
#expect(input.inputType == .library)
222224
#expect(input.linkType == .searchPath)
223225
}
226+
results.checkTargetInputName(target, .name("libQux.tbd")) { input in
227+
#expect(input.inputType == .library)
228+
#expect(input.linkType == .searchPath)
229+
}
224230
results.checkNoMoreTargetInputs(target)
225231

226232
results.checkTargetOutputPath(target, "/usr/local/lib/libDylibTarget.dylib")
@@ -325,6 +331,8 @@ import Foundation
325331

326332
"-Xlinker -reexport-lXlinkerLib",
327333
"-Wl,-reexport-lQuoteLib",
334+
335+
// TODO: we should support positional arguments as well but that requires a complete understanding of all possible linker args, will come back to this
328336
].joined(separator: " ")
329337
]),
330338
],

0 commit comments

Comments
 (0)