Skip to content

Commit da2f9ae

Browse files
committed
Port to Android
1 parent 890c23b commit da2f9ae

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ extension Driver {
535535
///
536536
/// - Parameter content: response file's content to be tokenized.
537537
private static func tokenizeResponseFile(_ content: String) -> [String] {
538-
#if !os(macOS) && !os(Linux)
538+
#if !os(macOS) && !os(Linux) && !os(Android)
539539
#warning("Response file tokenization unimplemented for platform; behavior may be incorrect")
540540
#endif
541541
return content.split { $0 == "\n" || $0 == "\r\n" }

Sources/SwiftDriver/Driver/OutputFileMap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public struct OutputFileMap: Equatable {
9393
) throws {
9494
let encoder = JSONEncoder()
9595

96-
#if os(Linux)
96+
#if os(Linux) || os(Android)
9797
encoder.outputFormatting = [.prettyPrinted]
9898
#else
9999
if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {

Sources/SwiftDriver/Utilities/System.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
#if os(macOS)
1414
import Darwin
15-
#elseif os(Linux)
15+
#elseif canImport(Glibc)
1616
import Glibc
1717
#endif
1818

19-
#if os(macOS) || os(Linux)
19+
#if os(macOS) || os(Linux) || os(Android)
2020
// Adapted from llvm::sys::commandLineFitsWithinSystemLimits.
2121
func commandLineFitsWithinSystemLimits(path: String, args: [String]) -> Bool {
2222
let upperBound = sysconf(Int32(_SC_ARG_MAX))
@@ -35,7 +35,7 @@ func commandLineFitsWithinSystemLimits(path: String, args: [String]) -> Bool {
3535

3636
var commandLineLength = path.utf8.count + 1
3737
for arg in args {
38-
#if os(Linux)
38+
#if os(Linux) || os(Android)
3939
// Linux limits the length of each individual argument to MAX_ARG_STRLEN.
4040
// There is no available constant, so it is hardcoded here.
4141
guard arg.utf8.count < 32 * 4096 else {

0 commit comments

Comments
 (0)