Skip to content

Commit 0cb1d71

Browse files
authored
Make rules_scala compatible with --incompatible_load_proto_rules_from_bzl (#989)
* Make rules_scala compatible with --incompatible_load_proto_rules_from_bzl * Use rules_java@0.1.1 * Run ./lint.sh
1 parent f220907 commit 0cb1d71

File tree

12 files changed

+61
-22
lines changed

12 files changed

+61
-22
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,52 @@ 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 = "220b87d8cfabd22d1c6d8e3cdb4249abd4c93dcc152e0667db061fb1b957ee68",
157+
urls = ["https://github.com/bazelbuild/rules_java/releases/download/0.1.1/rules_java-0.1.1.tar.gz"],
158+
)
159+
160+
if not native.existing_rule("rules_proto"):
161+
http_archive(
162+
name = "rules_proto",
163+
sha256 = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0",
164+
strip_prefix = "rules_proto-f6b8d89b90a7956f6782a4a3609b2f0eee3ce965",
165+
urls = [
166+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
167+
"https://github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
168+
],
169+
)
170+
171+
if not native.existing_rule("rules_python"):
172+
http_archive(
173+
name = "rules_python",
174+
sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6",
175+
strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
176+
urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"],
177+
)
178+
146179
if not native.existing_rule("zlib"): # needed by com_google_protobuf
147180
http_archive(
148181
name = "zlib",
149-
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
182+
build_file = "@com_google_protobuf//third_party:zlib.BUILD",
150183
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
151184
strip_prefix = "zlib-1.2.11",
152185
urls = [

scala_proto/private/scalapb_aspect.bzl

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
load(
2-
"//scala/private:common.bzl",
3-
"write_manifest_file",
4-
)
5-
load(
6-
"//scala/private:dependency.bzl",
7-
"legacy_unclear_dependency_info_for_protobuf_scrooge",
8-
)
9-
load(
10-
"//scala/private:rule_impls.bzl",
11-
"compile_scala",
12-
)
1+
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
2+
load("//scala/private:common.bzl", "write_manifest_file")
3+
load("//scala/private:dependency.bzl", "legacy_unclear_dependency_info_for_protobuf_scrooge")
4+
load("//scala/private:rule_impls.bzl", "compile_scala")
135
load("//scala_proto/private:proto_to_scala_src.bzl", "proto_to_scala_src")
146

157
ScalaPBAspectInfo = provider(fields = [

scala_proto/scala_proto.bzl

Lines changed: 4 additions & 0 deletions
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",

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",

0 commit comments

Comments
 (0)