Skip to content

Commit

Permalink
Update master to build with Xcode 10 beta 1, OS X 10.14, iOS 12, tvOS…
Browse files Browse the repository at this point in the history
… 12, and watchOS 5 SDKs.
  • Loading branch information
shahmishal committed Jun 5, 2018
1 parent ec1ed4c commit 3f8ce7d
Show file tree
Hide file tree
Showing 60 changed files with 6,404 additions and 156 deletions.
25 changes: 25 additions & 0 deletions apinotes/os.apinotes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Typedefs:
Availability: nonswift
- Name: os_log_t
Availability: nonswift
- Name: os_signpost_type_t
SwiftName: OSSignpostType
Classes:
- Name: OS_os_log
SwiftName: OSLog
Expand All @@ -20,10 +22,22 @@ Enumerators:
SwiftPrivate: true
- Name: OS_LOG_TYPE_FAULT
SwiftPrivate: true
- Name: OS_SIGNPOST_INTERVAL_BEGIN
SwiftPrivate: true
- Name: OS_SIGNPOST_INTERVAL_END
SwiftPrivate: true
- Name: OS_SIGNPOST_EVENT
SwiftPrivate: true
Functions:
- Name: _os_log_impl
Availability: nonswift
AvailabilityMsg: 'Use os_log'
- Name: _os_log_error_impl
Availability: nonswift
AvailabilityMsg: 'Use os_log'
- Name: _os_log_fault_impl
Availability: nonswift
AvailabilityMsg: 'Use os_log'
- Name: _os_log_sensitive_deprecated
Availability: nonswift
- Name: _os_trace_with_buffer
Expand All @@ -40,3 +54,14 @@ Functions:
NullabilityOfRet: N
- Name: os_log_is_debug_enabled
Availability: nonswift
- Name: os_signpost_enabled
SwiftPrivate: true
- Name: os_signpost_id_generate
SwiftPrivate: true
NullabilityOfRet: O
- Name: os_signpost_id_make_with_pointer
SwiftPrivate: true
NullabilityOfRet: O
- Name: _os_signpost_emit_with_name_impl
Availability: nonswift
AvailabilityMsg: 'Use os_signpost'
6 changes: 3 additions & 3 deletions lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,14 +1203,14 @@ static bool isSDKTooOld(StringRef sdkPath, clang::VersionTuple minVersion,
/// the given target.
static bool isSDKTooOld(StringRef sdkPath, const llvm::Triple &target) {
if (target.isMacOSX()) {
return isSDKTooOld(sdkPath, clang::VersionTuple(10, 13), "OSX");
return isSDKTooOld(sdkPath, clang::VersionTuple(10, 14), "OSX");

} else if (target.isiOS()) {
// Includes both iOS and TVOS.
return isSDKTooOld(sdkPath, clang::VersionTuple(11, 0), "Simulator", "OS");
return isSDKTooOld(sdkPath, clang::VersionTuple(12, 0), "Simulator", "OS");

} else if (target.isWatchOS()) {
return isSDKTooOld(sdkPath, clang::VersionTuple(4, 0), "Simulator", "OS");
return isSDKTooOld(sdkPath, clang::VersionTuple(5, 0), "Simulator", "OS");

} else {
return false;
Expand Down
35 changes: 35 additions & 0 deletions stdlib/public/SDK/ARKit/ARKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,41 @@ extension ARCamera {
return .limited(reason)
}
}

@available(iOS, introduced: 12.0)
@nonobjc
public func unprojectPoint(
_ point: CGPoint,
ontoPlane planeTransform: simd_float4x4,
orientation: UIInterfaceOrientation,
viewportSize: CGSize
) -> simd_float3? {
let result = __unprojectPoint(
point,
ontoPlaneWithTransform: planeTransform,
orientation: orientation,
viewportSize: viewportSize)
if result.x.isNaN || result.y.isNaN || result.z.isNaN {
return nil
}

return result
}
}

@available(iOS, introduced: 12.0)
extension ARSCNView {
@nonobjc public func unprojectPoint(
_ point: CGPoint, ontoPlane planeTransform: simd_float4x4
) -> simd_float3? {
let result = __unprojectPoint(
point, ontoPlaneWithTransform: planeTransform)
if result.x.isNaN || result.y.isNaN || result.z.isNaN {
return nil
}

return result
}
}

@available(iOS, introduced: 11.0)
Expand Down
57 changes: 50 additions & 7 deletions stdlib/public/SDK/AVFoundation/AVError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,35 @@ import Foundation

extension AVError {
/// The device name.
public var device: String? {
return userInfo[AVErrorDeviceKey] as? String
#if os(tvOS)
@available(*, unavailable)
public var device: String? { return nil }
#else
@available(swift, obsoleted: 4.2, message: "Use `device: AVCaptureDevice?` instead")
public var device: String? { return nil }

@available(swift, introduced: 4.2)
public var device: AVCaptureDevice? {
return userInfo[AVErrorDeviceKey] as? AVCaptureDevice
}
#endif

/// The time.
public var time: CMTime? {
return userInfo[AVErrorTimeKey] as? CMTime
if let time = userInfo[AVErrorTimeKey] as? CMTime {
return time
}
else if let timeDictionary = userInfo[AVErrorTimeKey] {
return CMTimeMakeFromDictionary((timeDictionary as! CFDictionary))
}
else {
return nil
}
}

/// The file size.
public var fileSize: Int64? {
return (userInfo[AVErrorFileSizeKey] as? NSNumber)?.int64Value
return userInfo[AVErrorFileSizeKey] as? Int64
}

/// The process ID number.
Expand All @@ -41,13 +58,39 @@ extension AVError {
}

/// The media type.
public var mediaType: String? {
return userInfo[AVErrorMediaTypeKey] as? String
public var mediaType: AVMediaType? {
return userInfo[AVErrorMediaTypeKey] as? AVMediaType
}

/// The media subtypes.
public var mediaSubtypes: [Int]? {
return userInfo[AVErrorMediaSubTypeKey] as? [Int]
}
}

/// The presentation time stamp.
@available(swift, introduced: 4.2)
@available(macOS, introduced: 10.10)
@available(iOS, introduced: 8.0)
@available(tvOS, introduced: 9.0)
public var presentationTimeStamp: CMTime? {
return userInfo[AVErrorPresentationTimeStampKey] as? CMTime
}

/// The persistent track ID.
@available(swift, introduced: 4.2)
@available(macOS, introduced: 10.10)
@available(iOS, introduced: 8.0)
@available(tvOS, introduced: 9.0)
public var persistentTrackID: CMPersistentTrackID? {
return userInfo[AVErrorPersistentTrackIDKey] as? CMPersistentTrackID
}

/// The file type.
@available(swift, introduced: 4.2)
@available(macOS, introduced: 10.10)
@available(iOS, introduced: 8.0)
@available(tvOS, introduced: 9.0)
public var fileType: AVFileType? {
return userInfo[AVErrorFileTypeKey] as? AVFileType
}
}
2 changes: 1 addition & 1 deletion stdlib/public/SDK/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(SWIFT_BUILD_STATIC_SDK_OVERLAY)
list(APPEND SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES STATIC)
endif()

set(all_overlays "Accelerate;AppKit;ARKit;AssetsLibrary;AVFoundation;CallKit;CloudKit;Contacts;CoreAudio;CoreData;CoreFoundation;CoreGraphics;CoreImage;CoreLocation;CoreMedia;CryptoTokenKit;Dispatch;Foundation;GameplayKit;GLKit;HomeKit;IOKit;Intents;MapKit;MediaPlayer;Metal;MetalKit;ModelIO;ObjectiveC;OpenCL;os;Photos;QuartzCore;SafariServices;SceneKit;simd;SpriteKit;UIKit;Vision;WatchKit;XCTest;XPC")
set(all_overlays "Accelerate;AppKit;ARKit;AssetsLibrary;AVFoundation;CallKit;CloudKit;Contacts;CoreAudio;CoreData;CoreFoundation;CoreGraphics;CoreImage;CoreLocation;CoreMedia;CryptoTokenKit;Dispatch;Foundation;GameplayKit;GLKit;HomeKit;IOKit;Intents;MapKit;MediaPlayer;Metal;MetalKit;ModelIO;NaturalLanguage;Network;ObjectiveC;OpenCL;os;Photos;QuartzCore;SafariServices;SceneKit;simd;SpriteKit;UIKit;Vision;WatchKit;XCTest;XPC")

if(DEFINED SWIFT_OVERLAY_TARGETS)
set(overlays_to_build ${SWIFT_OVERLAY_TARGETS})
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/SDK/CloudKit/CKError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2018 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
Expand Down
43 changes: 43 additions & 0 deletions stdlib/public/SDK/CloudKit/CKFetchRecordZoneChangesOperation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 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
//
//===----------------------------------------------------------------------===//

@_exported import CloudKit // Clang module

@nonobjc
@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)
extension CKFetchRecordZoneChangesOperation.ZoneConfiguration {
/**
Declares which user-defined keys should be fetched and added to the resulting CKRecords.
If nil, declares the entire record should be downloaded. If set to an empty array, declares that no user fields should be downloaded.
Defaults to nil.
*/
@available(swift 4.2)
public var desiredKeys: [CKRecord.FieldKey]? {
get { return self.__desiredKeys }
set { self.__desiredKeys = newValue }
}

@available(swift 4.2)
public convenience init(previousServerChangeToken: CKServerChangeToken? = nil, resultsLimit: Int? = nil, desiredKeys: [CKRecord.FieldKey]? = nil) {
self.init()
if let previousServerChangeToken = previousServerChangeToken {
self.previousServerChangeToken = previousServerChangeToken
}
if let resultsLimit = resultsLimit {
self.resultsLimit = resultsLimit
}
if let desiredKeys = desiredKeys {
self.desiredKeys = desiredKeys
}
}
}
74 changes: 74 additions & 0 deletions stdlib/public/SDK/CloudKit/CKRecord.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 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
//
//===----------------------------------------------------------------------===//

@_exported import CloudKit

// MARK: - Iterate over records

@available(macOS 10.10, iOS 8.0, watchOS 3.0, *)
public struct CKRecordKeyValueIterator : IteratorProtocol {
private var keyArray: [CKRecord.FieldKey]
private var record: CKRecord
private var index: Array<CKRecord.FieldKey>.Index

fileprivate init(_ record: CKRecord) {
self.record = record
keyArray = record.allKeys()
index = keyArray.startIndex
}

public mutating func next() -> (CKRecord.FieldKey, CKRecordValueProtocol)? {
var key: CKRecord.FieldKey? = nil
var objcValue: __CKRecordObjCValue? = nil
while objcValue == nil {
guard index < keyArray.endIndex else { return nil }
key = keyArray[index]
objcValue = record[key!]
index = index.advanced(by: 1)
}

let swiftValue = objcValue!.asSwiftNativeValue()

return (key!, swiftValue)
}
}

@nonobjc
@available(macOS 10.10, iOS 8.0, watchOS 3.0, *)
extension CKRecord : Sequence {
public func makeIterator() -> CKRecordKeyValueIterator {
return CKRecordKeyValueIterator(self)
}
}

@nonobjc
@available(macOS 10.10, iOS 8.0, watchOS 3.0, *)
extension CKRecord {
public typealias RecordType = String
public typealias FieldKey = String

@available(swift 4.2)
public enum SystemType {
public static let userRecord: CKRecord.RecordType = __CKRecordTypeUserRecord as CKRecord.RecordType
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
public static let share: CKRecord.RecordType = __CKRecordTypeShare as CKRecord.RecordType
}

@available(swift 4.2)
public enum SystemFieldKey {
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
public static let parent: CKRecord.FieldKey = __CKRecordParentKey as CKRecord.RecordType
@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)
public static let share: CKRecord.FieldKey = __CKRecordShareKey as CKRecord.RecordType
}
}

Loading

0 comments on commit 3f8ce7d

Please sign in to comment.