Skip to content

Commit 7cc2698

Browse files
committed
http_archive for smacker/go-tree-sitter
1 parent 20741ea commit 7cc2698

File tree

4 files changed

+96
-6
lines changed

4 files changed

+96
-6
lines changed

gazelle/MODULE.bazel

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,21 @@ use_repo(
2323
"com_github_bmatcuk_doublestar_v4",
2424
"com_github_emirpasic_gods",
2525
"com_github_ghodss_yaml",
26-
"com_github_smacker_go_tree_sitter",
2726
"com_github_stretchr_testify",
2827
"in_gopkg_yaml_v2",
2928
"org_golang_x_sync",
3029
)
3130

31+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
32+
33+
http_archive(
34+
name = "com_github_smacker_go_tree_sitter",
35+
build_file = "//:internal/smacker_BUILD.bazel",
36+
integrity = "sha256-4AkDY4Rh5Auu9Kwzhj5XYSirMLlhmd6ClMWo/r0kmu4=",
37+
strip_prefix = "go-tree-sitter-dd81d9e9be82a8cac96ed1d50c7389c5f1997c02",
38+
url = "https://github.com/smacker/go-tree-sitter/archive/dd81d9e9be82a8cac96ed1d50c7389c5f1997c02.zip",
39+
)
40+
3241
python_stdlib_list = use_extension("//python:extensions.bzl", "python_stdlib_list")
3342
use_repo(
3443
python_stdlib_list,

gazelle/deps.bzl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ def go_deps():
119119
sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
120120
version = "v1.0.0",
121121
)
122-
go_repository(
122+
http_archive(
123123
name = "com_github_smacker_go_tree_sitter",
124-
importpath = "github.com/smacker/go-tree-sitter",
125-
sum = "h1:6C8qej6f1bStuePVkLSFxoU22XBS165D3klxlzRg8F4=",
126-
version = "v0.0.0-20240827094217-dd81d9e9be82",
124+
build_file = "//:internal/smacker_BUILD.bazel",
125+
integrity = "sha256-4AkDY4Rh5Auu9Kwzhj5XYSirMLlhmd6ClMWo/r0kmu4=",
126+
strip_prefix = "go-tree-sitter-dd81d9e9be82a8cac96ed1d50c7389c5f1997c02",
127+
url = "https://github.com/smacker/go-tree-sitter/archive/dd81d9e9be82a8cac96ed1d50c7389c5f1997c02.zip",
127128
)
128129
go_repository(
129130
name = "com_github_stretchr_objx",
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
2+
3+
filegroup(
4+
name = "common_libs",
5+
srcs = [
6+
"alloc.h",
7+
"api.h",
8+
"array.h",
9+
],
10+
visibility = [":__subpackages__"],
11+
)
12+
13+
go_library(
14+
name = "go-tree-sitter",
15+
srcs = [
16+
"alloc.c",
17+
"alloc.h",
18+
"api.h",
19+
"array.h",
20+
"atomic.h",
21+
"bindings.c",
22+
"bindings.go",
23+
"bindings.h",
24+
"bits.h",
25+
"clock.h",
26+
"error_costs.h",
27+
"get_changed_ranges.c",
28+
"get_changed_ranges.h",
29+
"host.h",
30+
"iter.go",
31+
"language.c",
32+
"language.h",
33+
"length.h",
34+
"lexer.c",
35+
"lexer.h",
36+
"node.c",
37+
"parser.c",
38+
"parser.h",
39+
"point.h",
40+
"ptypes.h",
41+
"query.c",
42+
"reduce_action.h",
43+
"reusable_node.h",
44+
"stack.c",
45+
"stack.h",
46+
"subtree.c",
47+
"subtree.h",
48+
"test_grammar.go",
49+
"tree.c",
50+
"tree.h",
51+
"tree_cursor.c",
52+
"tree_cursor.h",
53+
"umachine.h",
54+
"unicode.h",
55+
"urename.h",
56+
"utf.h",
57+
"utf16.h",
58+
"utf8.h",
59+
"wasm_store.c",
60+
"wasm_store.h",
61+
],
62+
cgo = True,
63+
importpath = "github.com/smacker/go-tree-sitter",
64+
visibility = ["//visibility:public"],
65+
)
66+
67+
go_library(
68+
name = "python",
69+
srcs = [
70+
"python/binding.go",
71+
"python/parser.c",
72+
"python/parser.h",
73+
"python/scanner.c",
74+
":common_libs",
75+
],
76+
cgo = True,
77+
importpath = "github.com/smacker/go-tree-sitter/python",
78+
visibility = ["//visibility:public"],
79+
deps = [":go-tree-sitter"],
80+
)

gazelle/python/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ go_library(
4343
"@com_github_emirpasic_gods//sets/treeset",
4444
"@com_github_emirpasic_gods//utils",
4545
"@com_github_smacker_go_tree_sitter//:go-tree-sitter",
46-
"@com_github_smacker_go_tree_sitter//python",
46+
"@com_github_smacker_go_tree_sitter//:python",
4747
"@org_golang_x_sync//errgroup",
4848
],
4949
)

0 commit comments

Comments
 (0)