Skip to content

Commit f96b657

Browse files
authored
Merge pull request #195 from woshimaliang/dynamic_framework
Introduce is_dynamic_framework config for dynamic frameworks support
2 parents d1440d9 + 13a10eb commit f96b657

File tree

17 files changed

+197
-15
lines changed

17 files changed

+197
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Pods/
1616
PodsHost/
1717
*.xcworkspace
1818
PodToBUILD.zip
19+
.DS_Store

BazelExtensions/workspace.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ def _impl(repository_ctx):
151151
_cli_bool(repository_ctx.attr.generate_module_map),
152152
"--vendorize",
153153
_cli_bool(False),
154+
"--is_dynamic_framework",
155+
_cli_bool(repository_ctx.attr.is_dynamic_framework),
154156
])
155157
substitutions[INIT_REPO_PLACEHOLDER] = " ".join(entry)
156158
else:
@@ -209,6 +211,7 @@ pod_repo_ = repository_rule(
209211
"enable_modules": attr.bool(default=False, mandatory=True),
210212
"generate_module_map": attr.bool(default=False, mandatory=True),
211213
"header_visibility": attr.string(),
214+
"is_dynamic_framework": attr.bool(default=False, mandatory=False),
212215
}
213216
)
214217

@@ -227,6 +230,7 @@ def new_pod_repository(name,
227230
enable_modules=True,
228231
generate_module_map=None,
229232
header_visibility="pod_support",
233+
is_dynamic_framework=False,
230234
):
231235
"""Declare a repository for a Pod
232236
Args:
@@ -289,6 +293,8 @@ def new_pod_repository(name,
289293
290294
header_visibility: DEPRECATED: This is replaced by headermaps:
291295
https://github.com/bazelbuild/bazel/pull/3712
296+
297+
is_dynamic_framework: set to True if the pod uses prebuilt dynamic framework(s)
292298
"""
293299
if generate_module_map == None:
294300
generate_module_map = enable_modules
@@ -316,5 +322,6 @@ def new_pod_repository(name,
316322
trace=trace,
317323
enable_modules=enable_modules,
318324
generate_module_map=generate_module_map,
319-
header_visibility=header_visibility
325+
header_visibility=header_visibility,
326+
is_dynamic_framework=is_dynamic_framework,
320327
)

Examples/SnapSDK/.bazelrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# A few settings for XCHammer's .bazelrc
2+
# Debugging: Use the remapping feature of rules_swift.
3+
build \
4+
--spawn_strategy=local \
5+
--strategy=SwiftCompile=worker \
6+
--swiftcopt=-Xwrapped-swift=-debug-prefix-pwd-is-dot \
7+
--experimental_strict_action_env=true
8+
9+
test \
10+
--spawn_strategy=local \
11+

Examples/SnapSDK/.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0.0

Examples/SnapSDK/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/SnapSDK:SCSDKCreativeKit",
26+
],
27+
sdk_frameworks = ["UIKit", "CoreGraphics"]
28+
)
29+

Examples/SnapSDK/Info.plist

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/SnapSDK/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../Example.Makefile

Examples/SnapSDK/Pods.WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
new_pod_repository(
2+
name = "SnapSDK",
3+
url = "https://storage.googleapis.com/snap-kit-build/scsdk/ios/release/latest/SCSDK-1.4.0.tar.gz",
4+
podspec_url = "SnapSDK.podspec.json",
5+
strip_prefix = "SCSDK",
6+
is_dynamic_framework = True # SnapSDK is dynamic framework, is_dynamic_framework:True will enable apple_dynamic_framework_import
7+
)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "SnapSDK",
3+
"version": "1.4.0",
4+
"summary": "Snap Kit lets developers like you integrate some of Snapchat’s best features across your platform.",
5+
"homepage": "https://kit.snapchat.com",
6+
"license": {
7+
"type": "Snap Developer Terms of Service",
8+
"file": "LICENSE"
9+
},
10+
"authors": "Snap",
11+
"platforms": {
12+
"ios": "9.0"
13+
},
14+
"documentation_url": "https://docs.snapchat.com/docs/",
15+
"source": {
16+
"http": "https://storage.googleapis.com/snap-kit-build/scsdk/ios/release/latest/SCSDK-1.4.0.tar.gz",
17+
"type": "tgz"
18+
},
19+
"default_subspecs": ["SCSDKCreativeKit"],
20+
"subspecs": [
21+
{
22+
"name": "SCSDKCreativeKit",
23+
"vendored_frameworks": [
24+
"SCSDKCreativeKit.framework",
25+
"SCSDKCoreKit.framework"
26+
]
27+
}
28+
]
29+
}

Examples/SnapSDK/WORKSPACE

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 = "a41a75c291c69676b9974458ceee09aea60cee0e1ee282e27cdc90b679dfd30f",
13+
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.21.2/rules_apple.0.21.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+
load(
38+
"@com_google_protobuf//:protobuf_deps.bzl",
39+
"protobuf_deps",
40+
)
41+
42+
protobuf_deps()

0 commit comments

Comments
 (0)