Skip to content
Draft
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
9 changes: 9 additions & 0 deletions .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
workspaces:
.:
icon: deer
tasks:
- gazelle:
without: true
common:
tasks:
- buildifier:
without: true
language/js:
tasks:
- buildifier:
Expand All @@ -20,6 +27,8 @@ workspaces:
without: true
runner/e2e/bin:
tasks:
- gazelle:
without: true
- buildifier:
without: true
tasks:
Expand Down
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
common
language
runner

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/bazel-*
/common/bazel-*
/runner/bazel-*
/runner/e2e/*/bazel-*
/language/*/bazel-*
Expand Down
24 changes: 0 additions & 24 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
load("@gazelle//:def.bzl", "gazelle", "gazelle_binary")

gazelle_binary(
name = "gazelle_bin",
languages = [
"@gazelle//language/go:go_default_library",
],

# Public for use in sub-MODULEs
visibility = ["//visibility:public"],
)

gazelle(
name = "gazelle",
extra_args = ["-index=lazy"],
gazelle = ":gazelle_bin",
)

gazelle(
name = "gazelle.check",
gazelle = ":gazelle_bin",
mode = "diff",
)

alias(
name = "format",
actual = "//tools/format",
Expand Down
138 changes: 15 additions & 123 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,137 +1,29 @@
module(
name = "aspect_gazelle",
compatibility_level = 0,
module(name = "aspect_gazelle_workspace")

bazel_dep(name = "aspect_gazelle", version = "0.0.0")
local_path_override(
module_name = "aspect_gazelle",
path = "common",
)

bazel_dep(name = "rules_go", version = "0.60.0")
bazel_dep(name = "gazelle", version = "0.47.0") # must match go.mod

# Go modules
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//common:go.mod")
use_repo(go_deps, "com_github_bazelbuild_buildtools", "com_github_bmatcuk_doublestar_v4", "com_github_emirpasic_gods_v2", "com_github_onsi_gomega", "com_github_smacker_go_tree_sitter", "in_gopkg_op_go_logging_v1")

# tree-sitter languages
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "tree-sitter-go",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-M7w7RN4de4FfUv6fQuSXhsWDPZGB/Vn9aRDBnIJVkik=",
urls = ["https://github.com/tree-sitter/tree-sitter-go/releases/download/v0.23.4/tree-sitter-go.tar.xz"],
)

http_archive(
name = "tree-sitter-java",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "ed766e1045be236e50a7f99295996f6705d7506628b79af80d1fd5efb63c86a7",
urls = ["https://github.com/tree-sitter/tree-sitter-java/releases/download/v0.23.5/tree-sitter-java.tar.xz"],
)

http_archive(
name = "tree-sitter-json",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "acf6e8362457e819ed8b613f2ad9a0e1b621a77556c296f3abea58f7880a9213",
strip_prefix = "tree-sitter-json-0.24.8",
urls = ["https://github.com/tree-sitter/tree-sitter-json/archive/v0.24.8.tar.gz"],
)

http_archive(
name = "tree-sitter-kotlin",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "666c67f4486d6f7ebeb6418a956f3d7599b3e200e42fe583312c92182ce731d0",
strip_prefix = "tree-sitter-kotlin-6b9788578ae23a1bc7c87e8d564e0daf7671dee3",
urls = ["https://github.com/fwcd/tree-sitter-kotlin/archive/6b9788578ae23a1bc7c87e8d564e0daf7671dee3.tar.gz"],
)

http_archive(
name = "tree-sitter-starlark",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "31c58a540d738a17b366f2046da298b66dfa0695bcbfa207f61fa63cfe5c03ed",
strip_prefix = "tree-sitter-starlark-1.3.0",
urls = ["https://github.com/tree-sitter-grammars/tree-sitter-starlark/archive/v1.3.0.tar.gz"],
)

http_archive(
name = "tree-sitter-typescript",
build_file_content = """
filegroup(
name = "typescript-srcs",
srcs = glob(["common/**/*.h", "typescript/src/**/*.h", "typescript/src/**/*.c"]),
visibility = ["//visibility:public"],
)
filegroup(
name = "tsx-srcs",
srcs = glob(["common/**/*.h", "tsx/src/**/*.h", "tsx/src/**/*.c"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "2c4ce711ae8d1218a3b2f899189298159d672870b5b34dff5d937bed2f3e8983",
strip_prefix = "tree-sitter-typescript-0.23.2",
urls = ["https://github.com/tree-sitter/tree-sitter-typescript/archive/v0.23.2.tar.gz"],
)

http_archive(
name = "tree-sitter-ruby",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-5+SVd93B8t6OQtQjU7R34zjBW7uVslWOEj3cE9iHifA=",
strip_prefix = "tree-sitter-ruby-0.23.1",
urls = ["https://github.com/tree-sitter/tree-sitter-ruby/archive/v0.23.1.tar.gz"],
)

####### Dev dependencies ########

# Go SDK version which can only be defined in a root MODULE
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk", dev_dependency = True)
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.nogo(nogo = "//bazel/go:nogo")
go_sdk.from_file(
go_sdk.download(
name = "go_sdk",
go_mod = "//common:go.mod",
version = "1.26.1",
)
Comment on lines +13 to 18
use_repo(go_sdk, "go_sdk")

# Go deps loaded just for bazel/tools
go_deps2 = use_extension("@gazelle//:extensions.bzl", "go_deps", dev_dependency = True)
go_deps2 = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps2.module(
path = "golang.org/x/tools",
sum = "h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=",
version = "0.37.0",
sum = "h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=",
version = "0.43.0",
)
Comment on lines 21 to 27
go_deps2.module(
path = "google.golang.org/genproto/googleapis/api",
Expand All @@ -140,6 +32,6 @@ go_deps2.module(
)
use_repo(go_deps2, "org_golang_google_genproto_googleapis_api", "org_golang_x_tools")

bazel_dep(name = "aspect_rules_lint", version = "2.3.0", dev_dependency = True)
bazel_dep(name = "bazelrc-preset.bzl", version = "1.9.2", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.5.1", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "2.3.0")
bazel_dep(name = "bazelrc-preset.bzl", version = "1.9.2")
bazel_dep(name = "buildifier_prebuilt", version = "8.5.1")
Comment on lines +35 to +37
3 changes: 3 additions & 0 deletions common/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
########################
# Import bazelrc presets
import %workspace%/../tools/preset.bazelrc
1 change: 1 addition & 0 deletions common/.bazelversion
25 changes: 24 additions & 1 deletion common/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
load("@gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@rules_go//go:def.bzl", "go_library", "go_test")

gazelle_binary(
name = "gazelle_bin",
languages = [
"@gazelle//language/go:go_default_library",
],

# Public for use in sub-MODULEs
visibility = ["//visibility:public"],
)

gazelle(
name = "gazelle",
extra_args = ["-index=lazy"],
gazelle = ":gazelle_bin",
)

gazelle(
name = "gazelle.check",
gazelle = ":gazelle_bin",
mode = "diff",
)

go_library(
name = "common",
srcs = [
Expand All @@ -14,7 +37,7 @@ go_library(
importpath = "github.com/aspect-build/aspect-gazelle/common",
visibility = ["//visibility:public"],
deps = [
"//common/logger",
"//logger",
"@com_github_bazelbuild_buildtools//build",
Comment on lines 37 to 41
"@com_github_bmatcuk_doublestar_v4//:doublestar",
"@com_github_emirpasic_gods_v2//sets/treeset",
Expand Down
116 changes: 116 additions & 0 deletions common/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
module(
name = "aspect_gazelle",
compatibility_level = 0,
)

bazel_dep(name = "rules_go", version = "0.60.0")
bazel_dep(name = "gazelle", version = "0.47.0") # must match go.mod

# Go modules
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(go_deps, "com_github_bazelbuild_buildtools", "com_github_bmatcuk_doublestar_v4", "com_github_emirpasic_gods_v2", "com_github_onsi_gomega", "com_github_smacker_go_tree_sitter", "in_gopkg_op_go_logging_v1")

# tree-sitter languages
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "tree-sitter-go",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-M7w7RN4de4FfUv6fQuSXhsWDPZGB/Vn9aRDBnIJVkik=",
urls = ["https://github.com/tree-sitter/tree-sitter-go/releases/download/v0.23.4/tree-sitter-go.tar.xz"],
)

http_archive(
name = "tree-sitter-java",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "ed766e1045be236e50a7f99295996f6705d7506628b79af80d1fd5efb63c86a7",
urls = ["https://github.com/tree-sitter/tree-sitter-java/releases/download/v0.23.5/tree-sitter-java.tar.xz"],
)

http_archive(
name = "tree-sitter-json",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "acf6e8362457e819ed8b613f2ad9a0e1b621a77556c296f3abea58f7880a9213",
strip_prefix = "tree-sitter-json-0.24.8",
urls = ["https://github.com/tree-sitter/tree-sitter-json/archive/v0.24.8.tar.gz"],
)

http_archive(
name = "tree-sitter-kotlin",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "666c67f4486d6f7ebeb6418a956f3d7599b3e200e42fe583312c92182ce731d0",
strip_prefix = "tree-sitter-kotlin-6b9788578ae23a1bc7c87e8d564e0daf7671dee3",
urls = ["https://github.com/fwcd/tree-sitter-kotlin/archive/6b9788578ae23a1bc7c87e8d564e0daf7671dee3.tar.gz"],
)

http_archive(
name = "tree-sitter-starlark",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "31c58a540d738a17b366f2046da298b66dfa0695bcbfa207f61fa63cfe5c03ed",
strip_prefix = "tree-sitter-starlark-1.3.0",
urls = ["https://github.com/tree-sitter-grammars/tree-sitter-starlark/archive/v1.3.0.tar.gz"],
)

http_archive(
name = "tree-sitter-typescript",
build_file_content = """
filegroup(
name = "typescript-srcs",
srcs = glob(["common/**/*.h", "typescript/src/**/*.h", "typescript/src/**/*.c"]),
visibility = ["//visibility:public"],
)
filegroup(
name = "tsx-srcs",
srcs = glob(["common/**/*.h", "tsx/src/**/*.h", "tsx/src/**/*.c"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "2c4ce711ae8d1218a3b2f899189298159d672870b5b34dff5d937bed2f3e8983",
strip_prefix = "tree-sitter-typescript-0.23.2",
urls = ["https://github.com/tree-sitter/tree-sitter-typescript/archive/v0.23.2.tar.gz"],
)

http_archive(
name = "tree-sitter-ruby",
build_file_content = """
filegroup(
name = "srcs",
srcs = glob(["src/**/*.c", "src/**/*.h"]),
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-5+SVd93B8t6OQtQjU7R34zjBW7uVslWOEj3cE9iHifA=",
strip_prefix = "tree-sitter-ruby-0.23.1",
urls = ["https://github.com/tree-sitter/tree-sitter-ruby/archive/v0.23.1.tar.gz"],
)
2 changes: 1 addition & 1 deletion common/bazel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ go_library(
],
importpath = "github.com/aspect-build/aspect-gazelle/common/bazel",
visibility = ["//visibility:public"],
deps = ["//common/bazel/workspace"],
deps = ["//bazel/workspace"],
)
Loading
Loading