jvolkman / rules_pycross

Bazel + Python rules for cross-platform external dependencies
Apache License 2.0
60 stars 23 forks source link

[Feature Request] Missing CcInfo when used with starlark-based python rules #107

Closed tgeng closed 4 months ago

tgeng commented 4 months ago

Looks like pycross_wheel_build doesn't provide CcInfo, which is required when using new starlark-based python rules from rules_python 0.31 or above.

jvolkman commented 4 months ago

Which rules are expecting CcInfo?

tgeng commented 4 months ago

The new py_library and py_binary, etc. See https://github.com/bazelbuild/rules_python/blob/aeba7163e24274ea448aa77e242177d08de45bcb/python/private/common/attributes.bzl#L262

You can repro the problem by updating rules_python to 0.31.0 or later.

jvolkman commented 4 months ago

From your link:

"deps": attr.label_list(
    providers = [
        [PyInfo],
        [CcInfo],
        [BuiltinPyInfo],
    ],

This means that each entry can be any of those providers, not all. providers = [[PyInfo, CcInfo, BuiltinPyInfo]] would mean all three providers would need to be present.

The doc for providers:

The format of this argument is a list of lists of providers -- *Info objects returned by provider() (or in the case of a legacy provider, its string name). The dependency must return ALL providers mentioned in at least ONE of the inner lists. As a convenience, this argument may also be a single-level list of providers, in which case it is wrapped in an outer list with one element. It is NOT required that the rule of the dependency advertises those providers in its provides parameter, however, it is considered best practice.

The tests under e2e/bzlmod already run against rules_python 0.3.1.

tgeng commented 4 months ago

ah... I misunderstood how this works... The issue is due to I am not using py_library from rules_python. Sorry about the false alarm!