1212
1313import Basics
1414import Foundation
15- import PackageLoading
1615
1716import class TSCBasic. Process
1817
@@ -24,7 +23,6 @@ public protocol AuxiliaryFileType {
2423
2524public enum WriteAuxiliary {
2625 public static let fileTypes : [ AuxiliaryFileType . Type ] = [
27- ClangModuleMap . self,
2826 EntitlementPlist . self,
2927 LinkFileList . self,
3028 SourcesFileList . self,
@@ -56,58 +54,6 @@ public enum WriteAuxiliary {
5654 }
5755 }
5856
59- public struct ClangModuleMap : AuxiliaryFileType {
60- public static let name = " modulemap "
61-
62- private enum GeneratedModuleMapType : String {
63- case umbrellaDirectory
64- case umbrellaHeader
65- }
66-
67- public static func computeInputs(
68- targetName: String ,
69- moduleName: String ,
70- publicHeadersDir: AbsolutePath ,
71- type: PackageLoading . GeneratedModuleMapType
72- ) -> [ Node ] {
73- let typeNodes : [ Node ]
74- switch type {
75- case . umbrellaDirectory( let path) :
76- typeNodes = [ . virtual( GeneratedModuleMapType . umbrellaDirectory. rawValue) , . directory( path) ]
77- case . umbrellaHeader( let path) :
78- typeNodes = [ . virtual( GeneratedModuleMapType . umbrellaHeader. rawValue) , . file( path) ]
79- }
80- return [ . virtual( Self . name) , . virtual( targetName) , . virtual( moduleName) , . directory( publicHeadersDir) ] + typeNodes
81- }
82-
83- public static func getFileContents( inputs: [ Node ] ) throws -> String {
84- guard inputs. count == 5 else {
85- throw StringError ( " invalid module map generation task, inputs: \( inputs) " )
86- }
87-
88- let generator = ModuleMapGenerator (
89- targetName: inputs [ 0 ] . extractedVirtualNodeName,
90- moduleName: inputs [ 1 ] . extractedVirtualNodeName,
91- publicHeadersDir: try AbsolutePath ( validating: inputs [ 2 ] . name) ,
92- fileSystem: localFileSystem
93- )
94-
95- let declaredType = inputs [ 3 ] . extractedVirtualNodeName
96- let path = try AbsolutePath ( validating: inputs [ 4 ] . name)
97- let type : PackageLoading . GeneratedModuleMapType
98- switch declaredType {
99- case GeneratedModuleMapType . umbrellaDirectory. rawValue:
100- type = . umbrellaDirectory( path)
101- case GeneratedModuleMapType . umbrellaHeader. rawValue:
102- type = . umbrellaHeader( path)
103- default :
104- throw StringError ( " invalid module map type in generation task: \( declaredType) " )
105- }
106-
107- return try generator. generateModuleMap ( type: type)
108- }
109- }
110-
11157 public struct LinkFileList : AuxiliaryFileType {
11258 public static let name = " link-file-list "
11359
@@ -334,24 +280,6 @@ public struct LLBuildManifest {
334280 commands [ name] = Command ( name: name, tool: tool)
335281 }
336282
337- public mutating func addWriteClangModuleMapCommand(
338- targetName: String ,
339- moduleName: String ,
340- publicHeadersDir: AbsolutePath ,
341- type: GeneratedModuleMapType ,
342- outputPath: AbsolutePath
343- ) {
344- let inputs = WriteAuxiliary . ClangModuleMap. computeInputs (
345- targetName: targetName,
346- moduleName: moduleName,
347- publicHeadersDir: publicHeadersDir,
348- type: type
349- )
350- let tool = WriteAuxiliaryFile ( inputs: inputs, outputFilePath: outputPath)
351- let name = outputPath. pathString
352- commands [ name] = Command ( name: name, tool: tool)
353- }
354-
355283 public mutating func addPkgStructureCmd(
356284 name: String ,
357285 inputs: [ Node ] ,
0 commit comments