forked from facebook/facebook-ios-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
262 lines (214 loc) · 7.73 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
import PackageDescription
import Foundation
#if os(Linux)
import Glibc
#else
import Darwin.C
#endif
let package = Package(
name: "Facebook",
platforms: [
.iOS(.v10),
.tvOS(.v10)
],
products: [
// The Kernel of the SDK. Must be included as a runtime dependency.
.basics,
// The Facebook AEM Kit
.aem,
/*
The Core SDK library that provides two importable modules:
- FacebookCore which includes the most current interface and
will contain interfaces for new features written in Swift
- FBSDKCoreKit which contains legacy Objective-C interfaces
that will be used to maintain backwards compatibility with
types that have been converted to Swift.
This will not contain interfaces for new features written in Swift.
*/
.core,
// The Facebook Login SDK
.login,
// The Facebook Share SDK
.share,
// The Facebook Gaming Services SDK
.gaming,
// The Facebook tvOS SDK.
.tv,
],
targets: [
// The kernel of the SDK
.Prefixed.basics,
/*
The legacy Objective-C implementation that will be converted to Swift.
This will not contain interfaces for new features written in Swift.
*/
.Prefixed.aem,
// The main AEM module
.aem,
/*
The legacy Objective-C implementation that will be converted to Swift.
This will not contain interfaces for new features written in Swift.
*/
.Prefixed.core,
// The main Core SDK module
.core,
/*
The legacy Objective-C implementation that will be converted to Swift.
This will not contain interfaces for new features written in Swift.
*/
.Prefixed.login,
// The main Login SDK module
.login,
/*
The legacy Objective-C implementation that has been converted to Swift.
This will not contain interfaces for new features written in Swift.
*/
.Prefixed.share,
// The main Share SDK module
.share,
/*
The legacy Objective-C implementation that has been converted to Swift.
This will not contain interfaces for new features written in Swift.
*/
.Prefixed.gamingServices,
// The main Facebook Gaming Services module
.gaming,
// The tvOS-specific SDK with an FBSDK-prefixed name.
.Prefixed.tv,
// The tvOS-specific SDK.
.tv,
],
cxxLanguageStandard: .cxx11
)
extension Product {
static let basics = library(name: .basics, targets: [.Prefixed.basics])
static let core = library(name: .core, targets: [.core, .Prefixed.core])
static let login = library(name: .login, targets: [.login])
static let share = library(name: .share, targets: [.share, .Prefixed.share])
static let gaming = library(name: .gaming, targets: [.gaming, .Prefixed.gaming])
static let aem = library(name: .aem, targets: [.aem, .Prefixed.aem])
static let tv = library(name: .tv, targets: [.tv])
}
extension Target {
static let binarySource = BinarySource()
static func binaryTarget(name: String, remoteChecksum: String) -> Target {
switch binarySource {
case .local:
return .binaryTarget(
name: name,
path: localBinaryPath(for: name)
)
case .remote:
return .binaryTarget(
name: name,
url: remoteBinaryURLString(for: name),
checksum: remoteChecksum
)
}
}
static func localBinaryPath(for targetName: String) -> String {
"build/XCFrameworks/Static/\(targetName).xcframework"
}
static func remoteBinaryURLString(for targetName: String) -> String {
"https://github.com/facebook/facebook-ios-sdk/releases/download/v13.1.0/\(targetName)-Static_XCFramework.zip"
}
static let aem = target(name: .aem, dependencies: [.Prefixed.aem])
static let core = target(
name: .core,
dependencies: [.aem, .Prefixed.basics, .Prefixed.core],
linkerSettings: [
.cPlusPlusLibrary,
.zLibrary,
.accelerateFramework,
]
)
static let login = target(name: .login, dependencies: [.core, .Prefixed.login])
static let share = target(name: .share, dependencies: [.core, .Prefixed.share])
static let gaming = target(name: .gaming, dependencies: [.Prefixed.gaming])
static let tv = target(name: .tv, dependencies: [.Prefixed.tv])
enum Prefixed {
static let basics = binaryTarget(
name: .Prefixed.basics,
remoteChecksum: "f4ef1db46bc5a76542cdb3664485b5b7b2fc4c812f085cbd1eda659d4d8f544d"
)
static let aem = binaryTarget(
name: .Prefixed.aem,
remoteChecksum: "af4de135cf6fd2985fb9519e51168d4bcfe4fa726ecd5120ead5ea17a49840fd"
)
static let core = binaryTarget(
name: .Prefixed.core,
remoteChecksum: "2aca2fc4fc117d6e50836b08bdf5344aa8e71646112b6937353e1e8f2ac5f02b"
)
static let login = binaryTarget(
name: .Prefixed.login,
remoteChecksum: "145c44b4ca14efa987c2b562d29e2a58bd5c9ac764a7b16907c7e93b5110641f"
)
static let share = binaryTarget(
name: .Prefixed.share,
remoteChecksum: "0cb02e92c31ad8abc3e39e7d9843577eb65323f0f03d6ad50bbf7827bdc461cc"
)
static let gamingServices = binaryTarget(
name: .Prefixed.gaming,
remoteChecksum: "7651d1a02c71da1b30b43c8f6e19fc70701bdf325fcfdb31d32e610e84beea45"
)
static let tv = binaryTarget(
name: .Prefixed.tv,
remoteChecksum: "061ca46117c316a1cfe1bb4cf1a842ee41d4aa7fb1f9814363c4fcadb0df5bb7"
)
}
}
extension Target.Dependency {
static let aem = byName(name: .aem)
static let core = byName(name: .core)
enum Prefixed {
static let aem = byName(name: .Prefixed.aem)
static let basics = byName(name: .Prefixed.basics)
static let core = byName(name: .Prefixed.core)
static let login = byName(name: .Prefixed.login)
static let share = byName(name: .Prefixed.share)
static let gaming = byName(name: .Prefixed.gaming)
static let tv = byName(name: .Prefixed.tv)
}
}
extension LinkerSetting {
static let cPlusPlusLibrary = linkedLibrary("c++")
static let zLibrary = linkedLibrary("z")
static let accelerateFramework = linkedFramework("Accelerate")
}
enum BinarySource {
case local, remote
init() {
if getenv("USE_LOCAL_FB_BINARIES") != nil {
self = .local
} else {
self = .remote
}
}
}
extension String {
static let aem = "FacebookAEM"
static let basics = "FacebookBasics"
static let core = "FacebookCore"
static let login = "FacebookLogin"
static let share = "FacebookShare"
static let gaming = "FacebookGamingServices"
static let tv = "FacebookTV"
enum Prefixed {
static let aem = "FBAEMKit"
static let basics = "FBSDKCoreKit_Basics"
static let core = "FBSDKCoreKit"
static let login = "FBSDKLoginKit"
static let share = "FBSDKShareKit"
static let gaming = "FBSDKGamingServicesKit"
static let tv = "FBSDKTVOSKit"
}
}