blob: e993a14f22497558a0fb737c8f3f031f37388e26 [file] [log] [blame]
load("@bazel_gazelle//:def.bzl", "gazelle_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_python//python:defs.bzl", "py_binary")
load(":gazelle_test.bzl", "gazelle_test")
go_library(
name = "python",
srcs = [
"configure.go",
"fix.go",
"generate.go",
"kinds.go",
"language.go",
"lifecycle.go",
"parser.go",
"resolve.go",
"std_modules.go",
"target.go",
],
embedsrcs = [":helper.zip"],
importpath = "github.com/bazelbuild/rules_python/gazelle/python",
visibility = ["//visibility:public"],
deps = [
"//manifest",
"//pythonconfig",
"@bazel_gazelle//config:go_default_library",
"@bazel_gazelle//label:go_default_library",
"@bazel_gazelle//language:go_default_library",
"@bazel_gazelle//repo:go_default_library",
"@bazel_gazelle//resolve:go_default_library",
"@bazel_gazelle//rule:go_default_library",
"@com_github_bazelbuild_buildtools//build:go_default_library",
"@com_github_bmatcuk_doublestar//:doublestar",
"@com_github_emirpasic_gods//lists/singlylinkedlist",
"@com_github_emirpasic_gods//sets/treeset",
"@com_github_emirpasic_gods//utils",
],
)
py_binary(
name = "helper",
srcs = [
"__main__.py",
"parse.py",
"std_modules.py",
],
main = "__main__.py",
visibility = ["//visibility:public"],
)
filegroup(
name = "helper.zip",
srcs = [":helper"],
output_group = "python_zip_file",
)
gazelle_test(
name = "python_test",
srcs = ["python_test.go"],
data = [
":gazelle_binary",
":helper",
],
test_dirs = glob(
# Use this so that we don't need to manually maintain the list.
["testdata/*"],
exclude = ["testdata/*.md"],
# The directories aren't inputs themselves; we just want their
# names.
exclude_directories = 0,
),
deps = [
"@bazel_gazelle//testtools:go_default_library",
"@com_github_ghodss_yaml//:yaml",
"@io_bazel_rules_go//go/runfiles:go_default_library",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)
gazelle_binary(
name = "gazelle_binary",
languages = [":python"],
visibility = ["//visibility:public"],
)
filegroup(
name = "distribution",
srcs = glob(["**"]),
visibility = ["//:__pkg__"],
)