bazelbuild / bazel-skylib

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

Version 1.4.2 is broken in bzlmod #470

Closed luispadron closed 10 months ago

luispadron commented 10 months ago

Using version 1.4.2 of bazel_skylib with a bzlmod enabled project using Bazel 6.4.0, if I run a skylib unittest.bzl target:

ERROR: Tools/Rules/Tests/BUILD.bazel:7:23: While resolving toolchains for target //Tools/Rules/Tests:custom_build_flags_test_alpha_test: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '@bazel_skylib//toolchains/unittest': The repository '@bazel_skylib' could not be resolved: Repository '@bazel_skylib' is not defined
ERROR: Analysis of target '//Tools/Rules/Tests:custom_build_flags_test_alpha_test' failed; build aborted: 
INFO: Elapsed time: 0.185s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
ERROR: Couldn't start the build. Unable to run tests

If I move to 1.4.1 without making any other changes, the build passes:

INFO: Analyzed target //Tools/Rules/Tests:custom_build_flags_test_alpha_test (50 packages loaded, 375 targets configured).
INFO: Found 1 test target...
Target //Tools/Rules/Tests:custom_build_flags_test_alpha_test up-to-date:
  bazel-bin/Tools/Rules/Tests/custom_build_flags_test_alpha_test.sh
INFO: Elapsed time: 0.524s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
//Tools/Rules/Tests:custom_build_flags_test_alpha_test          (cached) PASSED in 0.1s

Executed 0 out of 1 test: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
cgrindel commented 10 months ago

Interesting. We use bazel-skylib in 1.4.2 in rules_swift_package_manager in bzlmod mode.

luispadron commented 10 months ago

It's totally possible I'm missing something but it wasn't clear why I was getting that error between these two versions