Skip to content

Commit f459df4

Browse files
authored
Rename _OpenGraph to OpenGraph_SPI (#86)
* Rename _OpenGraph to OpenGraph_SPI * Add InternalImportsByDefault support
1 parent 60d2376 commit f459df4

File tree

129 files changed

+37
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+37
-31
lines changed

Package.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ default:
5050
}
5151

5252
var sharedSwiftSettings: [SwiftSetting] = [
53+
.enableUpcomingFeature("InternalImportsByDefault"),
5354
.define("OPENGRAPH_RELEASE_\(releaseVersion)"),
5455
.swiftLanguageMode(.v5),
5556
]
@@ -103,14 +104,7 @@ let includePath = SDKPath.appending("/usr/lib/swift")
103104

104105
let package = Package(
105106
name: "OpenGraph",
106-
platforms: [
107-
.iOS(.v15),
108-
.macOS(.v12),
109-
.macCatalyst(.v15),
110-
.tvOS(.v15),
111-
.watchOS(.v8),
112-
.visionOS(.v1),
113-
],
107+
platforms: platforms,
114108
products: [
115109
.library(name: "OpenGraphShims", targets: ["OpenGraphShims"]),
116110
.library(name: "OpenGraph", targets: ["OpenGraph"]),
@@ -123,7 +117,7 @@ let package = Package(
123117
// OpenGraph is a C++ & Swift mix target.
124118
// The SwiftPM support for such usage is still in progress.
125119
.target(
126-
name: "_OpenGraph",
120+
name: "OpenGraph_SPI",
127121
cSettings: [
128122
.unsafeFlags(["-I", includePath], .when(platforms: .nonDarwinPlatforms)),
129123
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
@@ -135,7 +129,7 @@ let package = Package(
135129
),
136130
.target(
137131
name: "OpenGraph",
138-
dependencies: ["_OpenGraph"],
132+
dependencies: ["OpenGraph_SPI"],
139133
swiftSettings: sharedSwiftSettings
140134
),
141135
.plugin(

[email protected]

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,19 @@ func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool {
2020
let isXcodeEnv = Context.environment["__CFBundleIdentifier"] == "com.apple.dt.Xcode"
2121
let development = envEnable("OPENGRAPH_DEVELOPMENT", default: false)
2222

23-
var sharedSwiftSettings: [SwiftSetting] = []
23+
let releaseVersion = Context.environment["OPENGRAPH_TARGET_RELEASE"].flatMap { Int($0) } ?? 2021
24+
25+
var sharedSwiftSettings: [SwiftSetting] = [
26+
.enableExperimentalFeature("AccessLevelOnImport"),
27+
.enableUpcomingFeature("InternalImportsByDefault"),
28+
.define("OPENGRAPH_RELEASE_\(releaseVersion)"),
29+
]
30+
31+
if releaseVersion >= 2021 {
32+
for year in 2021 ... releaseVersion {
33+
sharedSwiftSettings.append(.define("OPENGRAPH_SUPPORT_\(year)_API"))
34+
}
35+
}
2436

2537
let warningsAsErrorsCondition = envEnable("OPENGRAPH_WERROR", default: isXcodeEnv && development)
2638
if warningsAsErrorsCondition {
@@ -79,7 +91,7 @@ let package = Package(
7991
// OpenGraph is a C++ & Swift mix target.
8092
// The SwiftPM support for such usage is still in progress.
8193
.target(
82-
name: "_OpenGraph",
94+
name: "OpenGraph_SPI",
8395
cSettings: [
8496
.unsafeFlags(["-I", includePath], .when(platforms: .nonDarwinPlatforms)),
8597
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
@@ -91,7 +103,7 @@ let package = Package(
91103
),
92104
.target(
93105
name: "OpenGraph",
94-
dependencies: ["_OpenGraph"],
106+
dependencies: ["OpenGraph_SPI"],
95107
swiftSettings: sharedSwiftSettings
96108
),
97109
.plugin(

Sources/OpenGraph/Attribute/Attribute/AnyAttribute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Audited for RELEASE_2021
66
// Status: API complete
77

8-
import _OpenGraph
8+
public import OpenGraph_SPI
99

1010
public typealias AnyAttribute = OGAttribute
1111

Sources/OpenGraph/Attribute/Attribute/Attribute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import _OpenGraph
1+
public import OpenGraph_SPI
22

33
@frozen
44
@propertyWrapper

Sources/OpenGraph/Attribute/Body/AttributeBody.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Audited for RELEASE_2021
66
// Status: Complete
77

8-
import _OpenGraph
8+
public import OpenGraph_SPI
99

1010
public protocol _AttributeBody {
1111
static func _destroySelf(_ pointer: UnsafeMutableRawPointer)

Sources/OpenGraph/Attribute/Rule/AnyRuleContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Audited for RELEASE_2021
66
// Status: Complete
77

8-
import _OpenGraph
8+
public import OpenGraph_SPI
99

1010
@frozen
1111
public struct AnyRuleContext {

Sources/OpenGraph/Attribute/Rule/Rule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Audited for RELEASE_2021
66
// Status: Complete
77

8-
import _OpenGraph
8+
public import OpenGraph_SPI
99

1010
public protocol Rule: _AttributeBody {
1111
associatedtype Value

Sources/OpenGraph/Attribute/Rule/RuleContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Audited for RELEASE_2021
66
// Status: Complete
77

8-
import _OpenGraph
8+
public import OpenGraph_SPI
99

1010
@frozen
1111
public struct RuleContext<Value> {

Sources/OpenGraph/Attribute/Rule/StatefulRule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Audited for RELEASE_2021
66
// Status: Complete
77

8-
import _OpenGraph
8+
public import OpenGraph_SPI
99

1010
public protocol StatefulRule: _AttributeBody {
1111
associatedtype Value

Sources/OpenGraph/Attribute/Weak/AnyWeakAttribute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Audited for RELEASE_2021
66
// Status: Complete
77

8-
import _OpenGraph
8+
public import OpenGraph_SPI
99

1010
public typealias AnyWeakAttribute = OGWeakAttribute
1111

0 commit comments

Comments
 (0)