diff options
author | Sahin Yort <thesayyn@gmail.com> | 2023-10-21 02:30:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-21 11:30:43 +0200 |
commit | 19241176b2c1d0554fe5015bdef99169d7cb89cb (patch) | |
tree | 8397933d8b73db7f0d7e542adc9416d934c98d88 | |
parent | 83da40714cf72a18b4a052d2b421f9668fa4ab69 (diff) | |
download | bazelbuild-rules-proto-19241176b2c1d0554fe5015bdef99169d7cb89cb.tar.gz |
refactor: remove protobuf_workspace (#181)
- removes protobuf workspace
- removes dependency on protobuf repository.
currently, there are no prebuilt binaries available, it's built from the
source using the protobuf workspace. Will add the toolchain for prebuilt
binaries in a follow-up
RELNOTES[INC]: protobuf_repo was removed
---------
Co-authored-by: Ivo List <ilist@google.com>
-rw-r--r-- | MODULE.bazel | 4 | ||||
-rw-r--r-- | WORKSPACE | 28 | ||||
-rw-r--r-- | dev_deps.bzl | 44 | ||||
-rw-r--r-- | proto/BUILD | 3 | ||||
-rw-r--r-- | proto/private/BUILD | 6 | ||||
-rw-r--r-- | proto/private/BUILD.protoc | 18 | ||||
-rw-r--r-- | proto/private/BUILD.release | 164 | ||||
-rw-r--r-- | proto/private/dependencies.bzl | 220 | ||||
-rwxr-xr-x | proto/private/generate_sums.sh | 61 | ||||
-rw-r--r-- | proto/repositories.bzl | 16 |
10 files changed, 61 insertions, 503 deletions
diff --git a/MODULE.bazel b/MODULE.bazel index f5f8c61..f3119b6 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,10 +5,8 @@ module( ) bazel_dep(name = "bazel_skylib", version = "1.3.0") -bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") - -# TODO(bazel-team): add support for protobuf_workspace # Dependencies needed in tests bazel_dep(name = "rules_cc", version = "0.0.1", dev_dependency = True) bazel_dep(name = "googletest", version = "1.11.0", dev_dependency = True, repo_name = "com_google_googletest") +bazel_dep(name = "protobuf", version = "21.7", dev_dependency = True, repo_name = "com_google_protobuf")
\ No newline at end of file @@ -6,29 +6,17 @@ rules_proto_dependencies() rules_proto_toolchains() -# Test-only dependencies. - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "com_google_googletest", - sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2", - strip_prefix = "googletest-release-1.12.1", - urls = [ - "https://mirror.bazel.build/github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz", - "https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz", - ], -) -http_archive( - name = "bazelci_rules", - sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", - strip_prefix = "bazelci_rules-1.0.0", - url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz", -) +# Dev-only dependencies. USERS SHOULD NOT INSTALL THESE! +load(":dev_deps.bzl", "rules_proto_dev_deps") +rules_proto_dev_deps() -load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig") +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +protobuf_deps() + + +load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig") rbe_preconfig( name = "buildkite_config", toolchain = "ubuntu1804-bazel-java11", diff --git a/dev_deps.bzl b/dev_deps.bzl new file mode 100644 index 0000000..8924465 --- /dev/null +++ b/dev_deps.bzl @@ -0,0 +1,44 @@ +"""dev dependencies needed to develop rules_proto""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + + +def rules_proto_dev_deps(): + http_archive( + name = "rules_cc", + sha256 = "4aeb102efbcfad509857d7cb9c5456731e8ce566bfbf2960286a2ec236796cc3", + strip_prefix = "rules_cc-2f8c04c04462ab83c545ab14c0da68c3b4c96191", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/2f8c04c04462ab83c545ab14c0da68c3b4c96191.tar.gz", + "https://github.com/bazelbuild/rules_cc/archive/2f8c04c04462ab83c545ab14c0da68c3b4c96191.tar.gz", + ], + ) + + http_archive( + name = "com_google_googletest", + sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2", + strip_prefix = "googletest-release-1.12.1", + urls = [ + "https://mirror.bazel.build/github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz", + "https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz", + ], + ) + + http_archive( + name = "bazelci_rules", + sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", + strip_prefix = "bazelci_rules-1.0.0", + urls = [ + "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz", + ], + ) + + http_archive( + name = "com_google_protobuf", + sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", + strip_prefix = "protobuf-21.7", + urls = [ + "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", + "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", + ], + )
\ No newline at end of file diff --git a/proto/BUILD b/proto/BUILD index 907b091..4cbb2a0 100644 --- a/proto/BUILD +++ b/proto/BUILD @@ -29,9 +29,6 @@ bzl_library( "repositories.bzl", ], visibility = ["//visibility:public"], - deps = [ - "//proto/private:dependencies", - ], ) # Toolchain type provided by proto_toolchain rule and used by proto_library diff --git a/proto/private/BUILD b/proto/private/BUILD index f45f4ed..92ef5fd 100644 --- a/proto/private/BUILD +++ b/proto/private/BUILD @@ -1,12 +1,6 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") bzl_library( - name = "dependencies", - srcs = ["dependencies.bzl"], - visibility = ["//proto:__subpackages__"], -) - -bzl_library( name = "native", srcs = ["native.bzl"], visibility = ["//proto:__subpackages__"], diff --git a/proto/private/BUILD.protoc b/proto/private/BUILD.protoc deleted file mode 100644 index cfcbf32..0000000 --- a/proto/private/BUILD.protoc +++ /dev/null @@ -1,18 +0,0 @@ -load("@rules_proto//proto/private:dependencies.bzl", "protoc_binary") - -protoc_binary( - name = "protoc", - srcs = select({ - ":windows": ["bin/protoc.exe"], - "//conditions:default": ["bin/protoc"], - }), - executable = "protoc.exe", - visibility = ["//visibility:public"], -) - -config_setting( - name = "windows", - constraint_values = [ - "@platforms//os:windows", - ], -) diff --git a/proto/private/BUILD.release b/proto/private/BUILD.release deleted file mode 100644 index a12828d..0000000 --- a/proto/private/BUILD.release +++ /dev/null @@ -1,164 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain") - -# Use precompiled binaries where possible. -alias( - name = "protoc", - actual = select({ - ":linux-aarch64": "@com_google_protobuf_protoc_linux_aarch64//:protoc", - ":linux-ppc": "@com_google_protobuf_protoc_linux_ppc//:protoc", - ":linux-s390x": "@com_google_protobuf_protoc_linux_s390_64//:protoc", - ":linux-x86_32": "@com_google_protobuf_protoc_linux_x86_32//:protoc", - ":linux-x86_64": "@com_google_protobuf_protoc_linux_x86_64//:protoc", - ":macos-aarch64": "@com_google_protobuf_protoc_macos_aarch64//:protoc", - ":macos-x86_64": "@com_google_protobuf_protoc_macos_x86_64//:protoc", - ":windows-x86_32": "@com_google_protobuf_protoc_windows_x86_32//:protoc", - ":windows-x86_64": "@com_google_protobuf_protoc_windows_x86_64//:protoc", - "//conditions:default": "@com_github_protocolbuffers_protobuf//:protoc", - }), - visibility = ["//visibility:public"], -) - -# Use the jars from maven. -alias( - name = "protobuf_java", - actual = "@com_google_protobuf_protobuf_java//jar", - visibility = ["//visibility:public"], -) - -alias( - name = "protobuf_java_util", - actual = "@com_google_protobuf_protobuf_java_util//jar", - visibility = ["//visibility:public"], -) - -alias( - name = "protobuf_javalite", - actual = "@com_google_protobuf_protobuf_javalite//jar", - visibility = ["//visibility:public"], -) - -proto_lang_toolchain( - name = "java_toolchain", - command_line = "--java_out=$(OUT)", - runtime = ":protobuf_java", - visibility = ["//visibility:public"], -) - -proto_lang_toolchain( - name = "javalite_toolchain", - command_line = "--java_out=lite:$(OUT)", - runtime = ":protobuf_javalite", - visibility = ["//visibility:public"], -) - -# Redirect everything else to the source -redirect_targets = [ - "wrappers_proto", - "well_known_type_protos", - "timestamp_proto", - "struct_proto", - "python_specific_test_protos_genproto", - "python_common_test_protos_genproto", - "protobuf_python_genproto", - "protobuf_python", - "protobuf_objc", - "protobuf_headers", - "objectivec", - "field_mask_proto", - "empty_proto", - "duration_proto", - "compiler_plugin_proto", - "descriptor_proto", - "cc_wkt_protos", - "cc_toolchain", - "cc_test_protos_genproto", - "cc_wkt_protos_genproto", - "api_proto", - "type_proto", - "source_context_proto", - "any_proto", - "protoc_lib", - "protobuf", - "protobuf_lite", -] - -[ - alias( - name = target, - actual = "@com_github_protocolbuffers_protobuf//:" + target, - visibility = ["//visibility:public"], - ) - for target in redirect_targets -] - -config_setting( - name = "linux-aarch64", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:aarch64", - ], -) - -config_setting( - name = "linux-ppc", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:ppc", - ], -) - -config_setting( - name = "linux-s390x", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:s390x", - ], -) - -config_setting( - name = "linux-x86_32", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:x86_32", - ], -) - -config_setting( - name = "linux-x86_64", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], -) - -config_setting( - name = "macos-aarch64", - constraint_values = [ - "@platforms//os:osx", - "@platforms//cpu:arm64", - ], -) - -config_setting( - name = "macos-x86_64", - constraint_values = [ - "@platforms//os:osx", - "@platforms//cpu:x86_64", - ], -) - -config_setting( - name = "windows-x86_32", - constraint_values = [ - "@platforms//os:windows", - "@platforms//cpu:x86_32", - ], -) - -config_setting( - name = "windows-x86_64", - constraint_values = [ - "@platforms//os:windows", - "@platforms//cpu:x86_64", - ], -) diff --git a/proto/private/dependencies.bzl b/proto/private/dependencies.bzl deleted file mode 100644 index fca301c..0000000 --- a/proto/private/dependencies.bzl +++ /dev/null @@ -1,220 +0,0 @@ -# Copyright 2019 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""All development and production dependencies of rules_proto.""" - -dependencies = { - "bazel_skylib": { - "sha256": "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", - "urls": [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", - ], - }, - "com_github_protocolbuffers_protobuf": { - "sha256": "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae", - "strip_prefix": "protobuf-21.7", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", - "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz", - ], - }, - "com_google_protobuf_protoc_linux_aarch64": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "2696a8f9a61ce67c510d000c88e2d0a8b5adf1f90514e461e8d8943c46d04737", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-aarch_64.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-aarch_64.zip", - ], - }, - "com_google_protobuf_protoc_linux_ppc": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "ffa8298f1e64d25e09e2389edf8093fa1a70d34a042623aca769b4f7815e5490", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-ppcle_64.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-ppcle_64.zip", - ], - }, - "com_google_protobuf_protoc_linux_s390_64": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "983c1139e0e4ce6121028e0408919cd7a35a5c813f2df40066b05f822c1df226", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-s390_64.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-s390_64.zip", - ], - }, - "com_google_protobuf_protoc_linux_x86_32": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "f245128a20586fc24dcd3f64a417313a228372fb37fe108d039b8927489b1b88", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-x86_32.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-x86_32.zip", - ], - }, - "com_google_protobuf_protoc_linux_x86_64": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "0a260c6df439bcf1ecdd5e38e7a7648e4edf99c1a22a4cc66ce8e62c53bdb837", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-x86_64.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-x86_64.zip", - ], - }, - "com_google_protobuf_protoc_macos_aarch64": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "f79a67d708aba6ff2c6208578a6f2bf94f1528795aed646b65e99d4a678c97f8", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-osx-aarch_64.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-osx-aarch_64.zip", - ], - }, - "com_google_protobuf_protoc_macos_x86_64": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "cd3609fa1efc73db9c58fc63e40b240558eb2a8080b4fbfbe1c4b93bbedecc20", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-osx-x86_64.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-osx-x86_64.zip", - ], - }, - "com_google_protobuf_protoc_windows_x86_32": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "1e3856cc5fc5074e566c7b8da90f74d2b5b6a80e3df9eafb4a86f7bb8ab32772", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-win32.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-win32.zip", - ], - }, - "com_google_protobuf_protoc_windows_x86_64": { - "build_file": "@rules_proto//proto/private:BUILD.protoc", - "sha256": "954cc5dfdb1d95d4c448c40f274d3720c018f73187b0c19b3c4f9bacc48d1ff0", - "urls": [ - "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-win64.zip", - "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-win64.zip", - ], - }, - # Dependency of `com_github_protocolbuffers_protobuf`. - "rules_cc": { - "sha256": "4aeb102efbcfad509857d7cb9c5456731e8ce566bfbf2960286a2ec236796cc3", - "strip_prefix": "rules_cc-2f8c04c04462ab83c545ab14c0da68c3b4c96191", - "urls": [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/2f8c04c04462ab83c545ab14c0da68c3b4c96191.tar.gz", - "https://github.com/bazelbuild/rules_cc/archive/2f8c04c04462ab83c545ab14c0da68c3b4c96191.tar.gz", - ], - }, - # Dependency of `com_github_protocolbuffers_protobuf`. - "rules_java": { - "sha256": "9a72d1bade803e1913d1e0a6f8beb35786fa3e8e460c98a56d2054200b9f6c5e", - "strip_prefix": "rules_java-385292fcfd244186e5e5811122ed32cf214a9024", - "urls": [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/385292fcfd244186e5e5811122ed32cf214a9024.tar.gz", - "https://github.com/bazelbuild/rules_java/archive/385292fcfd244186e5e5811122ed32cf214a9024.tar.gz", - ], - }, - # Dependency of `com_github_protocolbuffers_protobuf`. - "rules_pkg": { - "sha256": "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", - "urls": [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", - "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", - ], - }, - # Dependency of `com_github_protocolbuffers_protobuf`. - "rules_python": { - "sha256": "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6", - "strip_prefix": "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27", - "urls": [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz", - "https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz", - ], - }, - # Dependency of `com_github_protocolbuffers_protobuf`. - "zlib": { - "build_file": "@com_github_protocolbuffers_protobuf//:third_party/zlib.BUILD", - "sha256": "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9", - "strip_prefix": "zlib-1.2.12", - "urls": [ - "https://mirror.bazel.build/zlib.net/zlib-1.2.12.tar.gz", - "https://zlib.net/zlib-1.2.12.tar.gz", - ], - }, -} - -maven_dependencies = { - "com_google_protobuf_protobuf_java": { - "jar_sha256": "a204ec68748a7b26351ae37a311e8de468f248d1916d5f8dbe812c1289d0a0ff", - "jar_urls": [ - "https://mirror.bazel.build/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.21.7/protobuf-java-3.21.7.jar", - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.21.7/protobuf-java-3.21.7.jar", - ], - "srcjar_sha256": "c664e12e6e3fea801477edf95014980a8a96528d3904d2add90c68b5d047a6c2", - "srcjar_urls": [ - "https://mirror.bazel.build/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.21.7/protobuf-java-3.21.7-sources.jar", - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.21.7/protobuf-java-3.21.7-sources.jar", - ], - }, - "com_google_protobuf_protobuf_java_util": { - "jar_sha256": "9b98a2a4eb9ebc6103b14ab81badb82e32c8fe1d751aa4055830424974b7e142", - "jar_urls": [ - "https://mirror.bazel.build/repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util/3.21.7/protobuf-java-util-3.21.7.jar", - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util/3.21.7/protobuf-java-util-3.21.7.jar", - ], - "srcjar_sha256": "43b9188848b01cec71d34326868e25c102b2a344c6ef1072d54c3681559c5f57", - "srcjar_urls": [ - "https://mirror.bazel.build/repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util/3.21.7/protobuf-java-util-3.21.7-sources.jar", - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util/3.21.7/protobuf-java-util-3.21.7-sources.jar", - ], - }, - "com_google_protobuf_protobuf_javalite": { - "jar_sha256": "43945d791ece2012bb9086907e124ff814afd4014209f67cc89e7f324390c061", - "jar_urls": [ - "https://mirror.bazel.build/repo1.maven.org/maven2/com/google/protobuf/protobuf-javalite/3.21.7/protobuf-javalite-3.21.7.jar", - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-javalite/3.21.7/protobuf-javalite-3.21.7.jar", - ], - "srcjar_sha256": "e1c557e98c59d10dbd657c69a1e15b7585a592402f12c78026f9d0bfb605c310", - "srcjar_urls": [ - "https://mirror.bazel.build/repo1.maven.org/maven2/com/google/protobuf/protobuf-javalite/3.21.7/protobuf-javalite-3.21.7-sources.jar", - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-javalite/3.21.7/protobuf-javalite-3.21.7-sources.jar", - ], - }, -} - -def _protobuf_workspace_impl(ctx): - ctx.symlink(ctx.attr._build, "BUILD") - ctx.symlink(ctx.attr._protobuf_bzl, "protobuf.bzl") - ctx.symlink(ctx.attr._protobuf_deps_bzl, "protobuf_deps.bzl") - -protobuf_workspace = repository_rule( - implementation = _protobuf_workspace_impl, - attrs = { - "_build": attr.label(default = "@rules_proto//proto/private:BUILD.release"), - "_protobuf_bzl": attr.label(default = "@com_github_protocolbuffers_protobuf//:protobuf.bzl"), - "_protobuf_deps_bzl": attr.label(default = "@com_github_protocolbuffers_protobuf//:protobuf_deps.bzl"), - }, -) - -def protoc_binary(name, srcs, executable, **kwargs): - """protoc_binary makes a copy of the protoc binary to bazel-bin. - -This is a workaround to make sure protoc can be used with attributes -which don't allow files.""" - - # TODO(yannic) replace this with a symlink after https://github.com/bazelbuild/bazel/pull/10695 - native.genrule( - name = name, - executable = True, - srcs = srcs, - outs = [executable], - cmd_bash = "cp $< $@ && chmod +x $@", - cmd_bat = "copy $< $@", - **kwargs - ) diff --git a/proto/private/generate_sums.sh b/proto/private/generate_sums.sh deleted file mode 100755 index 0c8ea20..0000000 --- a/proto/private/generate_sums.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2020 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e -o pipefail -VERSION=$1 -if [ -z "$VERSION" ]; then - echo "usage: $0 version" - exit 1 -fi - -URLS=( - "https://github.com/protocolbuffers/protobuf/archive/v${VERSION}.tar.gz" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-aarch_64.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-ppcle_64.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-s390_64.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-x86_32.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-x86_64.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-osx-aarch_64.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-osx-x86_64.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-win32.zip" - "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-win64.zip" - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.${VERSION}/protobuf-java-3.${VERSION}.jar" - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.${VERSION}/protobuf-java-3.${VERSION}-sources.jar" - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util/3.${VERSION}/protobuf-java-util-3.${VERSION}.jar" - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util/3.${VERSION}/protobuf-java-util-3.${VERSION}-sources.jar" - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-javalite/3.${VERSION}/protobuf-javalite-3.${VERSION}.jar" - "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-javalite/3.${VERSION}/protobuf-javalite-3.${VERSION}-sources.jar" -) - -for U in "${URLS[@]}"; do - echo "Downloading '${U}'..." - MU="https://mirror.bazel.build/${U#"https://"}" - SUM=$(curl -L --fail -q "$U" | shasum -a 256 | cut -d' ' -f1) - echo "" - echo " \"sha256\": \"${SUM}\"," - echo " \"urls\": [" - echo " \"$MU\"," - echo " \"$U\"," - echo " ]," -done - -echo "******************** IMPORTANT ********************" -echo "" -echo "Please upload the following files to mirror.bazel.build:" -echo "" -for U in "${URLS[@]}"; do - echo " $U" -done diff --git a/proto/repositories.bzl b/proto/repositories.bzl index 86440a3..3cf220c 100644 --- a/proto/repositories.bzl +++ b/proto/repositories.bzl @@ -15,21 +15,21 @@ """Dependencies and toolchains required to use rules_proto.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") -load("//proto/private:dependencies.bzl", "dependencies", "maven_dependencies", "protobuf_workspace") def rules_proto_dependencies(): """An utility method to load all dependencies of `rules_proto`. Loads the remote repositories used by default in Bazel. """ - - for name in dependencies: - maybe(http_archive, name, **dependencies[name]) - for name in maven_dependencies: - maybe(java_import_external, name, **maven_dependencies[name]) - protobuf_workspace(name = "com_google_protobuf") + maybe( + http_archive, + name = "bazel_skylib", + sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", + urls = [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", + ], + ) def rules_proto_toolchains(): """An utility method to load all Protobuf toolchains.""" |