Skip to content

Commit ab41249

Browse files
authored
Merge pull request #208 from woshimaliang/master
Add **XCFramework** support to PodToBUILD
2 parents cb874da + 3b0e2a0 commit ab41249

File tree

18 files changed

+189
-26
lines changed

18 files changed

+189
-26
lines changed

BazelExtensions/workspace.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ def _impl(repository_ctx):
153153
_cli_bool(False),
154154
"--is_dynamic_framework",
155155
_cli_bool(repository_ctx.attr.is_dynamic_framework),
156+
"--is_xcframework",
157+
_cli_bool(repository_ctx.attr.is_xcframework),
156158
])
157159
substitutions[INIT_REPO_PLACEHOLDER] = " ".join(entry)
158160
else:
@@ -212,6 +214,7 @@ pod_repo_ = repository_rule(
212214
"generate_module_map": attr.bool(default=False, mandatory=True),
213215
"header_visibility": attr.string(),
214216
"is_dynamic_framework": attr.bool(default=False, mandatory=False),
217+
"is_xcframework": attr.bool(default=False, mandatory=False),
215218
}
216219
)
217220

@@ -231,6 +234,7 @@ def new_pod_repository(name,
231234
generate_module_map=None,
232235
header_visibility="pod_support",
233236
is_dynamic_framework=False,
237+
is_xcframework=False,
234238
):
235239
"""Declare a repository for a Pod
236240
Args:
@@ -295,6 +299,8 @@ def new_pod_repository(name,
295299
https://github.com/bazelbuild/bazel/pull/3712
296300
297301
is_dynamic_framework: set to True if the pod uses prebuilt dynamic framework(s)
302+
303+
is_xcframework: set To True if the the pod uses prebuild xcframework
298304
"""
299305
if generate_module_map == None:
300306
generate_module_map = enable_modules
@@ -324,4 +330,5 @@ def new_pod_repository(name,
324330
generate_module_map=generate_module_map,
325331
header_visibility=header_visibility,
326332
is_dynamic_framework=is_dynamic_framework,
333+
is_xcframework=is_xcframework,
327334
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "AmazonIVSPlayer",
3+
"version": "1.8.1",
4+
"summary": "Amazon AWS Interactive Video Service Player",
5+
"homepage": "https://aws.amazon.com/ivs/",
6+
"license": {
7+
"type": "Custom",
8+
"text": "https://player.live-video.net/LICENSE.txt"
9+
},
10+
"authors": "Amazon.com, Inc.",
11+
"social_media_url": "https://twitter.com/awscloud",
12+
"platforms": {
13+
"ios": "10.0"
14+
},
15+
"source": {
16+
"http": "https://player.live-video.net/1.8.1/AmazonIVSPlayer.xcframework.zip",
17+
"type": "zip",
18+
},
19+
"vendored_frameworks": "AmazonIVSPlayer.xcframework"
20+
}

Examples/AmazonIVSPlayer/BUILD

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
2+
load("@rules_cc//cc:defs.bzl", "objc_library")
3+
4+
# This is needed for implicit entitlement rules created for
5+
# files.
6+
package(default_visibility = ["//visibility:public"])
7+
8+
ios_application(
9+
name = "ios-app",
10+
bundle_id = "com.lma",
11+
families = ["iphone"],
12+
infoplists = ["Info.plist"],
13+
visibility = ["//visibility:public"],
14+
deps = ["ios-app-bin"],
15+
minimum_os_version = "9.3"
16+
)
17+
18+
objc_library(
19+
name = "ios-app-bin",
20+
srcs = [
21+
"main.m",
22+
],
23+
enable_modules = True,
24+
deps = [
25+
"//Vendor/AmazonIVSPlayer:AmazonIVSPlayer",
26+
],
27+
sdk_frameworks = ["UIKit", "CoreGraphics"]
28+
)
29+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>ios-app</string>
9+
<key>CFBundleExecutable</key>
10+
<string>ios-app</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>com.lma</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>ios-app</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>1.0</string>
25+
<key>LSRequiresIPhoneOS</key>
26+
<true/>
27+
</dict>
28+
</plist>

Examples/AmazonIVSPlayer/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../Example.Makefile
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
new_pod_repository(
2+
name = "AmazonIVSPlayer",
3+
url = "https://player.live-video.net/1.8.1/AmazonIVSPlayer.xcframework.zip",
4+
podspec_url = "AmazonIVSPlayer.podspec.json",
5+
is_dynamic_framework = True, # AmazonIVSPlayer is dynamic XCFramework
6+
is_xcframework = True,
7+
)

Examples/AmazonIVSPlayer/WORKSPACE

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
3+
http_archive(
4+
name = "rules_pods",
5+
urls = ["https://note-this-is-overridden"],
6+
)
7+
8+
load("@rules_pods//BazelExtensions:workspace.bzl", "new_pod_repository")
9+
10+
http_archive(
11+
name = "build_bazel_rules_apple",
12+
sha256 = "12865e5944f09d16364aa78050366aca9dc35a32a018fa35f5950238b08bf744",
13+
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.34.2/rules_apple.0.34.2.tar.gz",
14+
)
15+
16+
load(
17+
"@build_bazel_rules_apple//apple:repositories.bzl",
18+
"apple_rules_dependencies",
19+
)
20+
21+
apple_rules_dependencies()
22+
23+
load(
24+
"@build_bazel_apple_support//lib:repositories.bzl",
25+
"apple_support_dependencies",
26+
)
27+
28+
apple_support_dependencies()
29+
30+
load(
31+
"@build_bazel_rules_swift//swift:repositories.bzl",
32+
"swift_rules_dependencies",
33+
)
34+
35+
swift_rules_dependencies()
36+
37+
38+
load(
39+
"@build_bazel_rules_swift//swift:extras.bzl",
40+
"swift_rules_extra_dependencies",
41+
)
42+
43+
swift_rules_extra_dependencies()

Examples/AmazonIVSPlayer/main.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#import <AmazonIVSPlayer/AmazonIVSPlayer.h>
2+
3+
int main(int argc, char * argv[]) {
4+
5+
IVSPlayer *obj = [[IVSPlayer alloc] init];
6+
NSLog(@"%@", obj);
7+
8+
return 0;
9+
}

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ build-test: pod_test build archive init-sandbox
5555
cd Examples/React && make all
5656
cd Examples/SwiftSubspec && make all
5757
cd Examples/FBSDK && make all
58+
cd Examples/SnapSDK && make all
59+
cd Examples/AmazonIVSPlayer && make all
5860

5961
build-example: EXAMPLE=Examples/PINCache.podspec.json
6062
build-example: CONFIG = debug

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ there is no need to add an entry for them.
249249

250250
`header_visibility`: DEPRECATED: This is replaced by headermaps: https://github.com/Bazelbuild/Bazel/pull/3712
251251

252-
`is_dynamic_framework`: set to True if the pod uses prebuilt dynamic framework(s)
252+
`is_dynamic_framework`: set to True if the pod uses prebuilt dynamic framework(s)
253+
254+
`is_xcframework`: set to True if the pod uses prebuilt xcframework
253255

254256
### Known Complications
255257

@@ -372,4 +374,3 @@ swift package generate-xcodeproj
372374
```
373375

374376
PRs welcome :)!
375-

0 commit comments

Comments
 (0)