Skip to content

Commit a5c6700

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

8 files changed

Lines changed: 77 additions & 12 deletions

File tree

test/apple_core_ml_library_package_test.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function tear_down() {
2929
# Creates common source, targets, and basic plist for macOS loadable bundles.
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:ios.bzl", "ios_application")
3334
load(
3435
"@build_bazel_rules_apple//apple:resources.bzl",
@@ -73,6 +74,11 @@ ios_application(
7374
minimum_os_version = "${MIN_OS_IOS}",
7475
deps = [":app_lib"],
7576
)
77+
78+
apple_archive(
79+
name = "ipa_app",
80+
bundle = ":app",
81+
)
7682
EOF
7783

7884
cat > app/main.m <<EOF
@@ -119,7 +125,7 @@ EOF
119125
function test_mlmodel_builds() {
120126
create_common_files
121127

122-
do_build ios //app:app || fail "Should build"
128+
do_build ios //app:ipa_app || fail "Should build"
123129

124130
assert_zip_contains "test-bin/app/app.ipa" "Payload/app.app/sample.mlmodelc/"
125131
}

test/apple_core_ml_resource_test.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function tear_down() {
2929
# Creates common source, targets, and basic plist for iOS 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:ios.bzl", "ios_application")
3334
load(
3435
"@build_bazel_rules_apple//apple:resources.bzl",
@@ -58,6 +59,11 @@ ios_application(
5859
minimum_os_version = "${MIN_OS_IOS}",
5960
deps = [":app_lib"],
6061
)
62+
63+
apple_archive(
64+
name = "ipa_app",
65+
bundle = ":app",
66+
)
6167
EOF
6268

6369
cat > app/AppDelegate.swift <<EOF
@@ -84,7 +90,7 @@ EOF
8490
function test_mlmodel_resource_bundle_builds() {
8591
create_common_files
8692

87-
do_build ios //app:app || fail "Should build"
93+
do_build ios //app:ipa_app || fail "Should build"
8894

8995
assert_zip_contains "test-bin/app/app.ipa" "Payload/app.app/App_Resources.bundle/sample.mlmodelc/"
9096
}

test/apple_intent_library_test.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function tear_down() {
3030
# swift_intent_library in an iOS app.
3131
function create_common_files() {
3232
cat > app/BUILD <<EOF
33+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
3334
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
3435
load("@build_bazel_rules_apple//apple:resources.bzl", "objc_intent_library", "swift_intent_library")
3536
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
@@ -54,6 +55,11 @@ ios_application(
5455
deps = [":objc_lib"],
5556
)
5657
58+
apple_archive(
59+
name = "ipa_app_objc",
60+
bundle = ":app_objc",
61+
)
62+
5763
swift_intent_library(
5864
name = "SampleIntentSwift",
5965
src = "@build_bazel_rules_apple//test/testdata/resources:intent.intentdefinition",
@@ -73,6 +79,11 @@ ios_application(
7379
minimum_os_version = "${MIN_OS_IOS}",
7480
deps = [":swift_lib"],
7581
)
82+
83+
apple_archive(
84+
name = "ipa_app_swift",
85+
bundle = ":app_swift",
86+
)
7687
EOF
7788

7889
cat > app/objc_lib.m <<EOF
@@ -119,10 +130,10 @@ function test_intentdefinition_builds() {
119130
create_common_files
120131
pwd
121132

122-
do_build ios //app:app_objc || fail "Should build"
133+
do_build ios //app:ipa_app_objc || fail "Should build"
123134
assert_zip_contains "test-bin/app/app_objc.ipa" "Payload/app_objc.app/intent.intentdefinition"
124135

125-
do_build ios //app:app_swift || fail "Should build"
136+
do_build ios //app:ipa_app_swift || fail "Should build"
126137
assert_zip_contains "test-bin/app/app_swift.ipa" "Payload/app_swift.app/intent.intentdefinition"
127138
}
128139

test/apple_metal_library_test.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function tear_down() {
2929
# Creates common source and targets for apple_metal_library in an iOS app.
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:ios.bzl", "ios_application")
3334
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_metal_library")
3435
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
@@ -55,6 +56,11 @@ ios_application(
5556
deps = [":objc_lib"],
5657
)
5758
59+
apple_archive(
60+
name = "ipa_app_objc",
61+
bundle = ":app_objc",
62+
)
63+
5864
swift_library(
5965
name = "swift_lib",
6066
srcs = ["swift_lib.swift"],
@@ -69,6 +75,11 @@ ios_application(
6975
minimum_os_version = "${MIN_OS_IOS}",
7076
deps = [":swift_lib"],
7177
)
78+
79+
apple_archive(
80+
name = "ipa_app_swift",
81+
bundle = ":app_swift",
82+
)
7283
EOF
7384

7485
cat > app/objc_lib.m <<EOF
@@ -114,10 +125,10 @@ function test_intentdefinition_builds() {
114125
create_common_files
115126
pwd
116127

117-
do_build ios //app:app_objc || fail "Should build"
128+
do_build ios //app:ipa_app_objc || fail "Should build"
118129
assert_zip_contains "test-bin/app/app_objc.ipa" "Payload/app_objc.app/default.metallib"
119130

120-
do_build ios //app:app_swift || fail "Should build"
131+
do_build ios //app:ipa_app_swift || fail "Should build"
121132
assert_zip_contains "test-bin/app/app_swift.ipa" "Payload/app_swift.app/default.metallib"
122133
}
123134

test/ios_imessage_test.sh

Lines changed: 13 additions & 2 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 iOS 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(
3334
"@build_bazel_rules_apple//apple:ios.bzl",
3435
"ios_application",
@@ -102,6 +103,11 @@ ios_application(
102103
deps = [":lib"],
103104
)
104105
106+
apple_archive(
107+
name = "ipa_app",
108+
bundle = ":app",
109+
)
110+
105111
ios_sticker_pack_extension(
106112
name = "stickerpack",
107113
bundle_id = "my.bundle.id.extension",
@@ -134,6 +140,11 @@ ios_imessage_application(
134140
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_ios.mobileprovision",
135141
)
136142
143+
apple_archive(
144+
name = "ipa_app",
145+
bundle = ":app",
146+
)
147+
137148
ios_sticker_pack_extension(
138149
name = "stickerpack",
139150
bundle_id = "my.bundle.id.extension",
@@ -153,7 +164,7 @@ function test_sticker_pack_extension() {
153164
create_common_files
154165
create_minimal_ios_application_with_stickerpack
155166

156-
do_build ios //app:app || fail "Should build"
167+
do_build ios //app:ipa_app || fail "Should build"
157168

158169
# Ignore the check for simulator builds.
159170
is_device_build ios || return 0
@@ -169,7 +180,7 @@ function test_sticker_pack_builds_with_stickersiconset() {
169180

170181
create_minimal_ios_application_with_stickerpack
171182

172-
do_build ios //app:app || fail "Should build"
183+
do_build ios //app:ipa_app || fail "Should build"
173184

174185
# TODO(b/120618397): Reenable these assertions.
175186
# assert_zip_contains "test-bin/app/app.ipa" \

test/smart_resource_deduplication_test.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ I am referenced by a resource only objc_library;
6161
EOF
6262

6363
cat > app/BUILD <<EOF
64+
load("@build_bazel_rules_apple//apple:apple_archive.bzl", "apple_archive")
6465
load("@build_bazel_rules_apple//apple:ios.bzl",
6566
"ios_application", "ios_framework")
6667
@@ -136,9 +137,14 @@ ios_application(
136137
strings = ["app.strings"],
137138
deps = [":app_lib"],
138139
)
140+
141+
apple_archive(
142+
name = "ipa_app",
143+
bundle = ":app",
144+
)
139145
EOF
140146

141-
do_build ios //app:app || fail "Should build"
147+
do_build ios //app:ipa_app || fail "Should build"
142148

143149
# Verify framework has resources
144150
assert_assets_contains "test-bin/app/app.ipa" \
@@ -213,9 +219,14 @@ ios_application(
213219
strings = ["app.strings"],
214220
deps = [":app_lib_with_no_direct_resources"],
215221
)
222+
223+
apple_archive(
224+
name = "ipa_app",
225+
bundle = ":app",
226+
)
216227
EOF
217228

218-
do_build ios //app:app || fail "Should build"
229+
do_build ios //app:ipa_app || fail "Should build"
219230

220231
# This is a tricky corner case, in which a resource only lib is depended by
221232
# dependency chains that contain no other resources. In this very specific
@@ -251,9 +262,14 @@ ios_application(
251262
minimum_os_version = "${MIN_OS_IOS}",
252263
deps = [":resource_only_lib", ":shared_lib", ":only_main_lib"],
253264
)
265+
266+
apple_archive(
267+
name = "ipa_app",
268+
bundle = ":app",
269+
)
254270
EOF
255271

256-
do_build ios //app:app || fail "Should build"
272+
do_build ios //app:ipa_app || fail "Should build"
257273

258274
# Verify that the resource is in the framework.
259275
assert_zip_contains "test-bin/app/app.ipa" \

test/starlark_tests/targets_under_test/ios/BUILD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5605,6 +5605,10 @@ apple_archive(
56055605
name = "ipa_with_app",
56065606
bundle = ":app",
56075607
tags = common.fixture_tags,
5608+
visibility = [
5609+
"//test/starlark_tests:__subpackages__",
5610+
"//tools/dossier_codesigningtool:__pkg__",
5611+
],
56085612
)
56095613

56105614
apple_archive(

tools/dossier_codesigningtool/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ py_test(
6565
srcs = ["dossier_codesigning_reader_test.py"],
6666
data = [
6767
":watchos_dossier_zip",
68-
"//test/starlark_tests/targets_under_test/ios:app",
68+
"//test/starlark_tests/targets_under_test/ios:ipa_with_app",
6969
"//test/starlark_tests/targets_under_test/watchos:ipa_app_companion",
7070
],
7171
python_version = "PY3",

0 commit comments

Comments
 (0)