Skip to content

Port to Android #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Driver/Driver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ extension Driver {
///
/// - Parameter content: response file's content to be tokenized.
private static func tokenizeResponseFile(_ content: String) -> [String] {
#if !os(macOS) && !os(Linux)
#if !os(macOS) && !os(Linux) && !os(Android)
#warning("Response file tokenization unimplemented for platform; behavior may be incorrect")
#endif
return content.split { $0 == "\n" || $0 == "\r\n" }
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Driver/OutputFileMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public struct OutputFileMap: Equatable {
) throws {
let encoder = JSONEncoder()

#if os(Linux)
#if os(Linux) || os(Android)
encoder.outputFormatting = [.prettyPrinted]
#else
if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftDriver/Utilities/System.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

#if os(macOS)
import Darwin
#elseif os(Linux)
#elseif canImport(Glibc)
import Glibc
#endif

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

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