@@ -1552,22 +1552,25 @@ public final class MixedTargetBuildDescription {
1552
1552
self . moduleMap = customModuleMapPath
1553
1553
self . allProductHeadersOverlay = productDirectory. appending ( component: allProductHeadersFilename)
1554
1554
1555
- // TODO(ncooke3): Probably can remove the builder pattern now.
1556
- #if swift(>=5.4)
1557
1555
try VFSOverlay ( roots: [
1558
- VFSOverlay . Directory ( name: customModuleMapPath. parentDirectory. pathString) {
1559
- VFSOverlay . File (
1560
- name: moduleMapFilename,
1561
- externalContents: productModuleMapPath. pathString
1562
- )
1563
-
1564
- VFSOverlay . File (
1565
- name: interopHeaderPath. basename,
1566
- externalContents: interopHeaderPath. pathString
1567
- )
1568
- }
1556
+ VFSOverlay . Directory (
1557
+ name: customModuleMapPath. parentDirectory. pathString,
1558
+ contents: [
1559
+ // Redirect the custom `module.modulemap` to the
1560
+ // modified module map in the product directory.
1561
+ VFSOverlay . File (
1562
+ name: moduleMapFilename,
1563
+ externalContents: productModuleMapPath. pathString
1564
+ ) ,
1565
+ // Add a generated Swift header that redirects to the
1566
+ // generated header in the build directory's root.
1567
+ VFSOverlay . File (
1568
+ name: interopHeaderPath. basename,
1569
+ externalContents: interopHeaderPath. pathString
1570
+ )
1571
+ ]
1572
+ )
1569
1573
] ) . write ( to: self . allProductHeadersOverlay, fileSystem: fileSystem)
1570
- #endif
1571
1574
1572
1575
// When the mixed target does not have a custom module map, one will be
1573
1576
// generated as a product for use by clients.
@@ -1587,16 +1590,19 @@ public final class MixedTargetBuildDescription {
1587
1590
self . moduleMap = productModuleMapPath
1588
1591
self . allProductHeadersOverlay = productDirectory. appending ( component: allProductHeadersFilename)
1589
1592
1590
- #if swift(>=5.4)
1591
1593
try VFSOverlay ( roots: [
1592
- VFSOverlay . Directory ( name: mixedTarget. clangTarget. includeDir. pathString) {
1593
- VFSOverlay . File (
1594
- name: interopHeaderPath. basename,
1595
- externalContents: interopHeaderPath. pathString
1596
- )
1597
- }
1594
+ VFSOverlay . Directory (
1595
+ name: mixedTarget. clangTarget. includeDir. pathString,
1596
+ contents: [
1597
+ // Add a generated Swift header that redirects to the
1598
+ // generated header in the build directory's root.
1599
+ VFSOverlay . File (
1600
+ name: interopHeaderPath. basename,
1601
+ externalContents: interopHeaderPath. pathString
1602
+ )
1603
+ ]
1604
+ )
1598
1605
] ) . write ( to: self . allProductHeadersOverlay, fileSystem: fileSystem)
1599
- #endif
1600
1606
}
1601
1607
1602
1608
// MARK: Generate intermediate artifacts used to build the target.
@@ -1650,38 +1656,40 @@ public final class MixedTargetBuildDescription {
1650
1656
}
1651
1657
1652
1658
let allProductHeadersPath = intermediatesDirectory. appending ( component: allProductHeadersFilename)
1653
- #if swift(>=5.4)
1654
1659
try VFSOverlay ( roots: [
1655
- VFSOverlay . Directory ( name: rootOverlayResourceDirectory. pathString) {
1656
- // Redirect the `module.modulemap` to the modified
1657
- // module map in the intermediates directory.
1658
- VFSOverlay . File (
1659
- name: moduleMapFilename,
1660
- externalContents: intermediateModuleMapPath. pathString
1661
- )
1662
- // Add a generated Swift header that redirects to the
1663
- // generated header in the build directory's root.
1664
- VFSOverlay . File (
1665
- name: interopHeaderPath. basename,
1666
- externalContents: interopHeaderPath. pathString
1667
- )
1668
- }
1660
+ VFSOverlay . Directory (
1661
+ name: rootOverlayResourceDirectory. pathString,
1662
+ contents: [
1663
+ // Redirect the `module.modulemap` to the modified
1664
+ // module map in the intermediates directory.
1665
+ VFSOverlay . File (
1666
+ name: moduleMapFilename,
1667
+ externalContents: intermediateModuleMapPath. pathString
1668
+ ) ,
1669
+ // Add a generated Swift header that redirects to the
1670
+ // generated header in the build directory's root.
1671
+ VFSOverlay . File (
1672
+ name: interopHeaderPath. basename,
1673
+ externalContents: interopHeaderPath. pathString
1674
+ )
1675
+ ]
1676
+ )
1669
1677
] ) . write ( to: allProductHeadersPath, fileSystem: fileSystem)
1670
- #endif
1671
1678
1672
1679
let unextendedModuleMapOverlayPath = intermediatesDirectory. appending ( component: unextendedModuleOverlayFilename)
1673
- #if swift(>=5.4)
1674
1680
try VFSOverlay ( roots: [
1675
- VFSOverlay . Directory ( name: rootOverlayResourceDirectory. pathString) {
1676
- // Redirect the `module.modulemap` to the *unextended*
1677
- // module map in the intermediates directory.
1678
- VFSOverlay . File (
1679
- name: moduleMapFilename,
1680
- externalContents: unextendedModuleMapPath. pathString
1681
- )
1682
- }
1681
+ VFSOverlay . Directory (
1682
+ name: rootOverlayResourceDirectory. pathString,
1683
+ contents: [
1684
+ // Redirect the `module.modulemap` to the *unextended*
1685
+ // module map in the intermediates directory.
1686
+ VFSOverlay . File (
1687
+ name: moduleMapFilename,
1688
+ externalContents: unextendedModuleMapPath. pathString
1689
+ )
1690
+ ]
1691
+ )
1683
1692
] ) . write ( to: unextendedModuleMapOverlayPath, fileSystem: fileSystem)
1684
- #endif
1685
1693
1686
1694
// 4. Tie everything together by passing build flags.
1687
1695
@@ -1717,7 +1725,7 @@ public final class MixedTargetBuildDescription {
1717
1725
" -I " , intermediatesDirectory. pathString
1718
1726
]
1719
1727
1720
- // If a generated umbrella header was created, add it's root directory
1728
+ // If a generated umbrella header was created, add its root directory
1721
1729
// as a header search path. This will resolve its import within the
1722
1730
// generated interop header.
1723
1731
if let interopSupportDirectory = interopSupportDirectory {
0 commit comments