bazel
bazel copied to clipboard
Unable to depend on cc_library from objc_library
Is there a way to use a cc_library in both a cc_binary and an objc_binary other than adding an objc_library for the cc_library?
Sample build command output:
bazel build examples/objc:PrenotCalculatorClasses
ERROR: /Users/trevorgray/code/src/github.com/google/bazel/examples/objc/BUILD:45:12: in deps attribute of objc_library rule //examples/objc:PrenotCalculatorClasses: cc_library rule '//examples/cpp:hello-lib' is misplaced here (expected objc_library, objc_import, objc_framework, objc_proto_library or j2objc_library).
ERROR: Analysis of target '//examples/objc:PrenotCalculatorClasses' failed; build aborted.
INFO: Elapsed time: 0.285s
Build rule:
objc_library(
name = "PrenotCalculatorClasses",
srcs = [
"PrenotCalculator/AppDelegate.m",
"PrenotCalculator/CalculatedValues.m",
"PrenotCalculator/CalculatorViewController.m",
"PrenotCalculator/CoreData.m",
"PrenotCalculator/Equation.m",
"PrenotCalculator/Literal.m",
"PrenotCalculator/ValuesViewController.m",
],
hdrs = glob(
["**/*.h"],
exclude = ["PrenotCalculator/Expression.h"],
),
bundles = [":PrenotCalculatorResources"],
sdk_frameworks = ["CoreData"],
xibs = ["PrenotCalculator/CalculatorViewController.xib"],
deps = [
":CoreDataResources",
":ExpressionPrebuilt",
"//examples/cpp:hello-lib",
],
)
I thought there was a feature request for that already, but apparently not. In any case, this is (one of) the highest priority items for us, but it's a bit tricky to make work properly.
+1
@ulfjack Can someone more experienced with our iOS stuff have a look at this?
This should be possible these days, this feature was introduced a while back.