Skip to content

Commit 6c0f40b

Browse files
committed
Fix more tests
1 parent 1c5cc85 commit 6c0f40b

4 files changed

Lines changed: 98 additions & 29 deletions

File tree

apple/internal/apple_archive.bzl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ def _create_archive_file(ctx, bundle_info, bundletool, should_compress, all_inpu
151151
bundle_info: The AppleBundleInfo provider.
152152
bundletool: The bundletool executable.
153153
should_compress: Whether to compress the archive.
154-
all_inputs: Tuple of (bundle_merge_files, symbols_inputs, swift_support_inputs,
155-
watchos_stub_inputs, messages_stub_inputs).
154+
all_inputs: Tuple of (bundle_merge_files, symbols_inputs,
155+
swift_support_inputs, watchos_stub_inputs, messages_stub_inputs).
156156
157157
Returns:
158158
The declared archive file.
159159
"""
160160
bundle_merge_files, symbols_inputs, swift_support_inputs, watchos_stub_inputs, messages_stub_inputs = all_inputs
161161

162-
archive = ctx.actions.declare_file("%s.ipa" % bundle_info.bundle_name)
162+
archive = ctx.actions.declare_file("%s.ipa" % ctx.attr.bundle.label.name)
163163

164164
control = struct(
165165
bundle_merge_files = bundle_merge_files,
@@ -266,6 +266,7 @@ def _apple_archive_impl(ctx):
266266

267267
should_compress = _should_compress_archive(ctx)
268268

269+
# Package the bundle tree artifact into an IPA
269270
bundle_merge_files = [
270271
struct(
271272
src = bundle_info.archive.path,

apple/internal/experimental.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ def is_experimental_tree_artifact_enabled(
4949
# These will produce .app bundles that can be wrapped into .ipa files
5050
if rule_descriptor and platform_prerequisites:
5151
if (platform_prerequisites.platform.platform_type, rule_descriptor.product_type) in [
52-
(str(apple_common.platform_type.ios), apple_product_type.application),
53-
(str(apple_common.platform_type.ios), apple_product_type.messages_application),
54-
(str(apple_common.platform_type.tvos), apple_product_type.application),
55-
(str(apple_common.platform_type.visionos), apple_product_type.application),
52+
(apple_common.platform_type.ios, apple_product_type.application),
53+
(apple_common.platform_type.ios, apple_product_type.messages_application),
54+
(apple_common.platform_type.tvos, apple_product_type.application),
55+
(apple_common.platform_type.visionos, apple_product_type.application),
5656
]:
5757
return True
5858

test/ios_application_swift_test.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function tear_down() {
3232
# individual tests (so that they can exercise different dependency structures).
3333
function create_minimal_ios_application() {
3434
cat > app/BUILD <<EOF
35+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
3536
load("@build_bazel_rules_apple//apple:ios.bzl",
3637
"ios_application")
3738
load("@build_bazel_rules_swift//swift:swift.bzl",
@@ -46,6 +47,11 @@ ios_application(
4647
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_ios.mobileprovision",
4748
deps = [":lib"],
4849
)
50+
51+
apple_archive(
52+
name = "ipa_app",
53+
bundle = ":app",
54+
)
4955
EOF
5056

5157
cat > app/AppDelegate.swift <<EOF
@@ -96,7 +102,7 @@ swift_library(
96102
)
97103
EOF
98104

99-
do_build ios //app:app || fail "Should build"
105+
do_build ios //app:ipa_app || fail "Should build"
100106
assert_ipa_contains_swift_dylibs_for_device
101107
}
102108

@@ -113,7 +119,7 @@ swift_library(
113119
)
114120
EOF
115121

116-
do_build ios //app:app --define=apple.package_swift_support=no \
122+
do_build ios //app:ipa_app --define=apple.package_swift_support=no \
117123
|| fail "Should build"
118124
assert_zip_contains "test-bin/app/app.ipa" \
119125
"Payload/app.app/Frameworks/libswiftCore.dylib"
@@ -146,7 +152,7 @@ swift_library(
146152
)
147153
EOF
148154

149-
do_build ios //app:app || fail "Should build"
155+
do_build ios //app:ipa_app || fail "Should build"
150156
assert_ipa_contains_swift_dylibs_for_device
151157
}
152158

@@ -162,7 +168,7 @@ swift_library(
162168
)
163169
EOF
164170

165-
do_build ios //app:app --features=asan || fail "Should build"
171+
do_build ios //app:ipa_app --features=asan || fail "Should build"
166172

167173
if is_device_build ios ; then
168174
assert_zip_contains "test-bin/app/app.ipa" \
@@ -187,7 +193,7 @@ swift_library(
187193
)
188194
EOF
189195

190-
do_build ios //app:app --features=tsan \
196+
do_build ios //app:ipa_app --features=tsan \
191197
|| fail "Should build"
192198
assert_zip_contains "test-bin/app/app.ipa" \
193199
"Payload/app.app/Frameworks/libclang_rt.tsan_iossim_dynamic.dylib"
@@ -206,7 +212,7 @@ swift_library(
206212
)
207213
EOF
208214

209-
do_build ios //app:app --features=asan || fail "Should build"
215+
do_build ios //app:ipa_app --features=asan || fail "Should build"
210216

211217
if is_device_build ios ; then
212218
assert_zip_contains "test-bin/app/app.ipa" \
@@ -232,7 +238,7 @@ EOF
232238
# The clang_rt resolution implemented in tools/clangrttool.py requires
233239
# the presence of a clang_rt*.dylib rpath.
234240

235-
do_build ios //app:app --features=include_clang_rt --linkopt=-fsanitize=address \
241+
do_build ios //app:ipa_app --features=include_clang_rt --linkopt=-fsanitize=address \
236242
|| fail "Should build"
237243

238244
if is_device_build ios ; then
@@ -261,7 +267,7 @@ EOF
261267
# The clang_rt resolution implemented in tools/clangrttool.py requires
262268
# the presence of a clang_rt*.dylib rpath.
263269

264-
do_build ios //app:app --features=include_clang_rt --linkopt=-fsanitize=thread \
270+
do_build ios //app:ipa_app --features=include_clang_rt --linkopt=-fsanitize=thread \
265271
|| fail "Should build"
266272
assert_zip_contains "test-bin/app/app.ipa" \
267273
"Payload/app.app/Frameworks/libclang_rt.tsan_iossim_dynamic.dylib"
@@ -283,7 +289,7 @@ EOF
283289
# The clang_rt resolution implemented in tools/clangrttool.py requires
284290
# the presence of a clang_rt*.dylib rpath.
285291

286-
do_build ios //app:app --features=include_clang_rt --linkopt=-fsanitize=undefined \
292+
do_build ios //app:ipa_app --features=include_clang_rt --linkopt=-fsanitize=undefined \
287293
|| fail "Should build"
288294

289295
if is_device_build ios ; then
@@ -307,7 +313,7 @@ swift_library(
307313
)
308314
EOF
309315

310-
do_build ios //app:app --features=apple.include_main_thread_checker \
316+
do_build ios //app:ipa_app --features=apple.include_main_thread_checker \
311317
|| fail "Should build"
312318

313319
assert_zip_contains "test-bin/app/app.ipa" \

0 commit comments

Comments
 (0)