Skip to content

Commit 1d80296

Browse files
committed
Move load_rules_dependencies to scala/deps.bzl
Ensures we get all the versions of dependencies we want in `WORKSPACE`, while providing a new API to consumers. Part of bazel-contrib#1652.
1 parent 0bbf8c6 commit 1d80296

File tree

3 files changed

+64
-69
lines changed

3 files changed

+64
-69
lines changed

WORKSPACE

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
workspace(name = "io_bazel_rules_scala")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
load("//scala:deps.bzl", "load_rules_dependencies")
45

5-
http_archive(
6-
name = "bazel_skylib",
7-
sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7",
8-
urls = [
9-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
10-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
11-
],
12-
)
6+
load_rules_dependencies()
137

148
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
159

1610
bazel_skylib_workspace()
1711

12+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
13+
14+
protobuf_deps()
15+
1816
http_archive(
1917
name = "rules_python",
2018
sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913",
@@ -53,10 +51,6 @@ load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")
5351

5452
rules_proto_toolchains()
5553

56-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
57-
58-
protobuf_deps()
59-
6054
load("//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge")
6155

6256
twitter_scrooge()
@@ -101,10 +95,10 @@ local_repository(
10195

10296
http_archive(
10397
name = "io_bazel_rules_go",
104-
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
98+
sha256 = "f4a9314518ca6acfa16cc4ab43b0b8ce1e4ea64b81c38d8a3772883f153346b8",
10599
urls = [
106-
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
107-
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
100+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
101+
"https://github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
108102
],
109103
)
110104

@@ -116,7 +110,7 @@ load(
116110

117111
go_rules_dependencies()
118112

119-
go_register_toolchains(version = "1.19.5")
113+
go_register_toolchains(version = "1.23.0")
120114

121115
http_archive(
122116
name = "bazelci_rules",

scala/deps.bzl

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
3+
def load_rules_dependencies():
4+
if not native.existing_rule("bazel_skylib"):
5+
http_archive(
6+
name = "bazel_skylib",
7+
sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
8+
urls = [
9+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
10+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
11+
],
12+
)
13+
14+
if not native.existing_rule("rules_cc"):
15+
http_archive(
16+
name = "rules_cc",
17+
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
18+
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
19+
strip_prefix = "rules_cc-0.0.9",
20+
)
21+
22+
if not native.existing_rule("com_google_absl"):
23+
http_archive(
24+
name = "com_google_absl",
25+
sha256 = "91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8",
26+
strip_prefix = "abseil-cpp-20220623.1",
27+
url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz",
28+
)
29+
30+
if not native.existing_rule("rules_java"):
31+
http_archive(
32+
name = "rules_java",
33+
urls = [
34+
"https://github.com/bazelbuild/rules_java/releases/download/7.9.0/rules_java-7.9.0.tar.gz",
35+
],
36+
sha256 = "41131de4417de70b9597e6ebd515168ed0ba843a325dc54a81b92d7af9a7b3ea",
37+
)
38+
39+
if not native.existing_rule("com_google_protobuf"):
40+
http_archive(
41+
name = "com_google_protobuf",
42+
sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae",
43+
strip_prefix = "protobuf-21.7",
44+
url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.7.tar.gz",
45+
)
46+
47+
if not native.existing_rule("rules_proto"):
48+
http_archive(
49+
name = "rules_proto",
50+
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
51+
strip_prefix = "rules_proto-6.0.2",
52+
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
53+
)

scala/private/macros/scala_repositories.bzl

+1-53
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("//scala:deps.bzl", "load_rules_dependencies")
12
load(
23
"//scala:scala_cross_version.bzl",
34
"extract_major_version",
@@ -117,59 +118,6 @@ def dt_patched_compiler_setup(scala_version, scala_compiler_srcjar = None):
117118
integrity = srcjar.get("integrity"),
118119
)
119120

120-
def load_rules_dependencies():
121-
if not native.existing_rule("bazel_skylib"):
122-
http_archive(
123-
name = "bazel_skylib",
124-
sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7",
125-
urls = [
126-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
127-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
128-
],
129-
)
130-
131-
# Needed by protobuf-21.7 and Bazel 6.5.0, as later versions require C++14.
132-
if not native.existing_rule("com_google_absl"):
133-
http_archive(
134-
name = "com_google_absl",
135-
sha256 = "91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8",
136-
strip_prefix = "abseil-cpp-20220623.1",
137-
url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz",
138-
)
139-
140-
if not native.existing_rule("com_google_protobuf"):
141-
http_archive(
142-
name = "com_google_protobuf",
143-
sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae",
144-
strip_prefix = "protobuf-21.7",
145-
url = "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.7.tar.gz",
146-
)
147-
148-
if not native.existing_rule("rules_cc"):
149-
http_archive(
150-
name = "rules_cc",
151-
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.6/rules_cc-0.0.6.tar.gz"],
152-
sha256 = "3d9e271e2876ba42e114c9b9bc51454e379cbf0ec9ef9d40e2ae4cec61a31b40",
153-
strip_prefix = "rules_cc-0.0.6",
154-
)
155-
156-
if not native.existing_rule("rules_java"):
157-
http_archive(
158-
name = "rules_java",
159-
urls = [
160-
"https://github.com/bazelbuild/rules_java/releases/download/7.9.0/rules_java-7.9.0.tar.gz",
161-
],
162-
sha256 = "41131de4417de70b9597e6ebd515168ed0ba843a325dc54a81b92d7af9a7b3ea",
163-
)
164-
165-
if not native.existing_rule("rules_proto"):
166-
http_archive(
167-
name = "rules_proto",
168-
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
169-
strip_prefix = "rules_proto-6.0.2",
170-
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
171-
)
172-
173121
def setup_scala_compiler_sources(srcjars = {}):
174122
"""Generates Scala compiler source repos used internally by rules_scala.
175123

0 commit comments

Comments
 (0)