Skip to content

Commit

Permalink
Make CoreFoundation a public module and install its headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jmschonfeld authored and iCharlesHu committed May 29, 2024
1 parent 5ee7cdc commit 00cdb9e
Show file tree
Hide file tree
Showing 97 changed files with 123 additions and 106 deletions.
33 changes: 25 additions & 8 deletions Sources/CoreFoundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
##===----------------------------------------------------------------------===##

file(GLOB_RECURSE _CoreFoundationSources "*.c")
add_library(_CoreFoundation STATIC ${_CoreFoundationSources})
add_library(CoreFoundation STATIC ${_CoreFoundationSources})

target_include_directories(_CoreFoundation
target_include_directories(CoreFoundation
PUBLIC
include
PRIVATE
Expand All @@ -28,13 +28,30 @@ list(APPEND _CoreFoundation_build_flags
"-DCF_CHARACTERSET_UNICHAR_DB=\"${CMAKE_SOURCE_DIR}/Sources/CoreFoundation/CFUniCharPropertyDatabase.data\""
"-DCF_CHARACTERSET_BITMAP=\"${CMAKE_SOURCE_DIR}/Sources/CoreFoundation/CFCharacterSetBitmaps.bitmap\"")

target_compile_options(_CoreFoundation PRIVATE
target_compile_options(CoreFoundation PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:C>:${_CoreFoundation_build_flags}>")

target_precompile_headers(_CoreFoundation PRIVATE internalInclude/CoreFoundation_Prefix.h)
target_precompile_headers(CoreFoundation PRIVATE internalInclude/CoreFoundation_Prefix.h)

target_link_libraries(_CoreFoundation PUBLIC
FoundationICU)

target_link_libraries(_CoreFoundation PRIVATE
target_link_libraries(CoreFoundation PRIVATE
FoundationICU
dispatch)

file(COPY
"include/module.map"
DESTINATION
${CMAKE_BINARY_DIR}/CoreFoundationHeaders
NO_SOURCE_PERMISSIONS)


file(GLOB_RECURSE _CoreFoundationPublicHeaders "include/*.h")
file(COPY
${_CoreFoundationPublicHeaders}
DESTINATION
${CMAKE_BINARY_DIR}/CoreFoundationHeaders
NO_SOURCE_PERMISSIONS)

install(DIRECTORY
${CMAKE_BINARY_DIR}/CoreFoundationHeaders/
DESTINATION
lib/swift/CoreFoundation)
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/include/module.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module _CoreFoundation [extern_c] [system] {
module CoreFoundation [extern_c] [system] {
umbrella header "CoreFoundation.h"
explicit module CFPlugInCOM { header "CFPlugInCOM.h" }
}
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/include/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module _CoreFoundation {
module CoreFoundation {
umbrella header "CoreFoundation.h"
explicit module CFPlugInCOM { header "CFPlugInCOM.h" }

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Bridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

#if canImport(ObjectiveC)
import ObjectiveC
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Bundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

@_silgen_name("swift_getTypeContextDescriptor")
private func _getTypeContextDescriptor(of cls: AnyClass) -> UnsafeRawPointer
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target_compile_options(Foundation PRIVATE
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:${_Foundation_swift_build_flags}>")

target_link_libraries(Foundation PRIVATE
_CoreFoundation
CoreFoundation
FoundationEssentials
FoundationInternationalization)

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/DateComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

extension DateComponents : ReferenceConvertible {
public typealias ReferenceType = NSDateComponents
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/DateFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation
@_spi(SwiftCorelibsFoundation) import FoundationEssentials

open class DateFormatter : Formatter {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/DateInterval.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

extension DateInterval : _ObjectiveCBridgeable {
public static func _isBridgedToObjectiveC() -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/DateIntervalFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

internal let kCFDateIntervalFormatterNoStyle = CFDateIntervalFormatterStyle.noStyle
internal let kCFDateIntervalFormatterShortStyle = CFDateIntervalFormatterStyle.shortStyle
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Dictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

extension Dictionary : _ObjectiveCBridgeable {

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/FileHandle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation
#if canImport(Dispatch)
import Dispatch
#endif
Expand Down
4 changes: 2 additions & 2 deletions Sources/Foundation/FileManager+POSIX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal func &(left: UInt32, right: mode_t) -> mode_t {
}
#endif

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

#if os(WASI)
import WASILibc
Expand All @@ -27,7 +27,7 @@ internal var O_TRUNC: Int32 { _getConst_O_TRUNC() }
internal var O_WRONLY: Int32 { _getConst_O_WRONLY() }
#endif

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

extension FileManager {
internal func _mountedVolumeURLs(includingResourceValuesForKeys propertyKeys: [URLResourceKey]?, options: VolumeEnumerationOptions = []) -> [URL]? {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/FileManager+Win32.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

#if os(Windows)
import let WinSDK.INVALID_FILE_ATTRIBUTES
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/FileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fileprivate let UF_APPEND: Int32 = 1
fileprivate let UF_HIDDEN: Int32 = 1
#endif

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation
#if os(Windows)
import CRT
import WinSDK
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Host.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation
#if os(Windows)
import WinSDK
#endif
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/ISO8601DateFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

extension ISO8601DateFormatter {

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/JSONDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

/// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary`
/// containing `Decodable` values (in which case it should be exempt from key conversion strategies).
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/JSONEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

/// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary`
/// containing `Encodable` values (in which case it should be exempt from key conversion strategies).
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/JSONSerialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

extension JSONSerialization {
public struct ReadingOptions : OptionSet {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/Measurement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

#if DEPLOYMENT_RUNTIME_SWIFT
@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation
#else
@_exported import Foundation // Clang module
import _SwiftCoreFoundationOverlayShims
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCoding, ExpressibleByArrayLiteral {
private let _cfinfo = _CFInfo(typeID: CFArrayGetTypeID())
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSAttributedString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

extension NSAttributedString {
public struct Key: RawRepresentable, Equatable, Hashable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//


@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

internal final class _NSCFArray : NSMutableArray {
deinit {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFBoolean.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//


@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

internal class __NSCFBoolean : NSNumber {
override var hash: Int {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFCharacterSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Apple. All rights reserved.
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

internal class _NSCFCharacterSet : NSMutableCharacterSet {

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//


@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

internal final class _NSCFDictionary : NSMutableDictionary {
deinit {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//


@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

internal final class _NSCFSet : NSMutableSet {
deinit {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//


@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

@usableFromInline
internal class _NSCFString : NSMutableString {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Foundation/NSCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation
@_spi(SwiftCorelibsFoundation) @_exported import FoundationEssentials

internal let kCFCalendarUnitEra = CFCalendarUnit.era
Expand All @@ -23,7 +23,7 @@ internal let kCFCalendarUnitQuarter = CFCalendarUnit.quarter
internal let kCFCalendarUnitWeekOfMonth = CFCalendarUnit.weekOfMonth
internal let kCFCalendarUnitWeekOfYear = CFCalendarUnit.weekOfYear
internal let kCFCalendarUnitYearForWeekOfYear = CFCalendarUnit.yearForWeekOfYear
internal let kCFCalendarUnitNanosecond = CFCalendarUnit(rawValue: CFOptionFlags(_CoreFoundation.kCFCalendarUnitNanosecond))
internal let kCFCalendarUnitNanosecond = CFCalendarUnit(rawValue: CFOptionFlags(CoreFoundation.kCFCalendarUnitNanosecond))

internal func _CFCalendarUnitRawValue(_ unit: CFCalendarUnit) -> CFOptionFlags {
return unit.rawValue
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCharacterSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//


@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

let kCFCharacterSetControl = CFCharacterSetPredefinedSet.control
let kCFCharacterSetWhitespace = CFCharacterSetPredefinedSet.whitespace
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSConcreteValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

internal class NSConcreteValue : NSValue {

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation
#if !os(WASI)
import Dispatch
#endif
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

public typealias TimeInterval = Double

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSDateComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//

@_exported import FoundationEssentials
@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation


// This is a just used as an extensible struct, basically;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//


@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

#if !os(WASI)
import Dispatch
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Glibc
import CRT
#endif

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

public typealias NSErrorDomain = NSString

Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSKeyedArchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

@_implementationOnly import _CoreFoundation
@_implementationOnly import CoreFoundation

/// Archives created using the class method `archivedData(withRootObject:)` use this key
/// for the root object in the hierarchy of encoded objects. The `NSKeyedUnarchiver` class method
Expand Down
Loading

0 comments on commit 00cdb9e

Please sign in to comment.