Skip to content

Commit a83a817

Browse files
simuonsblorente
authored andcommitted
Use released protoc binaries (bazel-contrib#1142)
* Use released protoc binaries Avoid compiling protoc during bazel build. Based on change in rules_proto bazelbuild/rules_proto#36 rules_proto_dependencies() declares a @com_google_protobuf//:protoc which points to released protoc binary. The tricks is to load that before scala_repositories() which has conditional load for @com_google_protobuf * lint fix * Align rules_proto versions * Update readme * Revert "Update readme" This reverts commit b9a3606.
1 parent 02aac8c commit a83a817

File tree

6 files changed

+82
-27
lines changed

6 files changed

+82
-27
lines changed

WORKSPACE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ http_archive(
1313
url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version),
1414
)
1515

16+
http_archive(
17+
name = "rules_proto",
18+
sha256 = "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
19+
strip_prefix = "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
20+
urls = [
21+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
22+
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
23+
],
24+
)
25+
26+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
27+
28+
# Declares @com_google_protobuf//:protoc pointing to released binary
29+
# This should stop building protoc during bazel build
30+
# See https://github.com/bazelbuild/rules_proto/pull/36
31+
rules_proto_dependencies()
32+
33+
rules_proto_toolchains()
34+
1635
_build_tools_release = "3.3.0"
1736

1837
http_archive(

examples/testing/scalatest_repositories/WORKSPACE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ http_archive(
1111
url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version),
1212
)
1313

14+
http_archive(
15+
name = "rules_proto",
16+
sha256 = "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
17+
strip_prefix = "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
18+
urls = [
19+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
20+
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
21+
],
22+
)
23+
24+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
25+
26+
rules_proto_dependencies()
27+
28+
rules_proto_toolchains()
29+
1430
local_repository(
1531
name = "io_bazel_rules_scala",
1632
path = "../../..",

examples/testing/specs2_junit_repositories/WORKSPACE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ http_archive(
1111
url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version),
1212
)
1313

14+
http_archive(
15+
name = "rules_proto",
16+
sha256 = "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
17+
strip_prefix = "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
18+
urls = [
19+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
20+
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
21+
],
22+
)
23+
24+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
25+
26+
rules_proto_dependencies()
27+
28+
rules_proto_toolchains()
29+
1430
local_repository(
1531
name = "io_bazel_rules_scala",
1632
path = "../../..",

scala/private/macros/scala_repositories.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def rules_scala_setup():
4040
if not native.existing_rule("rules_proto"):
4141
http_archive(
4242
name = "rules_proto",
43-
sha256 = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0",
44-
strip_prefix = "rules_proto-f6b8d89b90a7956f6782a4a3609b2f0eee3ce965",
43+
sha256 = "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
44+
strip_prefix = "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
4545
urls = [
46-
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
47-
"https://github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
46+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
47+
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
4848
],
4949
)
5050

test_version/WORKSPACE.template

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ http_archive(
1111
url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version),
1212
)
1313

14+
http_archive(
15+
name = "rules_proto",
16+
sha256 = "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
17+
strip_prefix = "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
18+
urls = [
19+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
20+
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
21+
],
22+
)
23+
24+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
25+
26+
rules_proto_dependencies()
27+
28+
rules_proto_toolchains()
29+
1430
local_repository(
1531
name = "io_bazel_rules_scala",
1632
path = "../../"
@@ -50,16 +66,3 @@ register_toolchains("@io_bazel_rules_scala//testing:testing_toolchain")
5066
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_unused_deps_toolchains")
5167

5268
scala_register_unused_deps_toolchains()
53-
54-
protobuf_version="3.11.3"
55-
protobuf_version_sha256="cf754718b0aa945b00550ed7962ddc167167bd922b842199eeb6505e6f344852"
56-
57-
http_archive(
58-
name = "com_google_protobuf",
59-
url = "https://github.com/protocolbuffers/protobuf/archive/v%s.tar.gz" % protobuf_version,
60-
strip_prefix = "protobuf-%s" % protobuf_version,
61-
sha256 = protobuf_version_sha256,
62-
)
63-
64-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
65-
protobuf_deps()

third_party/test/proto/WORKSPACE

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@ workspace(name = "proto")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5-
protobuf_version = "3.11.3"
6-
7-
protobuf_version_sha256 = "cf754718b0aa945b00550ed7962ddc167167bd922b842199eeb6505e6f344852"
8-
95
http_archive(
10-
name = "com_google_protobuf",
11-
sha256 = protobuf_version_sha256,
12-
strip_prefix = "protobuf-%s" % protobuf_version,
13-
url = "https://github.com/protocolbuffers/protobuf/archive/v%s.tar.gz" % protobuf_version,
6+
name = "rules_proto",
7+
sha256 = "8e7d59a5b12b233be5652e3d29f42fba01c7cbab09f6b3a8d0a57ed6d1e9a0da",
8+
strip_prefix = "rules_proto-7e4afce6fe62dbff0a4a03450143146f9f2d7488",
9+
urls = [
10+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
11+
"https://github.com/bazelbuild/rules_proto/archive/7e4afce6fe62dbff0a4a03450143146f9f2d7488.tar.gz",
12+
],
1413
)
1514

16-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
15+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
16+
17+
rules_proto_dependencies()
1718

18-
protobuf_deps()
19+
rules_proto_toolchains()
1920

2021
local_repository(
2122
name = "io_bazel_rules_scala",

0 commit comments

Comments
 (0)