Skip to content

Commit 7c733c8

Browse files
committed
Make rules_scala compatible with --incompatible_load_proto_rules_from_bzl
1 parent 30b80b0 commit 7c733c8

File tree

12 files changed

+63
-14
lines changed

12 files changed

+63
-14
lines changed

manual_test/scalac_jvm_opts/BUILD

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
load("@rules_proto//proto:defs.bzl", "proto_library")
12
load("//scala:scala_toolchain.bzl", "scala_toolchain")
23
load("//scala:scala.bzl", "scala_library")
3-
load(
4-
"//scala_proto:scala_proto.bzl",
5-
"scala_proto_library",
6-
)
4+
load("//scala_proto:scala_proto.bzl", "scala_proto_library")
75

86
scala_toolchain(
97
name = "failing_toolchain_impl",

scala/private/macros/scala_repositories.bzl

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,49 @@ def scala_repositories(
134134
if not native.existing_rule("com_google_protobuf"):
135135
http_archive(
136136
name = "com_google_protobuf",
137-
sha256 = "d82eb0141ad18e98de47ed7ed415daabead6d5d1bef1b8cccb6aa4d108a9008f",
138-
strip_prefix = "protobuf-b4f193788c9f0f05d7e0879ea96cd738630e5d51",
139-
# Commit from 2019-05-15, update to protobuf 3.8 when available.
137+
sha256 = "cf754718b0aa945b00550ed7962ddc167167bd922b842199eeb6505e6f344852",
138+
strip_prefix = "protobuf-3.11.3",
140139
urls = [
141-
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/b4f193788c9f0f05d7e0879ea96cd738630e5d51.tar.gz",
142-
"https://github.com/protocolbuffers/protobuf/archive/b4f193788c9f0f05d7e0879ea96cd738630e5d51.tar.gz",
140+
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.11.3.tar.gz",
141+
"https://github.com/protocolbuffers/protobuf/archive/v3.11.3.tar.gz",
143142
],
144143
)
145144

145+
if not native.existing_rule("rules_cc"):
146+
http_archive(
147+
name = "rules_cc",
148+
sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec",
149+
strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e",
150+
urls = ["https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz"],
151+
)
152+
153+
if not native.existing_rule("rules_java"):
154+
http_archive(
155+
name = "rules_java",
156+
sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
157+
strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
158+
urls = ["https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"],
159+
)
160+
161+
if not native.existing_rule("rules_proto"):
162+
http_archive(
163+
name = "rules_proto",
164+
sha256 = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0",
165+
strip_prefix = "rules_proto-f6b8d89b90a7956f6782a4a3609b2f0eee3ce965",
166+
urls = [
167+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
168+
"https://github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
169+
],
170+
)
171+
172+
if not native.existing_rule("rules_python"):
173+
http_archive(
174+
name = "rules_python",
175+
sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6",
176+
strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
177+
urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"],
178+
)
179+
146180
if not native.existing_rule("zlib"): # needed by com_google_protobuf
147181
http_archive(
148182
name = "zlib",

scala_proto/private/scalapb_aspect.bzl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
load(
2-
"//scala/private:common.bzl",
3-
"write_manifest_file",
4-
)
1+
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
2+
load("//scala/private:common.bzl", "write_manifest_file")
53
load("//scala/private:rule_impls.bzl", "compile_scala")
64
load("//scala_proto/private:proto_to_scala_src.bzl", "proto_to_scala_src")
75

scala_proto/scala_proto.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
load(
2+
"@rules_proto//proto:defs.bzl",
3+
"ProtoInfo",
4+
)
15
load(
26
"//scala:scala_cross_version.bzl",
37
_default_maven_server_urls = "default_maven_server_urls",
@@ -50,7 +54,10 @@ def _scala_proto_library_impl(ctx):
5054
scala_proto_library = rule(
5155
implementation = _scala_proto_library_impl,
5256
attrs = {
53-
"deps": attr.label_list(aspects = [scalapb_aspect]),
57+
"deps": attr.label_list(
58+
providers = [ProtoInfo],
59+
aspects = [scalapb_aspect],
60+
),
5461
},
5562
provides = [DefaultInfo, ScalaPBInfo, JavaInfo],
5663
)

test/proto/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_proto//proto:defs.bzl", "proto_library")
12
load(
23
"//scala_proto:scala_proto.bzl",
34
"scala_proto_library",

test/proto2/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_proto//proto:defs.bzl", "proto_library")
2+
13
proto_library(
24
name = "test",
35
srcs = ["test.proto"],

test/proto3/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load(
22
"//scala_proto:scala_proto.bzl",
33
"scala_proto_library",
44
)
5+
load("@rules_proto//proto:defs.bzl", "proto_library")
56

67
genrule(
78
name = "generated",

test_expect_failure/proto_source_root/dependency/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_proto//proto:defs.bzl", "proto_library")
2+
13
proto_library(
24
name = "dependency",
35
srcs = glob(["*.proto"]),

test_expect_failure/proto_source_root/user/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_proto//proto:defs.bzl", "proto_library")
12
load(
23
"//scala_proto:scala_proto.bzl",
34
"scala_proto_library",

test_version/version_specific_tests_dir/proto/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load(
22
"@io_bazel_rules_scala//scala_proto:scala_proto.bzl",
33
"scala_proto_library",
44
)
5+
load("@rules_proto//proto:defs.bzl", "proto_library")
56

67
proto_library(
78
name = "test2",

test_version/version_specific_tests_dir/proto2/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_proto//proto:defs.bzl", "proto_library")
2+
13
proto_library(
24
name = "test",
35
srcs = ["test.proto"],

third_party/bazel/src/main/protobuf/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_proto//proto:defs.bzl", "proto_library")
2+
13
licenses(["notice"])
24

35
package(default_visibility = ["//visibility:public"])

0 commit comments

Comments
 (0)