Files
swift-mirror/utils/swift-dev-utils/Sources/CrashReduce/OutputDirs.swift
T
Hamish Knight 46728cef44 [crash-reduce] Allow reproducers to have extra args
And for now let's place C++ interop crashers in a separate directory.
2026-04-13 18:02:27 +01:00

44 lines
1.2 KiB
Swift

//===--- OutputDirs.swift -------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2026 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
public struct OutputDirs {
public var main: AbsolutePath
public var ideCrashers: AbsolutePath
public var cxxCrashers: AbsolutePath
public init(
main: AbsolutePath,
ideCrashers: AbsolutePath,
cxxCrashers: AbsolutePath,
) {
self.main = main
self.ideCrashers = ideCrashers
self.cxxCrashers = cxxCrashers
}
var allPaths: [AbsolutePath] {
Set([main, ideCrashers, cxxCrashers]).sorted(by: \.rawPath)
}
func outputDir(for reproducer: Reproducer) -> AbsolutePath {
if reproducer.kind == .complete {
return ideCrashers
}
if reproducer.options.extraArgs.contains(where: {
$0.value?.starts(with: "-cxx-interoperability-mode") ?? false
}) {
return cxxCrashers
}
return main
}
}