-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: feat(gazelle): Move the plugin to a separate workspace
Summary: * Move go.mod to gazelle. * Move gazelle definition. * Move the gazelle plugin to a separate folder, just like bazel-skylib does, which helps with naming of the externally visible targets. * Fix file distribution for the gazelle module. * Update the example test. * Include rules_python_gazelle_plugin during integration tests * Update ignored packages * Update CI configuration
- Loading branch information
Showing
432 changed files
with
295 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
test --test_output=errors | ||
|
||
# Do NOT implicitly create empty __init__.py files in the runfiles tree. | ||
# By default, these are created in every directory containing Python source code | ||
# or shared libraries, and every parent directory of those directories, | ||
# excluding the repo root directory. With this flag set, we are responsible for | ||
# creating (possibly empty) __init__.py files and adding them to the srcs of | ||
# Python targets as required. | ||
build --incompatible_default_to_explicit_init_py | ||
|
||
# Windows makes use of runfiles for some rules | ||
build --enable_runfiles | ||
startup --windows_enable_symlinks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
# Emacs garbage | ||
*~ | ||
|
||
# Bazel directories | ||
/bazel-* | ||
/bazel-bin | ||
/bazel-genfiles | ||
/bazel-out | ||
/bazel-testlogs | ||
user.bazelrc | ||
|
||
# vim swap files | ||
*.swp | ||
*.swo | ||
|
||
# Go/Gazelle files | ||
# These otherwise match patterns above | ||
!go.mod | ||
!BUILD.out | ||
|
||
# Python cache | ||
**/__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,35 @@ | ||
load("@bazel_gazelle//:def.bzl", "gazelle_binary") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
load("@rules_python//python:defs.bzl", "py_binary") | ||
load("@bazel_gazelle//:def.bzl", "gazelle") | ||
|
||
go_library( | ||
name = "gazelle", | ||
srcs = [ | ||
"configure.go", | ||
"fix.go", | ||
"generate.go", | ||
"kinds.go", | ||
"language.go", | ||
"parser.go", | ||
"resolve.go", | ||
"std_modules.go", | ||
"target.go", | ||
], | ||
importpath = "github.com/bazelbuild/rules_python/gazelle", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//gazelle/manifest", | ||
"//gazelle/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", | ||
"@com_github_google_uuid//:uuid", | ||
"@io_bazel_rules_go//go/tools/bazel:go_default_library", | ||
], | ||
) | ||
|
||
py_binary( | ||
name = "parse", | ||
srcs = ["parse.py"], | ||
visibility = ["//visibility:public"], | ||
) | ||
# Gazelle configuration options. | ||
# See https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel | ||
# gazelle:prefix github.com/bazelbuild/rules_python/gazelle | ||
# gazelle:exclude bazel-out | ||
gazelle(name = "gazelle") | ||
|
||
py_binary( | ||
name = "std_modules", | ||
srcs = ["std_modules.py"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_test( | ||
name = "gazelle_test", | ||
srcs = ["python_test.go"], | ||
data = [ | ||
":gazelle_python_binary", | ||
":parse", | ||
":std_modules", | ||
] + glob(["testdata/**"]), | ||
deps = [ | ||
"@bazel_gazelle//testtools:go_default_library", | ||
"@com_github_emirpasic_gods//lists/singlylinkedlist", | ||
"@com_github_ghodss_yaml//:yaml", | ||
"@io_bazel_rules_go//go/tools/bazel:go_default_library", | ||
gazelle( | ||
name = "gazelle_update_repos", | ||
args = [ | ||
"-from_file=go.mod", | ||
"-to_macro=deps.bzl%gazelle_deps", | ||
"-prune", | ||
], | ||
) | ||
|
||
gazelle_binary( | ||
name = "gazelle_python_binary", | ||
languages = ["//gazelle"], | ||
visibility = ["//visibility:public"], | ||
command = "update-repos", | ||
) | ||
|
||
filegroup( | ||
name = "distribution", | ||
srcs = glob(["**"]) + [ | ||
"//gazelle/manifest:distribution", | ||
"//gazelle/modules_mapping:distribution", | ||
"//gazelle/pythonconfig:distribution", | ||
srcs = [ | ||
":BUILD.bazel", | ||
":README.md", | ||
":WORKSPACE", | ||
":def.bzl", | ||
":deps.bzl", | ||
":go.mod", | ||
":go.sum", | ||
"//manifest:distribution", | ||
"//modules_mapping:distribution", | ||
"//python:distribution", | ||
"//pythonconfig:distribution", | ||
], | ||
visibility = ["//:__pkg__"], | ||
visibility = ["@rules_python//:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.