bazelbuild / rules_apple

Bazel rules to build apps for Apple platforms.
Apache License 2.0
509 stars 264 forks source link

bazel builds failed and reports an error with rules_apple version 2.4.1 and version 2.4.0 #2018

Open uiChuanqi opened 1 year ago

uiChuanqi commented 1 year ago

Hi, guys,

I found the rules_apple version has upgrade to 2.4.1 this morning, so i changed the version in my WORKSPACE from 2.1.0 to 2.4.1, however when i execute "bazel build //SampleApp:SampleApp" as usual, it reports an error as below,

2 4 1

then i degrade the version to 2.4.0, it also gives this error:

2 4 0_2023-07-14 11 46 48

but when i changed the version to 2.3.0, this error disappears, and it also works well when i change it to version 2.2.0,

2 3 0_2023-07-14 11 48 04

I don't know what happened, so i remain my rules_apple at version 2.3.0.

Maybe you'd better check the the release message and compare the codes of version 2.4.0 to get some clues, Regards.

thii commented 1 year ago

Can you share the SampleApp?

uiChuanqi commented 1 year ago

Can you share the SampleApp?

OK, here is the project SampleApp

thii commented 1 year ago

For your example, I'd suggest using swiftc_inputs instead of data if you want to include additional files in compile actions. Try this:

diff --git c/SampleApp/BUILD i/SampleApp/BUILD
index 3136ddc..2fac22a 100644
--- c/SampleApp/BUILD
+++ i/SampleApp/BUILD
@@ -22,8 +22,7 @@ swift_library(
         "-import-objc-header",
         "$(location :OCClasses/BridgeHeader.h)",
     ],
-    swiftc_inputs = [":OCClasses/BridgeHeader.h"],
-    data = glob(["OCClasses/*.h"]) ,
+    swiftc_inputs = glob(["OCClasses/*.h"]),
     visibility = ["//visibility:public"],
 )