@@ -14,6 +14,7 @@ import Foundation
14
14
import TSCUtility
15
15
16
16
import struct Basics. AbsolutePath
17
+ import struct Basics. RelativePath
17
18
import class Basics. ObservabilitySystem
18
19
import func Basics. resolveSymlinks
19
20
import struct Basics. SourceControlURL
@@ -352,8 +353,8 @@ extension PackagePIFProjectBuilder {
352
353
353
354
// Generate a module map file, if needed.
354
355
var moduleMapFileContents = " "
355
- var moduleMapFile = " "
356
356
let generatedModuleMapDir = " $(GENERATED_MODULEMAP_DIR) "
357
+ let moduleMapFile = try RelativePath ( validating: " \( generatedModuleMapDir) / \( sourceModule. name) .modulemap " ) . pathString
357
358
358
359
if sourceModule. usesSwift && desiredModuleType != . macro {
359
360
// Generate ObjC compatibility header for Swift library targets.
@@ -366,8 +367,6 @@ extension PackagePIFProjectBuilder {
366
367
export *
367
368
}
368
369
"""
369
- moduleMapFile = " \( generatedModuleMapDir) / \( sourceModule. name) .modulemap "
370
-
371
370
// We only need to impart this to C clients.
372
371
impartedSettings [ . OTHER_CFLAGS] = [ " -fmodule-map-file= \( moduleMapFile) " , " $(inherited) " ]
373
372
} else if sourceModule. moduleMapFileRelativePath ( fileSystem: self . pifBuilder. fileSystem) == nil {
@@ -376,22 +375,21 @@ extension PackagePIFProjectBuilder {
376
375
log ( . debug, " \( package . name) . \( sourceModule. name) generated umbrella header " )
377
376
moduleMapFileContents = """
378
377
module \( sourceModule. c99name) {
379
- umbrella header " \( path) "
378
+ umbrella header " \( path. escapedPathString ) "
380
379
export *
381
380
}
382
381
"""
383
382
} else if case . umbrellaDirectory( let path) = sourceModule. moduleMapType {
384
383
log ( . debug, " \( package . name) . \( sourceModule. name) generated umbrella directory " )
385
384
moduleMapFileContents = """
386
385
module \( sourceModule. c99name) {
387
- umbrella " \( path) "
386
+ umbrella " \( path. escapedPathString ) "
388
387
export *
389
388
}
390
389
"""
391
390
}
392
391
if moduleMapFileContents. hasContent {
393
392
// Pass the path of the module map up to all direct and indirect clients.
394
- moduleMapFile = " \( generatedModuleMapDir) / \( sourceModule. name) .modulemap "
395
393
impartedSettings [ . OTHER_CFLAGS] = [ " -fmodule-map-file= \( moduleMapFile) " , " $(inherited) " ]
396
394
impartedSettings [ . OTHER_SWIFT_FLAGS] = [ " -Xcc " , " -fmodule-map-file= \( moduleMapFile) " , " $(inherited) " ]
397
395
}
0 commit comments