Skip to content

Commit b6bebc0

Browse files
committed
Disable two code blocks to make the package compiler on iOS-like platforms
The targets that failed to build weren’t important for iOS but it’s good hygine to make the entire package compile on iOS-like platforms as well. rdar://103294088
1 parent 819a40d commit b6bebc0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Sources/swift-parser-cli/swift-parser-cli.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ class Reduce: ParsableCommand {
302302
/// Invoke `swift-parser-cli verify-round-trip` with the same arguments as this `reduce` subcommand.
303303
/// Returns the exit code of the invocation.
304304
private func runVerifyRoundTripInSeparateProcess(source: [UInt8]) throws -> ProcessExit {
305+
#if os(iOS) || os(tvOS) || os(watchOS)
306+
// We cannot launch a new process on iOS-like platforms.
307+
// Default to running verification in-process.
308+
// Honestly, this isn't very important because you can't launch swift-parser-cli
309+
// on iOS anyway but this fixes a compilation error of the pacakge on iOS.
310+
return try runVerifyRoundTripInCurrentProcess(source: source) ? ProcessExit.success : ProcessExit.potentialCrash
311+
#else
305312
return try withTemporaryFile(contents: source) { tempFileURL in
306313
let process = Process()
307314
process.executableURL = URL(fileURLWithPath: ProcessInfo.processInfo.arguments[0])
@@ -337,6 +344,7 @@ class Reduce: ParsableCommand {
337344
return .potentialCrash
338345
}
339346
}
347+
#endif
340348
}
341349

342350
/// Runs the `verify-round-trip` subcommand in process.

Tests/SwiftParserTest/LinkageTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if canImport(Darwin)
13+
#if canImport(Darwin) && !os(iOS) && !os(tvOS) && !os(watchOS)
1414
import Darwin
1515
import XCTest
1616

0 commit comments

Comments
 (0)