@@ -1659,6 +1659,54 @@ class PackageBuilderTests: XCTestCase {
1659
1659
}
1660
1660
}
1661
1661
1662
+ func testUnknownSourceFilesUnderDeclaredSourcesIgnoredInV5_2Manifest( ) throws {
1663
+ // Files with unknown suffixes under declared sources are not considered valid sources in 5.2 manifest.
1664
+ let fs = InMemoryFileSystem ( emptyFiles:
1665
+ " /Sources/lib/movie.mkv " ,
1666
+ " /Sources/lib/lib.c " ,
1667
+ " /Sources/lib/include/lib.h "
1668
+ )
1669
+
1670
+ let manifest = Manifest . createManifest (
1671
+ name: " pkg " ,
1672
+ v: . v5_2,
1673
+ targets: [
1674
+ TargetDescription ( name: " lib " , dependencies: [ ] , path: " ./Sources/lib " , sources: [ " . " ] ) ,
1675
+ ]
1676
+ )
1677
+
1678
+ PackageBuilderTester ( manifest, in: fs) { package , _ in
1679
+ package . checkModule ( " lib " ) { module in
1680
+ module. checkSources ( root: " /Sources/lib " , paths: " lib.c " )
1681
+ module. check ( includeDir: " /Sources/lib/include " )
1682
+ }
1683
+ }
1684
+ }
1685
+
1686
+ func testUnknownSourceFilesUnderDeclaredSourcesCompiledInV5_3Manifest( ) throws {
1687
+ // Files with unknown suffixes under declared sources are treated as compilable in 5.3 manifest.
1688
+ let fs = InMemoryFileSystem ( emptyFiles:
1689
+ " /Sources/lib/movie.mkv " ,
1690
+ " /Sources/lib/lib.c " ,
1691
+ " /Sources/lib/include/lib.h "
1692
+ )
1693
+
1694
+ let manifest = Manifest . createManifest (
1695
+ name: " pkg " ,
1696
+ v: . v5_3,
1697
+ targets: [
1698
+ TargetDescription ( name: " lib " , dependencies: [ ] , path: " ./Sources/lib " , sources: [ " . " ] ) ,
1699
+ ]
1700
+ )
1701
+
1702
+ PackageBuilderTester ( manifest, in: fs) { package , _ in
1703
+ package . checkModule ( " lib " ) { module in
1704
+ module. checkSources ( root: " /Sources/lib " , paths: " movie.mkv " , " lib.c " )
1705
+ module. check ( includeDir: " /Sources/lib/include " )
1706
+ }
1707
+ }
1708
+ }
1709
+
1662
1710
func testBuildSettings( ) {
1663
1711
let fs = InMemoryFileSystem ( emptyFiles:
1664
1712
" /Sources/exe/main.swift " ,
0 commit comments