@@ -530,6 +530,41 @@ final class SwiftPMWorkspaceTests: XCTestCase {
530
530
check ( resolveSymlinks ( ah) . pathString, arguments: argsH ?? [ ] )
531
531
}
532
532
}
533
+
534
+ func testSwiftDerivedSources( ) throws {
535
+ // FIXME: should be possible to use InMemoryFileSystem.
536
+ let fs = localFileSystem
537
+ try ! withTemporaryDirectory ( removeTreeOnDeinit: true ) { tempDir in
538
+ try ! fs. createFiles ( root: tempDir, files: [
539
+ " pkg/Sources/lib/a.swift " : " " ,
540
+ " pkg/Sources/lib/a.txt " : " " ,
541
+ " pkg/Package.swift " : """
542
+ // swift-tools-version:5.3
543
+ import PackageDescription
544
+ let package = Package(name: " a " , products: [], dependencies: [],
545
+ targets: [
546
+ .target(
547
+ name: " lib " ,
548
+ dependencies: [],
549
+ resources: [.copy( " a.txt " )])])
550
+ """
551
+ ] )
552
+ let packageRoot = resolveSymlinks ( tempDir. appending ( component: " pkg " ) )
553
+ let tr = ToolchainRegistry . shared
554
+ let ws = try ! SwiftPMWorkspace (
555
+ workspacePath: packageRoot,
556
+ toolchainRegistry: tr,
557
+ fileSystem: fs,
558
+ buildSetup: TestSourceKitServer . serverOptions. buildSetup)
559
+
560
+ let aswift = packageRoot. appending ( components: " Sources " , " lib " , " a.swift " )
561
+ let arguments = ws. settings ( for: aswift. asURI, . swift) !. compilerArguments
562
+ check ( aswift. pathString, arguments: arguments)
563
+ XCTAssertNotNil ( arguments. firstIndex ( where: {
564
+ $0. hasSuffix ( " .swift " ) && $0. contains ( " DerivedSources " )
565
+ } ) , " missing resource_bundle_accessor.swift from \( arguments) " )
566
+ }
567
+ }
533
568
}
534
569
535
570
private func checkNot(
0 commit comments