@@ -5,6 +5,11 @@ import Foundation
5
5
enum PathKey : String {
6
6
case emitModulePath = " -emit-module-path "
7
7
case emitObjCHeaderPath = " -emit-objc-header-path "
8
+ case emitModuleSourceInfoPath = " -emit-module-source-info-path "
9
+ case serializeDiagnosticsPath = " -serialize-diagnostics-path "
10
+ case emitDependenciesPath = " -emit-dependencies-path "
11
+ case emitABIDescriptorPath = " -emit-abi-descriptor-path "
12
+ case emitModuleDocPath = " -emit-module-doc-path "
8
13
case outputFileMap = " -output-file-map "
9
14
case sdk = " -sdk "
10
15
}
@@ -75,17 +80,17 @@ extension URL {
75
80
}
76
81
}
77
82
78
- /// Touch the Xcode-required `.d` files
83
+ /// Touch the Xcode-required `.d` and `-master-emit-module.d` files
79
84
func touchDepsFiles( isWMO: Bool , paths: [ PathKey : URL ] ) throws {
80
85
guard let outputFileMapPath = paths [ PathKey . outputFileMap] else { return }
81
86
82
87
if isWMO {
83
- let dPath = String (
84
- outputFileMapPath . path . dropLast ( " -OutputFileMap.json " . count ) +
85
- " -master.d "
86
- )
87
- var url = URL ( fileURLWithPath: dPath )
88
- try url . touch ( )
88
+ let pathNoExtension = String ( outputFileMapPath . path . dropLast ( " -OutputFileMap.json " . count ) )
89
+ var masterDFilePath = URL ( fileURLWithPath : pathNoExtension + " -master.d " )
90
+ try masterDFilePath . touch ( )
91
+
92
+ var dFilePath = URL ( fileURLWithPath: pathNoExtension + " .d " )
93
+ try dFilePath . touch ( )
89
94
} else {
90
95
let data = try Data ( contentsOf: outputFileMapPath)
91
96
let outputFileMapRaw = try JSONSerialization . jsonObject (
@@ -98,23 +103,28 @@ func touchDepsFiles(isWMO: Bool, paths: [PathKey: URL]) throws {
98
103
}
99
104
100
105
for entry in outputFileMap. values {
101
- guard let dPath = entry [ " dependencies " ] as? String else {
102
- continue
106
+ if let dPath = entry [ " dependencies " ] as? String {
107
+ var url = URL ( fileURLWithPath: dPath)
108
+ try url. touch ( )
103
109
}
104
- var url = URL ( fileURLWithPath: dPath)
105
- try url. touch ( )
110
+ if let dPath = entry [ " emit-module-dependencies " ] as? String {
111
+ var url = URL ( fileURLWithPath: dPath)
112
+ try url. touch ( )
113
+ }
114
+ continue
106
115
}
107
116
}
108
117
}
109
118
110
- /// Touch the Xcode-required `.swift{module,doc,sourceinfo}` files
119
+ /// Touch the Xcode-required `-master-emit-module.d`, `.{d,abi.json}` and ` .swift{module,doc,sourceinfo}` files
111
120
func touchSwiftmoduleArtifacts( paths: [ PathKey : URL ] ) throws {
112
121
if var swiftmodulePath = paths [ PathKey . emitModulePath] {
113
- var swiftdocPath = swiftmodulePath. deletingPathExtension ( )
122
+ let pathNoExtension = swiftmodulePath. deletingPathExtension ( )
123
+ var swiftdocPath = pathNoExtension
114
124
. appendingPathExtension ( " swiftdoc " )
115
- var swiftsourceinfoPath = swiftmodulePath . deletingPathExtension ( )
125
+ var swiftsourceinfoPath = pathNoExtension
116
126
. appendingPathExtension ( " swiftsourceinfo " )
117
- var swiftinterfacePath = swiftmodulePath . deletingPathExtension ( )
127
+ var swiftinterfacePath = pathNoExtension
118
128
. appendingPathExtension ( " swiftinterface " )
119
129
120
130
try swiftmodulePath. touch ( )
@@ -126,6 +136,29 @@ func touchSwiftmoduleArtifacts(paths: [PathKey: URL]) throws {
126
136
if var generatedHeaderPath = paths [ PathKey . emitObjCHeaderPath] {
127
137
try generatedHeaderPath. touch ( )
128
138
}
139
+
140
+ if var path = paths [ PathKey . emitModuleSourceInfoPath] {
141
+ try path. touch ( )
142
+ }
143
+
144
+ if var path = paths [ PathKey . serializeDiagnosticsPath] {
145
+ try path. touch ( )
146
+ }
147
+
148
+ if var path = paths [ PathKey . emitDependenciesPath] {
149
+ try path. touch ( )
150
+ }
151
+
152
+ if var path = paths [ PathKey . emitABIDescriptorPath] {
153
+ try path. touch ( )
154
+ }
155
+
156
+ if var path = paths [ PathKey . emitModuleDocPath] {
157
+ var swiftModulePath = path. deletingPathExtension ( )
158
+ . appendingPathExtension ( " swiftmodule " )
159
+ try swiftModulePath. touch ( )
160
+ try path. touch ( )
161
+ }
129
162
}
130
163
131
164
func runSubProcess( executable: String , args: [ String ] ) throws -> Int32 {
0 commit comments