@@ -7,54 +7,7 @@ workspace(name = "build_file_generation_example")
77# file. When the symbol is loaded you can use the rule.
88load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
99
10- ######################################################################
11- # We need rules_go and bazel_gazelle, to build the gazelle plugin from source.
12- # Setup instructions for this section are at
13- # https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel
14- # You may need to update the version of the rule, which is listed in the above
15- # documentation.
16- ######################################################################
17-
18- # Define an http_archive rule that will download the below ruleset,
19- # test the sha, and extract the ruleset to you local bazel cache.
20-
21- http_archive (
22- name = "io_bazel_rules_go" ,
23- sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a" ,
24- urls = [
25- "https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip" ,
26- "https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip" ,
27- ],
28- )
29-
30- # Download the bazel_gazelle ruleset.
31- http_archive (
32- name = "bazel_gazelle" ,
33- sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62" ,
34- urls = [
35- "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz" ,
36- "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz" ,
37- ],
38- )
39-
40- # Load rules_go ruleset and expose the toolchain and dep rules.
41- load ("@bazel_gazelle//:deps.bzl" , "gazelle_dependencies" )
42- load ("@io_bazel_rules_go//go:deps.bzl" , "go_register_toolchains" , "go_rules_dependencies" )
43-
44- # go_rules_dependencies is a function that registers external dependencies
45- # needed by the Go rules.
46- # See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
47- go_rules_dependencies ()
48-
49- # go_rules_dependencies is a function that registers external dependencies
50- # needed by the Go rules.
51- # See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
52- go_register_toolchains (version = "1.21.13" )
53-
54- # The following call configured the gazelle dependencies, Go environment and Go SDK.
55- gazelle_dependencies ()
56-
57- # Remaining setup is for rules_python.
10+ # Setup rules_python.
5811
5912# DON'T COPY_PASTE THIS.
6013# Our example uses `local_repository` to point to the HEAD version of rules_python.
@@ -124,6 +77,53 @@ load("@pip//:requirements.bzl", "install_deps")
12477# Initialize repositories for all packages in requirements_lock.txt.
12578install_deps ()
12679
80+ ######################################################################
81+ # We need rules_go and bazel_gazelle, to build the gazelle plugin from source.
82+ # Setup instructions for this section are at
83+ # https://github.com/bazelbuild/bazel-gazelle#running-gazelle-with-bazel
84+ # You may need to update the version of the rule, which is listed in the above
85+ # documentation.
86+ ######################################################################
87+
88+ # Define an http_archive rule that will download the below ruleset,
89+ # test the sha, and extract the ruleset to you local bazel cache.
90+
91+ http_archive (
92+ name = "io_bazel_rules_go" ,
93+ sha256 = "9d72f7b8904128afb98d46bbef82ad7223ec9ff3718d419afb355fddd9f9484a" ,
94+ urls = [
95+ "https://mirror.bazel.build/github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip" ,
96+ "https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip" ,
97+ ],
98+ )
99+
100+ # Download the bazel_gazelle ruleset.
101+ http_archive (
102+ name = "bazel_gazelle" ,
103+ sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62" ,
104+ urls = [
105+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz" ,
106+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.36.0/bazel-gazelle-v0.36.0.tar.gz" ,
107+ ],
108+ )
109+
110+ # Load rules_go ruleset and expose the toolchain and dep rules.
111+ load ("@bazel_gazelle//:deps.bzl" , "gazelle_dependencies" )
112+ load ("@io_bazel_rules_go//go:deps.bzl" , "go_register_toolchains" , "go_rules_dependencies" )
113+
114+ # go_rules_dependencies is a function that registers external dependencies
115+ # needed by the Go rules.
116+ # See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
117+ go_rules_dependencies ()
118+
119+ # go_rules_dependencies is a function that registers external dependencies
120+ # needed by the Go rules.
121+ # See: https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
122+ go_register_toolchains (version = "1.21.13" )
123+
124+ # The following call configured the gazelle dependencies, Go environment and Go SDK.
125+ gazelle_dependencies ()
126+
127127# The rules_python gazelle extension has some third-party go dependencies
128128# which we need to fetch in order to compile it.
129129load ("@rules_python_gazelle_plugin//:deps.bzl" , _py_gazelle_deps = "gazelle_deps" )
0 commit comments