Skip to content

Commit 4dff9f6

Browse files
committed
Fix more tests
1 parent 9a0639c commit 4dff9f6

8 files changed

Lines changed: 74 additions & 10 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",
@@ -74,6 +75,11 @@ ios_application(
7475
minimum_os_version = "${MIN_OS_IOS}",
7576
deps = [":app_lib"],
7677
)
78+
79+
apple_archive(
80+
name = "ipa_app",
81+
bundle = ":app",
82+
)
7783
EOF
7884

7985
cat > app/main.m <<EOF
@@ -120,7 +126,7 @@ EOF
120126
function test_mlmodel_builds() {
121127
create_common_files
122128

123-
do_build ios //app:app || fail "Should build"
129+
do_build ios //app:ipa_app || fail "Should build"
124130

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

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")
@@ -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_intent_library(
5965
name = "SampleIntentSwift",
6066
src = "@build_bazel_rules_apple//test/testdata/resources:intent.intentdefinition",
@@ -74,6 +80,11 @@ ios_application(
7480
minimum_os_version = "${MIN_OS_IOS}",
7581
deps = [":swift_lib"],
7682
)
83+
84+
apple_archive(
85+
name = "ipa_app_swift",
86+
bundle = ":app_swift",
87+
)
7788
EOF
7889

7990
cat > app/objc_lib.m <<EOF
@@ -120,10 +131,10 @@ function test_intentdefinition_builds() {
120131
create_common_files
121132
pwd
122133

123-
do_build ios //app:app_objc || fail "Should build"
134+
do_build ios //app:ipa_app_objc || fail "Should build"
124135
assert_zip_contains "test-bin/app/app_objc.ipa" "Payload/app_objc.app/intent.intentdefinition"
125136

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

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")
@@ -56,6 +57,11 @@ ios_application(
5657
deps = [":objc_lib"],
5758
)
5859
60+
apple_archive(
61+
name = "ipa_app_objc",
62+
bundle = ":app_objc",
63+
)
64+
5965
swift_library(
6066
name = "swift_lib",
6167
srcs = ["swift_lib.swift"],
@@ -70,6 +76,11 @@ ios_application(
7076
minimum_os_version = "${MIN_OS_IOS}",
7177
deps = [":swift_lib"],
7278
)
79+
80+
apple_archive(
81+
name = "ipa_app_swift",
82+
bundle = ":app_swift",
83+
)
7384
EOF
7485

7586
cat > app/objc_lib.m <<EOF
@@ -115,10 +126,10 @@ function test_intentdefinition_builds() {
115126
create_common_files
116127
pwd
117128

118-
do_build ios //app:app_objc || fail "Should build"
129+
do_build ios //app:ipa_app_objc || fail "Should build"
119130
assert_zip_contains "test-bin/app/app_objc.ipa" "Payload/app_objc.app/default.metallib"
120131

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

test/ios_imessage_test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ ios_application(
113113
deps = [":lib"],
114114
)
115115
116+
apple_archive(
117+
name = "ipa_app",
118+
bundle = ":app",
119+
)
120+
116121
ios_sticker_pack_extension(
117122
name = "stickerpack",
118123
bundle_id = "my.bundle.id.extension",
@@ -147,6 +152,11 @@ ios_imessage_application(
147152
provisioning_profile = "@build_bazel_rules_apple//test/testdata/provisioning:integration_testing_ios.mobileprovision",
148153
)
149154
155+
apple_archive(
156+
name = "ipa_app",
157+
bundle = ":app",
158+
)
159+
150160
ios_sticker_pack_extension(
151161
name = "stickerpack",
152162
bundle_id = "my.bundle.id.extension",

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
load("@rules_cc//cc:objc_library.bzl", "objc_library")
@@ -137,9 +138,14 @@ ios_application(
137138
strings = ["app.strings"],
138139
deps = [":app_lib"],
139140
)
141+
142+
apple_archive(
143+
name = "ipa_app",
144+
bundle = ":app",
145+
)
140146
EOF
141147

142-
do_build ios //app:app || fail "Should build"
148+
do_build ios //app:ipa_app || fail "Should build"
143149

144150
# Verify framework has resources
145151
assert_assets_contains "test-bin/app/app.ipa" \
@@ -214,9 +220,14 @@ ios_application(
214220
strings = ["app.strings"],
215221
deps = [":app_lib_with_no_direct_resources"],
216222
)
223+
224+
apple_archive(
225+
name = "ipa_app",
226+
bundle = ":app",
227+
)
217228
EOF
218229

219-
do_build ios //app:app || fail "Should build"
230+
do_build ios //app:ipa_app || fail "Should build"
220231

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

257-
do_build ios //app:app || fail "Should build"
273+
do_build ios //app:ipa_app || fail "Should build"
258274

259275
# Verify that the resource is in the framework.
260276
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
@@ -5790,6 +5790,10 @@ apple_archive(
57905790
name = "ipa_with_app",
57915791
bundle = ":app",
57925792
tags = common.fixture_tags,
5793+
visibility = [
5794+
"//test/starlark_tests:__subpackages__",
5795+
"//tools/dossier_codesigningtool:__pkg__",
5796+
],
57935797
)
57945798

57955799
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)