MCPcopy Create free account
hub / github.com/SolaWing/xcode-build-server / parse_swift_driver_module

Method parse_swift_driver_module

xclog_parser.py:140–185  ·  view source on GitHub ↗
(self, line: str)

Source from the content-addressed store, hash-verified

138 echo(line)
139
140 def parse_swift_driver_module(self, line: str):
141 # match cases 1:
142 # SwiftDriver XXXDevEEUnitTest normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'XXXDevEEUnitTest' from project 'XXXDev')
143 # cd ...
144 # builtin-SwiftDriver -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -module-name XXXDevEEUnitTest
145
146 # match cases 2:
147 # SwiftDriver\ Compilation XXX normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'XXX' from project 'XXX')
148 # cd ...
149 # builtin-Swift-Compilation -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -module-name XXX
150
151 # may appear both case, seems Compilation must show, driver may show..
152 if not line.startswith("SwiftDriver"):
153 return
154
155 li = read_until_empty_line(self._input)
156 if not li:
157 return
158
159 command = li[-1]
160 # 忽略builtin-Swift-Compilation-Requirements
161 if not (
162 command.startswith("builtin-Swift-Compilation -- ")
163 or command.startswith("builtin-SwiftDriver -- ")
164 ):
165 return
166
167 if not self.skip_validate_bin and self.swiftc_exec not in command:
168 echo(f"Error: ================= Can't found {self.swiftc_exec}\n" + command)
169 return
170
171 command = command[(command.index(" -- ") + len(" -- ")) :]
172
173 module = {}
174 directory = next((cmd_split(i)[1] for i in li if i.startswith("cd ")), None)
175 if directory:
176 module["directory"] = directory
177 module["command"] = command
178 files = extract_swift_files_from_swiftc(command)
179 module["module_name"] = files[2]
180 module["files"] = files[0]
181 module["fileLists"] = files[1]
182 if files[3]:
183 self.index_store_path.add(files[3])
184 echo(f"CompileSwiftModule {module['module_name']}")
185 return module
186
187 def parse_c(self, line):
188 if not line.startswith("CompileC "):

Callers

nothing calls this directly

Calls 4

read_until_empty_lineFunction · 0.85
echoFunction · 0.85
cmd_splitFunction · 0.70

Tested by

no test coverage detected