Skip to content
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

ArgumentParser use for iOS, tvOS, watchOS to help with UITesting #2384

Merged
merged 5 commits into from
Nov 19, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.build
DerivedData
/.previous-build
xcuserdata
.DS_Store
Expand Down
30 changes: 15 additions & 15 deletions Sources/TSCBasic/OSLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class OSLog {
/// Creates a custom log object.
public convenience init(subsystem: String, category: String) {
#if canImport(os)
if #available(macOS 10.12, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
self.init(os.OSLog(subsystem: subsystem, category: category))
} else {
self.init()
Expand All @@ -48,7 +48,7 @@ public final class OSLog {
/// The shared default log.
public static let disabled: OSLog = {
#if canImport(os)
if #available(macOS 10.12, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return OSLog(os.OSLog.disabled)
} else {
return OSLog()
Expand All @@ -61,7 +61,7 @@ public final class OSLog {
/// The shared default log.
public static let `default`: OSLog = {
#if canImport(os)
if #available(macOS 10.12, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return OSLog(os.OSLog.default)
} else {
return OSLog()
Expand Down Expand Up @@ -91,7 +91,7 @@ public struct OSLogType {
/// The default log level.
public static var `default`: OSLogType {
#if canImport(os)
if #available(OSX 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return self.init(os.OSLogType.default)
} else {
return self.init()
Expand All @@ -104,7 +104,7 @@ public struct OSLogType {
/// The info log level.
public static var info: OSLogType {
#if canImport(os)
if #available(OSX 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return self.init(os.OSLogType.info)
} else {
return self.init()
Expand All @@ -117,7 +117,7 @@ public struct OSLogType {
/// The debug log level.
public static var debug: OSLogType {
#if canImport(os)
if #available(OSX 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return self.init(os.OSLogType.info)
} else {
return self.init()
Expand All @@ -139,7 +139,7 @@ public struct OSLogType {
_ args: CVarArg...
) {
#if canImport(os)
if #available(OSX 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
switch args.count {
case 0:
os.os_log(type.type, log: log.log, message)
Expand Down Expand Up @@ -181,7 +181,7 @@ public struct OSSignpostType {
/// Begins a signposted interval.
public static let begin: OSSignpostType = {
#if canImport(os)
if #available(macOS 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return OSSignpostType(.begin)
} else {
fatalError("unreachable")
Expand All @@ -194,7 +194,7 @@ public struct OSSignpostType {
/// Ends a signposted interval.
public static let end: OSSignpostType = {
#if canImport(os)
if #available(macOS 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return OSSignpostType(.end)
} else {
fatalError("unreachable")
Expand All @@ -207,7 +207,7 @@ public struct OSSignpostType {
/// Marks a point of interest in time with no duration.
public static let event: OSSignpostType = {
#if canImport(os)
if #available(macOS 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return OSSignpostType(.event)
} else {
fatalError("unreachable")
Expand All @@ -227,7 +227,7 @@ public struct OSSignpostID {
private let storage: Any?

#if canImport(os)
@available(macOS 10.14, *)
@available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *)
@usableFromInline var id: os.OSSignpostID {
return storage as! os.OSSignpostID
}
Expand All @@ -241,7 +241,7 @@ public struct OSSignpostID {
// provided log handle.
public init(log: OSLog) {
#if canImport(os)
if #available(macOS 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
self.init(os.OSSignpostID(log: log.log))
} else {
self.init(nil)
Expand All @@ -255,7 +255,7 @@ public struct OSSignpostID {
/// concurrently.
public static let exclusive: OSSignpostID = {
#if canImport(os)
if #available(macOS 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
return OSSignpostID(os.OSSignpostID.exclusive)
} else {
return OSSignpostID(nil)
Expand All @@ -274,7 +274,7 @@ public struct OSSignpostID {
signpostID: OSSignpostID = .exclusive
) {
#if canImport(os)
if #available(macOS 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
os.os_signpost(type.type, log: log.log, name: name, signpostID: signpostID.id)
}
#endif
Expand All @@ -290,7 +290,7 @@ public struct OSSignpostID {
_ args: CVarArg...
) {
#if canImport(os)
if #available(macOS 10.14, *) {
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
switch args.count {
case 0:
os.os_signpost(type.type, log: log.log, name: name, signpostID: signpostID.id, format)
Expand Down
2 changes: 1 addition & 1 deletion Sources/TSCUtility/dlopen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public struct DLOpenFlags: RawRepresentable, OptionSet {
public static let global: DLOpenFlags = DLOpenFlags(rawValue: RTLD_GLOBAL)

// Platform-specific flags.
#if os(macOS)
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
public static let first: DLOpenFlags = DLOpenFlags(rawValue: RTLD_FIRST)
public static let deepBind: DLOpenFlags = DLOpenFlags(rawValue: 0)
#else
Expand Down