Skip to content

Commit dc0c98a

Browse files
committed
Fix more tests
1 parent dc7c05b commit dc0c98a

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"
@@ -148,7 +154,7 @@ swift_library(
148154
)
149155
EOF
150156

151-
do_build ios //app:app || fail "Should build"
157+
do_build ios //app:ipa_app || fail "Should build"
152158
assert_ipa_contains_swift_dylibs_for_device
153159
}
154160

@@ -164,7 +170,7 @@ swift_library(
164170
)
165171
EOF
166172

167-
do_build ios //app:app --features=asan || fail "Should build"
173+
do_build ios //app:ipa_app --features=asan || fail "Should build"
168174

169175
if is_device_build ios ; then
170176
assert_zip_contains "test-bin/app/app.ipa" \
@@ -189,7 +195,7 @@ swift_library(
189195
)
190196
EOF
191197

192-
do_build ios //app:app --features=tsan \
198+
do_build ios //app:ipa_app --features=tsan \
193199
|| fail "Should build"
194200
assert_zip_contains "test-bin/app/app.ipa" \
195201
"Payload/app.app/Frameworks/libclang_rt.tsan_iossim_dynamic.dylib"
@@ -208,7 +214,7 @@ swift_library(
208214
)
209215
EOF
210216

211-
do_build ios //app:app --features=asan || fail "Should build"
217+
do_build ios //app:ipa_app --features=asan || fail "Should build"
212218

213219
if is_device_build ios ; then
214220
assert_zip_contains "test-bin/app/app.ipa" \
@@ -234,7 +240,7 @@ EOF
234240
# The clang_rt resolution implemented in tools/clangrttool.py requires
235241
# the presence of a clang_rt*.dylib rpath.
236242

237-
do_build ios //app:app --features=include_clang_rt --linkopt=-fsanitize=address \
243+
do_build ios //app:ipa_app --features=include_clang_rt --linkopt=-fsanitize=address \
238244
|| fail "Should build"
239245

240246
if is_device_build ios ; then
@@ -263,7 +269,7 @@ EOF
263269
# The clang_rt resolution implemented in tools/clangrttool.py requires
264270
# the presence of a clang_rt*.dylib rpath.
265271

266-
do_build ios //app:app --features=include_clang_rt --linkopt=-fsanitize=thread \
272+
do_build ios //app:ipa_app --features=include_clang_rt --linkopt=-fsanitize=thread \
267273
|| fail "Should build"
268274
assert_zip_contains "test-bin/app/app.ipa" \
269275
"Payload/app.app/Frameworks/libclang_rt.tsan_iossim_dynamic.dylib"
@@ -285,7 +291,7 @@ EOF
285291
# The clang_rt resolution implemented in tools/clangrttool.py requires
286292
# the presence of a clang_rt*.dylib rpath.
287293

288-
do_build ios //app:app --features=include_clang_rt --linkopt=-fsanitize=undefined \
294+
do_build ios //app:ipa_app --features=include_clang_rt --linkopt=-fsanitize=undefined \
289295
|| fail "Should build"
290296

291297
if is_device_build ios ; then
@@ -309,7 +315,7 @@ swift_library(
309315
)
310316
EOF
311317

312-
do_build ios //app:app --features=apple.include_main_thread_checker \
318+
do_build ios //app:ipa_app --features=apple.include_main_thread_checker \
313319
|| fail "Should build"
314320

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

0 commit comments

Comments
 (0)