-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
Package.swift
269 lines (225 loc) · 7.74 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
263
264
265
266
267
268
269
// 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(.v12)],
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,
],
targets: [
// The kernel of the SDK
.Prefixed.basics,
.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,
],
cxxLanguageStandard: .cxx11
)
extension Product {
static let basics = library(name: .basics, targets: [.basics, .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])
}
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/Dynamic/\(targetName).xcframework"
}
static func remoteBinaryURLString(for targetName: String) -> String {
"https://github.com/facebook/facebook-ios-sdk/releases/download/v17.0.2/\(targetName)-Dynamic_XCFramework.zip"
}
static let basics = target(
name: .basics,
dependencies: [.Prefixed.basics],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy"),
]
)
static let aem = target(
name: .aem,
dependencies: [.Prefixed.aem],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy"),
]
)
static let core = target(
name: .core,
dependencies: [.aem, .Prefixed.basics, .Prefixed.core],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy"),
],
linkerSettings: [
.cPlusPlusLibrary,
.zLibrary,
.accelerateFramework,
]
)
static let login = target(
name: .login,
dependencies: [.core, .Prefixed.login],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy"),
]
)
static let share = target(
name: .share,
dependencies: [.core, .Prefixed.share],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy"),
]
)
static let gaming = target(name: .gaming, dependencies: [.core, .Prefixed.share, .Prefixed.gaming])
enum Prefixed {
static let basics = binaryTarget(
name: .Prefixed.basics,
remoteChecksum: "da1739262f9d6cff788fac433e0ce1a07c0564192f67f8c30759483af4aec696"
)
static let aem = binaryTarget(
name: .Prefixed.aem,
remoteChecksum: "5f1705b1db895b32d99c796883fec2b301417e30c2893c10b10901d3f7815e6c"
)
static let core = binaryTarget(
name: .Prefixed.core,
remoteChecksum: "4e0f11e343e25c6fd224e2b074568555891a077488412063b18d570cd563a907"
)
static let login = binaryTarget(
name: .Prefixed.login,
remoteChecksum: "109118dae3037328af25cde578113321075ee75f06f998032368c3ed13fa19fc"
)
static let share = binaryTarget(
name: .Prefixed.share,
remoteChecksum: "3ad0a24677b15598c3f281f1cceddc314402a1f51182f33d76ea644c682391f1"
)
static let gamingServices = binaryTarget(
name: .Prefixed.gaming,
remoteChecksum: "281885a651d47ef1f160bac38194f74000c4d87d2d83200302b6d691cb599969"
)
}
}
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)
}
}
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"
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"
}
}