Skip to content

Commit 385c9e5

Browse files
adincebicnglevin
andauthored
Fix an unexpected duplicated instance of the SwiftSupport libraries for app clip targets. (#2757)
This applies for cases where deployment target is below iOS 15. Cherry pick: [adf76de](adf76de) --------- Co-authored-by: Nicholas Levin <[email protected]>
1 parent 724e402 commit 385c9e5

File tree

5 files changed

+76
-1
lines changed

5 files changed

+76
-1
lines changed

apple/internal/ios_rules.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,6 @@ def _ios_app_clip_impl(ctx):
755755
bundle_dylibs = True,
756756
dependency_targets = embeddable_targets,
757757
label_name = label.name,
758-
package_swift_support_if_needed = True,
759758
platform_prerequisites = platform_prerequisites,
760759
),
761760
]

test/starlark_tests/ios_app_clip_tests.bzl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,22 @@ def ios_app_clip_test_suite(name):
160160
tags = [name],
161161
)
162162

163+
# Verify that Swift dylibs are packaged with the application, when the application uses Swift.
164+
archive_contents_test(
165+
name = "{}_device_swift_dylibs_present".format(name),
166+
build_type = "device",
167+
target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_app_clip_with_swift_support",
168+
contains = [
169+
"$ARCHIVE_ROOT/SwiftSupport/iphoneos/libswift_Concurrency.dylib",
170+
"$BUNDLE_ROOT/AppClips/app_clip_with_swift_support.app/Frameworks/libswift_Concurrency.dylib",
171+
"$BUNDLE_ROOT/Frameworks/libswift_Concurrency.dylib",
172+
],
173+
not_contains = [
174+
"$BUNDLE_ROOT/AppClips/SwiftSupport/iphoneos/libswift_Concurrency.dylib",
175+
],
176+
tags = [name],
177+
)
178+
163179
# Test dSYM binaries and linkmaps from framework embedded via 'data' are propagated correctly
164180
# at the top-level ios_extension rule, and present through the 'dsysms' and 'linkmaps' output
165181
# groups.

test/starlark_tests/resources/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,12 @@ swift_library(
13941394
tags = common.fixture_tags,
13951395
)
13961396

1397+
swift_library(
1398+
name = "swift_concurrency_main_lib",
1399+
srcs = ["concurrency_main.swift"],
1400+
tags = common.fixture_tags,
1401+
)
1402+
13971403
# --------------------------------------------------------------------------------
13981404
# C/C++ rules with data
13991405

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2025 The Bazel Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
16+
@main
17+
struct App {
18+
static func main() async throws {
19+
try await Task.sleep(nanoseconds: 1)
20+
}
21+
}

test/starlark_tests/targets_under_test/ios/BUILD

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,39 @@ ios_app_clip(
10571057
],
10581058
)
10591059

1060+
ios_application(
1061+
name = "app_with_app_clip_with_swift_support",
1062+
app_clips = [":app_clip_with_swift_support"],
1063+
bundle_id = "com.google.example",
1064+
entitlements = "//test/starlark_tests/resources:entitlements.plist",
1065+
families = ["iphone"],
1066+
infoplists = [
1067+
"//test/starlark_tests/resources:Info.plist",
1068+
],
1069+
minimum_os_version = common.min_os_ios.appclip_support,
1070+
provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
1071+
tags = common.fixture_tags,
1072+
deps = [
1073+
"//test/starlark_tests/resources:swift_concurrency_main_lib",
1074+
],
1075+
)
1076+
1077+
ios_app_clip(
1078+
name = "app_clip_with_swift_support",
1079+
bundle_id = "com.google.example.clip",
1080+
entitlements = "//test/starlark_tests/resources:entitlements.plist",
1081+
families = ["iphone"],
1082+
infoplists = [
1083+
"//test/starlark_tests/resources:Info.plist",
1084+
],
1085+
minimum_os_version = common.min_os_ios.appclip_support,
1086+
provisioning_profile = "//test/testdata/provisioning:integration_testing_ios.mobileprovision",
1087+
tags = common.fixture_tags,
1088+
deps = [
1089+
"//test/starlark_tests/resources:swift_concurrency_main_lib",
1090+
],
1091+
)
1092+
10601093
# ---------------------------------------------------------------------------------------
10611094

10621095
ios_application(

0 commit comments

Comments
 (0)