forked from facebook/facebook-ios-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
239 lines (196 loc) · 7.11 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
// 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,
/*
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: [.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/Static/\(targetName).xcframework"
}
static func remoteBinaryURLString(for targetName: String) -> String {
"https://github.com/facebook/facebook-ios-sdk/releases/download/v16.0.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])
enum Prefixed {
static let basics = binaryTarget(
name: .Prefixed.basics,
remoteChecksum: "241314fdfb5a81469e544c3dfa0ce26b61e2aa84f281e6d6bf7b5e96124300a2"
)
static let aem = binaryTarget(
name: .Prefixed.aem,
remoteChecksum: "2694c283bb38c4f8040fac183fb1411e804385cb884ec2765c3b56af2561667b"
)
static let core = binaryTarget(
name: .Prefixed.core,
remoteChecksum: "9e58f608b36f177b2624fd7f17022e96f3c17fbe86495712669c56c87a4979c4"
)
static let login = binaryTarget(
name: .Prefixed.login,
remoteChecksum: "f64c68f9ea8257ead2938a712848203598c9fc2a35e9a07ae000baff3cba6f5b"
)
static let share = binaryTarget(
name: .Prefixed.share,
remoteChecksum: "686b5974b92e0b0da5e1abc927a09f9bb87e458130e45e0f21a64df605d0a62e"
)
static let gamingServices = binaryTarget(
name: .Prefixed.gaming,
remoteChecksum: "2e6404651806c6b5e86d51875f32805a18aee80dc66001e8dcca752b15ca812d"
)
}
}
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"
}
}