Skip to content

Commit 0f387ee

Browse files
committed
Go: add vendor update to //go:gen
1 parent d98ccdf commit 0f387ee

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

go/BUILD.bazel

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
22
load("@gazelle//:def.bzl", "gazelle")
33
load("@rules_pkg//pkg:install.bzl", "pkg_install")
4-
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files")
4+
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files")
55
load("//:defs.bzl", "codeql_platform")
66

77
gazelle(
8-
name = "_gazelle",
8+
name = "gazelle",
9+
extra_args = ["go/extractor"],
910
)
1011

1112
_gen_binaries = [
12-
":_gazelle",
13+
"@rules_go//go",
14+
":gazelle",
1315
"//go/extractor/cli/go-gen-dbscheme",
1416
]
1517

@@ -62,6 +64,7 @@ pkg_files(
6264
"//go/extractor/cli/go-gen-dbscheme",
6365
"//go/extractor/cli/go-tokenizer",
6466
],
67+
attributes = pkg_attributes(mode = "0755"),
6568
prefix = "tools/" + codeql_platform,
6669
visibility = ["//visibility:public"],
6770
)

go/extractor/vendor/modules.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
## workspace
12
# golang.org/x/mod v0.15.0
23
## explicit; go 1.18
34
golang.org/x/mod/internal/lazyregexp

go/gen.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
go_extractor_dir = this.parent / "extractor"
88
go_dbscheme = this.parent / "ql" / "lib" / "go.dbscheme"
99
r = runfiles.Create()
10-
gazelle, go_gen_dbscheme = map(r.Rlocation, sys.argv[1:])
10+
go, gazelle, go_gen_dbscheme = map(r.Rlocation, sys.argv[1:])
11+
12+
print("updating vendor")
13+
subprocess.check_call([go, "-C", go_extractor_dir, "work", "vendor"])
1114

1215
print("clearing generated BUILD files")
1316
for build_file in go_extractor_dir.glob("*/**/BUILD.bazel"):
1417
build_file.unlink()
1518

1619
print("running gazelle")
17-
subprocess.check_call([gazelle, "go/extractor"])
20+
subprocess.check_call([gazelle])
1821

1922
print("adding header to generated BUILD files")
2023
for build_file in go_extractor_dir.glob("*/**/BUILD.bazel"):

0 commit comments

Comments
 (0)