Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gazelle/bzl/gazelle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions gazelle/bzl/testdata/resolve_overwrite/BUILD.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Some comment to be preserved

# gazelle:resolve starlark starlark //internal:defs.bzl //internal:defs_bzl

filegroup(
name = "allfiles",
srcs = glob(["**"]),
)
17 changes: 17 additions & 0 deletions gazelle/bzl/testdata/resolve_overwrite/BUILD.out
Original file line number Diff line number Diff line change
@@ -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"],
)
Empty file.
7 changes: 7 additions & 0 deletions gazelle/bzl/testdata/resolve_overwrite/foo.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
Doc string
"""

load("//internal:defs.bzl", "deps")

deps()
7 changes: 7 additions & 0 deletions gazelle/bzl/testdata/resolve_overwrite/internal/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "defs_bzl",
srcs = ["defs.bzl"],
visibility = ["//:__subpackages__"],
)
6 changes: 6 additions & 0 deletions gazelle/bzl/testdata/resolve_overwrite/internal/defs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
Simple deps
"""

def deps():
pass