Skip to content

Commit 10ed6ab

Browse files
authored
Merge pull request #1028 from nkcsgexi/abi-dir
PrebuiltModuleGen: log ABI breakage logs to a sub directory
2 parents 34e90c8 + 4358262 commit 10ed6ab

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Sources/SwiftDriver/Jobs/PrebuiltModulesJob.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,23 @@ fileprivate func getLastInputPath(_ job: Job) -> AbsolutePath {
4646
}
4747

4848
fileprivate func logOutput(_ job: Job, _ result: ProcessResult, _ logPath: AbsolutePath?, _ stdout: Bool) throws {
49-
guard let logPath = logPath else {
49+
guard var logPath = logPath else {
5050
return
5151
}
5252
let content = stdout ? try result.utf8Output() : try result.utf8stderrOutput()
5353
guard !content.isEmpty else {
5454
return
5555
}
56+
57+
let interfaceBase = getLastInputPath(job).basename
58+
let errKind = getErrKind(content)
59+
if interfaceBase.contains(".abi.json") {
60+
logPath = logPath.appending(component: "abi").appending(component: errKind)
61+
}
5662
if !localFileSystem.exists(logPath) {
5763
try localFileSystem.createDirectory(logPath, recursive: true)
5864
}
59-
let interfaceBase = getLastInputPath(job).basename
60-
let fileName = "\(job.moduleName)-\(interfaceBase)-\(stdout ? "out" : getErrKind(content)).txt"
65+
let fileName = "\(job.moduleName)-\(interfaceBase)-\(stdout ? "out" : errKind).txt"
6166
try localFileSystem.writeFileContents(logPath.appending(component: fileName)) {
6267
$0 <<< content
6368
}

0 commit comments

Comments
 (0)