bazelbuild / bazel-skylib

Common useful functions and rules for Bazel
https://bazel.build/
Apache License 2.0
393 stars 180 forks source link

Allow `bzl_library` to depend on non-`bzl_library` targets #495

Closed Wyverald closed 5 months ago

Wyverald commented 5 months ago

Notably, filegroup. bzl_library doesn't actually read anything from the StarlarkLibraryInfo provider, and requiring all deps to be other bzl_library targets is really painful for anyone loading .bzls from @bazel_tools or @platforms because those core modules/repos don't want a dependency on Skylib just for access to bzl_library.

The medium-term plan will be to move bzl_library into @bazel_tools; but before then, this can serve as a stop-gap.

Wyverald commented 5 months ago

As far as I can see, the test doesn't test the new change.

doesn't :b_fg (which depends on :a_fg, a filegroup) test it?

tetromino commented 5 months ago

As far as I can see, the test doesn't test the new change.

doesn't :b_fg (which depends on :a_fg, a filegroup) test it?

It doesn't test the content of the providers.

If you want, I can push a commit to this PR to make the test cover this.

Wyverald commented 5 months ago

If you want, I can push a commit to this PR to make the test cover this.

if you have time, that'd be great! otherwise, I can get to it later today.

Wyverald commented 5 months ago

Done now.

tetromino commented 5 months ago

Done now.

I was in the process of writing a slightly more universal variation on the same theme, using skylib's standard analysistest machinery; I pushed that since I think it provides a useful example for analysistest usage.