Skip to content

Commit

Permalink
Make rules_scala compatible with --incompatible_load_proto_rules_from…
Browse files Browse the repository at this point in the history
…_bzl
  • Loading branch information
Yannic committed Feb 5, 2020
1 parent 30b80b0 commit 7c733c8
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 14 deletions.
6 changes: 2 additions & 4 deletions manual_test/scalac_jvm_opts/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//scala:scala_toolchain.bzl", "scala_toolchain")
load("//scala:scala.bzl", "scala_library")
load(
"//scala_proto:scala_proto.bzl",
"scala_proto_library",
)
load("//scala_proto:scala_proto.bzl", "scala_proto_library")

scala_toolchain(
name = "failing_toolchain_impl",
Expand Down
44 changes: 39 additions & 5 deletions scala/private/macros/scala_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,49 @@ def scala_repositories(
if not native.existing_rule("com_google_protobuf"):
http_archive(
name = "com_google_protobuf",
sha256 = "d82eb0141ad18e98de47ed7ed415daabead6d5d1bef1b8cccb6aa4d108a9008f",
strip_prefix = "protobuf-b4f193788c9f0f05d7e0879ea96cd738630e5d51",
# Commit from 2019-05-15, update to protobuf 3.8 when available.
sha256 = "cf754718b0aa945b00550ed7962ddc167167bd922b842199eeb6505e6f344852",
strip_prefix = "protobuf-3.11.3",
urls = [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/b4f193788c9f0f05d7e0879ea96cd738630e5d51.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/b4f193788c9f0f05d7e0879ea96cd738630e5d51.tar.gz",
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.11.3.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.11.3.tar.gz",
],
)

if not native.existing_rule("rules_cc"):
http_archive(
name = "rules_cc",
sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec",
strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e",
urls = ["https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz"],
)

if not native.existing_rule("rules_java"):
http_archive(
name = "rules_java",
sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
urls = ["https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"],
)

if not native.existing_rule("rules_proto"):
http_archive(
name = "rules_proto",
sha256 = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0",
strip_prefix = "rules_proto-f6b8d89b90a7956f6782a4a3609b2f0eee3ce965",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
],
)

if not native.existing_rule("rules_python"):
http_archive(
name = "rules_python",
sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6",
strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"],
)

if not native.existing_rule("zlib"): # needed by com_google_protobuf
http_archive(
name = "zlib",
Expand Down
6 changes: 2 additions & 4 deletions scala_proto/private/scalapb_aspect.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load(
"//scala/private:common.bzl",
"write_manifest_file",
)
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load("//scala/private:common.bzl", "write_manifest_file")
load("//scala/private:rule_impls.bzl", "compile_scala")
load("//scala_proto/private:proto_to_scala_src.bzl", "proto_to_scala_src")

Expand Down
9 changes: 8 additions & 1 deletion scala_proto/scala_proto.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
load(
"@rules_proto//proto:defs.bzl",
"ProtoInfo",
)
load(
"//scala:scala_cross_version.bzl",
_default_maven_server_urls = "default_maven_server_urls",
Expand Down Expand Up @@ -50,7 +54,10 @@ def _scala_proto_library_impl(ctx):
scala_proto_library = rule(
implementation = _scala_proto_library_impl,
attrs = {
"deps": attr.label_list(aspects = [scalapb_aspect]),
"deps": attr.label_list(
providers = [ProtoInfo],
aspects = [scalapb_aspect],
),
},
provides = [DefaultInfo, ScalaPBInfo, JavaInfo],
)
Expand Down
1 change: 1 addition & 0 deletions test/proto/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load(
"//scala_proto:scala_proto.bzl",
"scala_proto_library",
Expand Down
2 changes: 2 additions & 0 deletions test/proto2/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "test",
srcs = ["test.proto"],
Expand Down
1 change: 1 addition & 0 deletions test/proto3/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load(
"//scala_proto:scala_proto.bzl",
"scala_proto_library",
)
load("@rules_proto//proto:defs.bzl", "proto_library")

genrule(
name = "generated",
Expand Down
2 changes: 2 additions & 0 deletions test_expect_failure/proto_source_root/dependency/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "dependency",
srcs = glob(["*.proto"]),
Expand Down
1 change: 1 addition & 0 deletions test_expect_failure/proto_source_root/user/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load(
"//scala_proto:scala_proto.bzl",
"scala_proto_library",
Expand Down
1 change: 1 addition & 0 deletions test_version/version_specific_tests_dir/proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load(
"@io_bazel_rules_scala//scala_proto:scala_proto.bzl",
"scala_proto_library",
)
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "test2",
Expand Down
2 changes: 2 additions & 0 deletions test_version/version_specific_tests_dir/proto2/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "test",
srcs = ["test.proto"],
Expand Down
2 changes: 2 additions & 0 deletions third_party/bazel/src/main/protobuf/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

licenses(["notice"])

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

0 comments on commit 7c733c8

Please sign in to comment.