bzl gazelle support overwrite resolve
This commit is contained in:
parent
5c071b5006
commit
4a79cf5421
|
@ -152,6 +152,13 @@ func (*bzlLibraryLang) Resolve(c *config.Config, ix *resolve.RuleIndex, rc *repo
|
|||
|
||||
deps := make([]string, 0, len(imports))
|
||||
for _, imp := range imports {
|
||||
|
||||
if l, ok := resolve.FindRuleWithOverride(c, resolve.ImportSpec{Lang: languageName, Imp: imp}, languageName); ok {
|
||||
depLabel := l.Rel(from.Repo, from.Pkg)
|
||||
deps = append(deps, depLabel.String())
|
||||
continue
|
||||
}
|
||||
|
||||
impLabel, err := label.Parse(imp)
|
||||
if err != nil {
|
||||
log.Printf("%s: import of %q is invalid: %v", from.String(), imp, err)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# Some comment to be preserved
|
||||
|
||||
# gazelle:resolve starlark starlark //internal:defs.bzl //internal:defs_bzl
|
||||
|
||||
filegroup(
|
||||
name = "allfiles",
|
||||
srcs = glob(["**"]),
|
||||
)
|
|
@ -0,0 +1,17 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
|
||||
# Some comment to be preserved
|
||||
|
||||
# gazelle:resolve starlark starlark //internal:defs.bzl //internal:defs_bzl
|
||||
|
||||
filegroup(
|
||||
name = "allfiles",
|
||||
srcs = glob(["**"]),
|
||||
)
|
||||
|
||||
bzl_library(
|
||||
name = "foo",
|
||||
srcs = ["foo.bzl"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//internal:defs_bzl"],
|
||||
)
|
|
@ -0,0 +1,7 @@
|
|||
"""
|
||||
Doc string
|
||||
"""
|
||||
|
||||
load("//internal:defs.bzl", "deps")
|
||||
|
||||
deps()
|
|
@ -0,0 +1,7 @@
|
|||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
|
||||
bzl_library(
|
||||
name = "deps_bzl",
|
||||
srcs = ["deps.bzl"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
|
@ -0,0 +1,6 @@
|
|||
"""
|
||||
Simple deps
|
||||
"""
|
||||
|
||||
def deps():
|
||||
pass
|
Loading…
Reference in New Issue