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 (bazelbuild#989)

* Make rules_scala compatible with --incompatible_load_proto_rules_from_bzl

* Use [email protected]

* Run ./lint.sh
  • Loading branch information
Yannic authored and Andre Rocha committed Jul 6, 2020
1 parent 09cfd84 commit 25b6a4a
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 22 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
45 changes: 39 additions & 6 deletions scala/private/macros/scala_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,52 @@ 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 = "220b87d8cfabd22d1c6d8e3cdb4249abd4c93dcc152e0667db061fb1b957ee68",
urls = ["https://github.com/bazelbuild/rules_java/releases/download/0.1.1/rules_java-0.1.1.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",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
build_file = "@com_google_protobuf//third_party:zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = [
Expand Down
16 changes: 4 additions & 12 deletions scala_proto/private/scalapb_aspect.bzl
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
load(
"//scala/private:common.bzl",
"write_manifest_file",
)
load(
"//scala/private:dependency.bzl",
"legacy_unclear_dependency_info_for_protobuf_scrooge",
)
load(
"//scala/private:rule_impls.bzl",
"compile_scala",
)
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load("//scala/private:common.bzl", "write_manifest_file")
load("//scala/private:dependency.bzl", "legacy_unclear_dependency_info_for_protobuf_scrooge")
load("//scala/private:rule_impls.bzl", "compile_scala")
load("//scala_proto/private:proto_to_scala_src.bzl", "proto_to_scala_src")

ScalaPBAspectInfo = provider(fields = [
Expand Down
4 changes: 4 additions & 0 deletions 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
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 25b6a4a

Please sign in to comment.