Skip to content

Commit cdec29c

Browse files
committed
Fix more watchos and tvos shell script tests
1 parent 9ecf0a1 commit cdec29c

4 files changed

Lines changed: 78 additions & 25 deletions

File tree

test/tvos_application_swift_test.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function tear_down() {
3333
# individual tests (so that they can exercise different dependency structures).
3434
function create_minimal_tvos_application() {
3535
cat > app/BUILD <<EOF
36+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
3637
load("@build_bazel_rules_apple//apple:tvos.bzl",
3738
"tvos_application")
3839
load("@build_bazel_rules_swift//swift:swift.bzl",
@@ -46,6 +47,11 @@ tvos_application(
4647
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_tvos.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
@@ -81,7 +87,7 @@ swift_library(
8187
)
8288
EOF
8389

84-
do_build tvos //app:app --define=apple.package_swift_support=no \
90+
do_build tvos //app:ipa_app --define=apple.package_swift_support=no \
8591
|| fail "Should build"
8692
assert_zip_contains "test-bin/app/app.ipa" \
8793
"Payload/app.app/Frameworks/libswiftCore.dylib"

test/tvos_application_test.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function tear_down() {
2929
# Creates common source, targets, and basic plist for tvOS applications.
3030
function create_common_files() {
3131
cat > app/BUILD <<EOF
32+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
3233
load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application")
3334
3435
objc_library(
@@ -69,6 +70,11 @@ tvos_application(
6970
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_tvos.mobileprovision",
7071
deps = [":lib"],
7172
)
73+
74+
apple_archive(
75+
name = "ipa_app",
76+
bundle = ":app",
77+
)
7278
EOF
7379
}
7480

@@ -86,7 +92,7 @@ function test_missing_version_fails() {
8692
}
8793
EOF
8894

89-
! do_build tvos //app:app \
95+
! do_build tvos //app:ipa_app \
9096
|| fail "Should fail build"
9197

9298
expect_log 'Target "@@\?//app:app" is missing CFBundleVersion.'
@@ -106,7 +112,7 @@ function test_missing_short_version_fails() {
106112
}
107113
EOF
108114

109-
! do_build tvos //app:app \
115+
! do_build tvos //app:ipa_app \
110116
|| fail "Should fail build"
111117

112118
expect_log 'Target "@@\?//app:app" is missing CFBundleShortVersionString.'
@@ -139,13 +145,18 @@ tvos_application(
139145
provisioning_profile = "bogus.mobileprovision",
140146
deps = [":lib"],
141147
)
148+
149+
apple_archive(
150+
name = "ipa_app",
151+
bundle = ":app",
152+
)
142153
EOF
143154

144155
cat > app/bogus.mobileprovision <<EOF
145156
BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS
146157
EOF
147158

148-
! do_build tvos //app:app || fail "Should fail"
159+
! do_build tvos //app:ipa_app || fail "Should fail"
149160
# The fact that multiple things are tried is left as an impl detail and
150161
# only the final message is looked for.
151162
expect_log 'While processing target "@@\?//app:app", failed to extract from the provisioning profile "app/bogus.mobileprovision".'

test/tvos_extension_test.sh

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function tear_down() {
2929
# Creates common source, targets, and basic plist for tvOS applications.
3030
function create_minimal_tvos_application_with_extension() {
3131
cat > app/BUILD <<EOF
32+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
3233
load("@build_bazel_rules_apple//apple:tvos.bzl",
3334
"tvos_application",
3435
"tvos_extension",
@@ -58,6 +59,11 @@ tvos_extension(
5859
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_tvos.mobileprovision",
5960
deps = [":lib"],
6061
)
62+
63+
apple_archive(
64+
name = "ipa_app",
65+
bundle = ":app",
66+
)
6167
EOF
6268

6369
cat > app/Foo.h <<EOF
@@ -123,7 +129,7 @@ function test_missing_version_fails() {
123129
}
124130
EOF
125131

126-
! do_build tvos //app:app \
132+
! do_build tvos //app:ipa_app \
127133
|| fail "Should fail build"
128134

129135
expect_log 'Target "@@\?//app:ext" is missing CFBundleVersion.'
@@ -146,7 +152,7 @@ function test_missing_short_version_fails() {
146152
}
147153
EOF
148154

149-
! do_build tvos //app:app \
155+
! do_build tvos //app:ipa_app \
150156
|| fail "Should fail build"
151157

152158
expect_log 'Target "@@\?//app:ext" is missing CFBundleShortVersionString.'
@@ -156,6 +162,7 @@ EOF
156162
# not the app's ID followed by at least another component, the build fails.
157163
function test_extension_with_mismatched_bundle_id_fails_to_build() {
158164
cat > app/BUILD <<EOF
165+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
159166
load("@build_bazel_rules_apple//apple:tvos.bzl",
160167
"tvos_application",
161168
"tvos_extension",
@@ -184,6 +191,11 @@ tvos_extension(
184191
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_tvos.mobileprovision",
185192
deps = [":lib"],
186193
)
194+
195+
apple_archive(
196+
name = "ipa_app",
197+
bundle = ":app",
198+
)
187199
EOF
188200

189201
cat > app/main.m <<EOF
@@ -224,14 +236,15 @@ EOF
224236
}
225237
EOF
226238

227-
! do_build tvos //app:app || fail "Should not build"
239+
! do_build tvos //app:ipa_app || fail "Should not build"
228240
expect_log 'While processing target "@@\?//app:app"; the CFBundleIdentifier of the child target "@@\?//app:ext" should have "my.bundle.id." as its prefix, but found "my.extension.id".'
229241
}
230242

231243
# Tests that if an application contains an extension with different
232244
# CFBundleShortVersionString the build fails.
233245
function test_extension_with_mismatched_short_version_fails_to_build() {
234246
cat > app/BUILD <<EOF
247+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
235248
load("@build_bazel_rules_apple//apple:tvos.bzl",
236249
"tvos_application",
237250
"tvos_extension",
@@ -260,6 +273,11 @@ tvos_extension(
260273
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_tvos.mobileprovision",
261274
deps = [":lib"],
262275
)
276+
277+
apple_archive(
278+
name = "ipa_app",
279+
bundle = ":app",
280+
)
263281
EOF
264282

265283
cat > app/main.m <<EOF
@@ -300,14 +318,15 @@ EOF
300318
}
301319
EOF
302320

303-
! do_build tvos //app:app || fail "Should not build"
321+
! do_build tvos //app:ipa_app || fail "Should not build"
304322
expect_log "While processing target \"@@\?//app:app\"; the CFBundleShortVersionString of the child target \"@@\?//app:ext\" should be the same as its parent's version string \"1.0\", but found \"1.1\"."
305323
}
306324

307325
# Tests that if an application contains an extension with different
308326
# CFBundleVersion the build fails.
309327
function test_extension_with_mismatched_version_fails_to_build() {
310328
cat > app/BUILD <<EOF
329+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
311330
load("@build_bazel_rules_apple//apple:tvos.bzl",
312331
"tvos_application",
313332
"tvos_extension",
@@ -336,6 +355,11 @@ tvos_extension(
336355
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_tvos.mobileprovision",
337356
deps = [":lib"],
338357
)
358+
359+
apple_archive(
360+
name = "ipa_app",
361+
bundle = ":app",
362+
)
339363
EOF
340364

341365
cat > app/main.m <<EOF
@@ -376,13 +400,14 @@ EOF
376400
}
377401
EOF
378402

379-
! do_build tvos //app:app || fail "Should not build"
403+
! do_build tvos //app:ipa_app || fail "Should not build"
380404
expect_log "While processing target \"@@\?//app:app\"; the CFBundleVersion of the child target \"@@\?//app:ext\" should be the same as its parent's version string \"1.0\", but found \"1.1\"."
381405
}
382406

383407
# Tests that an extension with legacy_entry_point=True builds successfully.
384408
function test_legacy_entry_point_extension_builds() {
385409
cat > app/BUILD <<EOF
410+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
386411
load("@build_bazel_rules_apple//apple:tvos.bzl",
387412
"tvos_application",
388413
"tvos_extension",
@@ -412,6 +437,11 @@ tvos_extension(
412437
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_tvos.mobileprovision",
413438
deps = [":lib"],
414439
)
440+
441+
apple_archive(
442+
name = "ipa_app",
443+
bundle = ":app",
444+
)
415445
EOF
416446

417447
cat > app/main.m <<EOF
@@ -452,7 +482,7 @@ EOF
452482
}
453483
EOF
454484

455-
do_build tvos //app:app || fail "Should build"
485+
do_build tvos //app:ipa_app || fail "Should build"
456486
}
457487

458488
run_suite "tvos_extension bundling tests"

test/watchos_application_test.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function tear_down() {
3131
# targets to the BUILD file).
3232
function create_companion_app_and_watchos_application_support_files() {
3333
cat > app/BUILD <<EOF
34+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
3435
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
3536
load("@build_bazel_rules_apple//apple:watchos.bzl",
3637
"watchos_application",
@@ -58,6 +59,11 @@ ios_application(
5859
deps = [":lib"],
5960
)
6061
62+
apple_archive(
63+
name = "ipa_app",
64+
bundle = ":app",
65+
)
66+
6167
EOF
6268

6369
cat > app/main.m <<EOF
@@ -160,7 +166,7 @@ function test_watch_app_missing_version_fails() {
160166
}
161167
EOF
162168

163-
! do_build watchos //app:app \
169+
! do_build watchos //app:ipa_app \
164170
|| fail "Should fail build"
165171

166172
expect_log 'Target "@@\?//app:watch_app" is missing CFBundleVersion.'
@@ -182,7 +188,7 @@ function test_watch_app_missing_short_version_fails() {
182188
}
183189
EOF
184190

185-
! do_build watchos //app:app \
191+
! do_build watchos //app:ipa_app \
186192
|| fail "Should fail build"
187193

188194
expect_log 'Target "@@\?//app:watch_app" is missing CFBundleShortVersionString.'
@@ -208,7 +214,7 @@ function test_watch_ext_missing_version_fails() {
208214
}
209215
EOF
210216

211-
! do_build watchos //app:app \
217+
! do_build watchos //app:ipa_app \
212218
|| fail "Should fail build"
213219

214220
expect_log 'Target "@@\?//app:watch_ext" is missing CFBundleVersion.'
@@ -234,7 +240,7 @@ function test_watch_ext_missing_short_version_fails() {
234240
}
235241
EOF
236242

237-
! do_build watchos //app:app \
243+
! do_build watchos //app:ipa_app \
238244
|| fail "Should fail build"
239245

240246
expect_log 'Target "@@\?//app:watch_ext" is missing CFBundleShortVersionString.'
@@ -283,14 +289,14 @@ BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS
283289
EOF
284290

285291
if is_device_build watchos ; then
286-
! do_build watchos //app:app || fail "Should fail"
292+
! do_build watchos //app:ipa_app || fail "Should fail"
287293
# The fact that multiple things are tried is left as an impl detail and
288294
# only the final message is looked for.
289295
expect_log 'While processing target "@@\?//app:watch_app", failed to extract from the provisioning profile "app/bogus.mobileprovision".'
290296
else
291297
# For simulator builds, entitlements are added as a Mach-O section in
292298
# the binary, so the build shouldn't fail.
293-
do_build watchos //app:app || fail "Should build"
299+
do_build watchos //app:ipa_app || fail "Should build"
294300
fi
295301
}
296302

@@ -323,7 +329,7 @@ EOF
323329
BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS BOGUS
324330
EOF
325331

326-
! do_build watchos //app:app || fail "Should fail"
332+
! do_build watchos //app:ipa_app || fail "Should fail"
327333
# The fact that multiple things are tried is left as an impl detail and
328334
# only the final message is looked for.
329335
expect_log 'While processing target "@@\?//app:watch_ext", failed to extract from the provisioning profile "app/bogus.mobileprovision".'
@@ -373,7 +379,7 @@ EOF
373379
}
374380
EOF
375381

376-
! do_build watchos //app:app || fail "Should not build"
382+
! do_build watchos //app:ipa_app || fail "Should not build"
377383
expect_log 'While processing target "@@\?//app:app"; the CFBundleIdentifier of the child target "@@\?//app:watch_app" should have "my.bundle.id." as its prefix, but found "my.bundle2.id.watch-app".'
378384
}
379385

@@ -404,7 +410,7 @@ watchos_extension(
404410
)
405411
EOF
406412

407-
! do_build watchos //app:app || fail "Should not build"
413+
! do_build watchos //app:ipa_app || fail "Should not build"
408414
expect_log 'While processing target "@@\?//app:watch_app"; the CFBundleIdentifier of the child target "@@\?//app:watch_ext" should have "my.bundle.id.watch-app." as its prefix, but found "my.bundle2.id.watch-app.watch-ext".'
409415
}
410416

@@ -464,7 +470,7 @@ EOF
464470
}
465471
EOF
466472

467-
! do_build watchos //app:app || fail "Should not build"
473+
! do_build watchos //app:ipa_app || fail "Should not build"
468474
expect_log "While processing target \"@@\?//app:app\"; the CFBundleShortVersionString of the child target \"@@\?//app:watch_app\" should be the same as its parent's version string \"1\", but found \"1.1\"."
469475
}
470476

@@ -511,7 +517,7 @@ EOF
511517
}
512518
EOF
513519

514-
! do_build watchos //app:app || fail "Should not build"
520+
! do_build watchos //app:ipa_app || fail "Should not build"
515521
expect_log "While processing target \"@@\?//app:watch_app\"; the CFBundleShortVersionString of the child target \"@@\?//app:watch_ext\" should be the same as its parent's version string \"1\", but found \"1.1\"."
516522
}
517523

@@ -571,7 +577,7 @@ EOF
571577
}
572578
EOF
573579

574-
! do_build watchos //app:app || fail "Should not build"
580+
! do_build watchos //app:ipa_app || fail "Should not build"
575581
expect_log "While processing target \"@@\?//app:app\"; the CFBundleVersion of the child target \"@@\?//app:watch_app\" should be the same as its parent's version string \"1\", but found \"1.1\"."
576582
}
577583

@@ -618,7 +624,7 @@ EOF
618624
}
619625
EOF
620626

621-
! do_build watchos //app:app || fail "Should not build"
627+
! do_build watchos //app:ipa_app || fail "Should not build"
622628
expect_log "While processing target \"@@\?//app:watch_app\"; the CFBundleVersion of the child target \"@@\?//app:watch_ext\" should be the same as its parent's version string \"1\", but found \"1.1\"."
623629
}
624630

@@ -661,7 +667,7 @@ EOF
661667
}
662668
EOF
663669

664-
! do_build watchos //app:app || fail "Should not build"
670+
! do_build watchos //app:ipa_app || fail "Should not build"
665671
expect_log "While processing target \"@@\?//app:app\"; the Info.plist for child target \"@@\?//app:watch_app\" has the wrong value for \"WKCompanionAppBundleIdentifier\"; expected u\?'my.bundle.id', but found 'my.bundle2.id'."
666672
}
667673

@@ -708,7 +714,7 @@ EOF
708714
}
709715
EOF
710716

711-
! do_build watchos //app:app || fail "Should not build"
717+
! do_build watchos //app:ipa_app || fail "Should not build"
712718
expect_log "While processing target \"@@\?//app:watch_app\"; the Info.plist for child target \"@@\?//app:watch_ext\" has the wrong value for \"NSExtension:NSExtensionAttributes:WKAppBundleIdentifier\"; expected u\?'my.bundle.id.watch-app', but found 'my.bundle2.id.watch-app'."
713719
}
714720

0 commit comments

Comments
 (0)