bazel-mypy-integration icon indicating copy to clipboard operation
bazel-mypy-integration copied to clipboard

Error: Repository '@buildifier _prebuilt' is not defined

Open harrysarson opened this issue 1 year ago β€’ 1 comments

Hi, when I upgraded this repo from 0.2.1 to 0.4.0 I started getting the following build error:

INFO: Invocation ID: 3ac6f011-c75e-44e9-be22-5c78d2ade8f6
ERROR: /home/dummy/BUILD:27:
12: every rule of type mypy_test implicitly depends upon the target 
'@mypy_integration//:mypy_config', but this target could not be foun
d because of: error loading package '@mypy_integration//': Unable to
 find package for @buildifier_prebuilt//:rules.bzl: The repository '
@buildifier_prebuilt' could not be resolved: Repository '@buildifier
_prebuilt' is not defined.
ERROR: Analysis of target '//dummy:test_mypy' fa
iled; build aborted: Analysis failed

I can fix the errors by patching this repo as follows. Obviously these lines are there for a reason and I am not saying you should comment them out, just hoping this might help pinpoint the error.

diff --git a/BUILD b/BUILD
index c25a0c6..b426456 100644
--- a/BUILD
+++ b/BUILD
@@ -1,18 +1,18 @@
-load("@buildifier_prebuilt//:rules.bzl", "buildifier")
+# load("@buildifier_prebuilt//:rules.bzl", "buildifier")
 
 package(default_visibility = ["//visibility:private"])
 
-buildifier(
-    name = "buildifier.check",
-    lint_mode = "warn",
-    mode = "diff",
-)
+# buildifier(
+#     name = "buildifier.check",
+#     lint_mode = "warn",
+#     mode = "diff",
+# )
 
-buildifier(
-    name = "buildifier",
-    lint_mode = "fix",
-    mode = "fix",
-)
+# buildifier(
+#     name = "buildifier",
+#     lint_mode = "fix",
+#     mode = "fix",
+# )
 
 licenses(["notice"])  # MIT
 

harrysarson avatar Aug 11 '22 14:08 harrysarson

I'm affected by the same issue

mbkroese avatar Aug 30 '22 09:08 mbkroese

Me too, any status on this?

mattstruble avatar Sep 11 '22 15:09 mattstruble

Adding the snippet of the buildifier-prebuillt right before the mypy snippet inside the WORKSPACE fixed it for me:

http_archive(
    name = "buildifier_prebuilt",
    sha256 = "b3fd85ae7e45c2f36bce52cfdbdb6c20261761ea5928d1686edc8873b0d0dad0",
    strip_prefix = "buildifier-prebuilt-5.1.0",
    urls = [
        "http://github.com/keith/buildifier-prebuilt/archive/5.1.0.tar.gz",
    ],
)

load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

buildifier_prebuilt_deps()

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")

buildifier_prebuilt_register_toolchains()

FBorowiec avatar Sep 27 '22 10:09 FBorowiec

For others, this fix is in on main, and not in a cut release (as of 0.4.0)

dmadisetti avatar Feb 26 '23 20:02 dmadisetti

Oh, sorry about that, I'll cut a release now

alexeagle avatar Feb 27 '23 01:02 alexeagle

@dmadisetti @alexeagle Is this issue fixed in the latest release (0.4.0)?

arahatashun avatar Jul 01 '23 05:07 arahatashun