From aaf89ce7b3d54e46b118e0c288a6f9d77167ba86 Mon Sep 17 00:00:00 2001 From: Wiley Kestner Date: Fri, 10 Apr 2020 11:28:31 -0400 Subject: [PATCH 1/4] Add test fixture that fails to build: ResourcesAddedToBundle target - To see the bazel failure run: `bazel test //tests/test/ios:ResourcesAddedToUnitTestBundle` - This test fixture fails because we pass the `resources` keyword argument from the `rules_ios` `ios_unit_test` macro directly to the `swift_library` rule vended by `bazelbuild/rules_swift` as well as to Bazel's native `objc_library` rule. Neither of the signatures of these rule functions allow an argument named `resources`. --- tests/test/ios/BUILD.bazel | 10 ++++++++++ tests/test/ios/resource-file.txt | 1 + 2 files changed, 11 insertions(+) create mode 100644 tests/test/ios/resource-file.txt diff --git a/tests/test/ios/BUILD.bazel b/tests/test/ios/BUILD.bazel index 3ebc7bd5d..0f67113fa 100644 --- a/tests/test/ios/BUILD.bazel +++ b/tests/test/ios/BUILD.bazel @@ -28,3 +28,13 @@ ios_unit_test( minimum_os_version = "12.0", test_host = "//rules/test_host_app:iOS-9.3-AppHost", ) + +ios_unit_test( + name = "ResourcesAddedToUnitTestBundle", + srcs = [ + "empty.m", + "empty.swift", + ], + resources = ["resource-file.txt"], + minimum_os_version = "11.0", +) \ No newline at end of file diff --git a/tests/test/ios/resource-file.txt b/tests/test/ios/resource-file.txt new file mode 100644 index 000000000..a9a1fb1cc --- /dev/null +++ b/tests/test/ios/resource-file.txt @@ -0,0 +1 @@ +I am an example resource file that is meant to be added to a unit test bundle. \ No newline at end of file From eaedd991bd0dc71675040ec85811eb2b911fdd49 Mon Sep 17 00:00:00 2001 From: Wiley Kestner Date: Fri, 10 Apr 2020 11:41:50 -0400 Subject: [PATCH 2/4] Fix failing test - Pass the `resources` argument from the `rules_ios` `ios_unit_test` macro into the `ios_unit_test` rule vended by `build_bazel/rules_apple` - Ensure the `resources` argument from the `rules_ios` `ios_unit_test` macro does not get passed along to `swift_library` and `objc_library` - To see the test pass run: `bazel test //tests/test/ios:ResourcesAddedToUnitTestBundle` - Closes: #35 --- rules/test.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/test.bzl b/rules/test.bzl index db4598cb6..1bf9be4ec 100644 --- a/rules/test.bzl +++ b/rules/test.bzl @@ -12,6 +12,7 @@ _IOS_UNIT_TEST_KWARGS = [ "size", "timeout", "visibility", + "resources", ] def ios_unit_test(name, apple_library = apple_library, **kwargs): From a785ab165ce03acde095a4a8750a1a57fc68ead4 Mon Sep 17 00:00:00 2001 From: Wiley Kestner Date: Fri, 10 Apr 2020 15:05:26 -0400 Subject: [PATCH 3/4] Add newline at the end of a Bazel build file --- tests/test/ios/BUILD.bazel | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test/ios/BUILD.bazel b/tests/test/ios/BUILD.bazel index 0f67113fa..1e0e036ad 100644 --- a/tests/test/ios/BUILD.bazel +++ b/tests/test/ios/BUILD.bazel @@ -37,4 +37,5 @@ ios_unit_test( ], resources = ["resource-file.txt"], minimum_os_version = "11.0", -) \ No newline at end of file +) + From a5d61d820a87c89219477dc8be2e10219b873752 Mon Sep 17 00:00:00 2001 From: Wiley Kestner Date: Fri, 10 Apr 2020 15:12:56 -0400 Subject: [PATCH 4/4] Change argument order to satisfy buildifier rules --- tests/test/ios/BUILD.bazel | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test/ios/BUILD.bazel b/tests/test/ios/BUILD.bazel index 1e0e036ad..325efd453 100644 --- a/tests/test/ios/BUILD.bazel +++ b/tests/test/ios/BUILD.bazel @@ -35,7 +35,6 @@ ios_unit_test( "empty.m", "empty.swift", ], - resources = ["resource-file.txt"], minimum_os_version = "11.0", + resources = ["resource-file.txt"], ) -