diff --git a/MODULE.bazel b/MODULE.bazel index d55deab..60fe0c7 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -6,9 +6,11 @@ module( ) bazel_dep(name = "bazel_skylib", version = "1.4.2") -bazel_dep(name = "rules_java", version = "6.3.0") -bazel_dep(name = "rules_jvm_external", version = "5.2") +bazel_dep(name = "rules_java", version = "7.4.0") +bazel_dep(name = "rules_jvm_external", version = "6.1") bazel_dep(name = "rules_license", version = "0.0.7") +bazel_dep(name = "rules_proto", version = "6.0.2") +bazel_dep(name = "toolchains_protoc", version = "0.3.1") # Maven artifacts required by Stardoc; keep consistent with deps.bzl STARDOC_MAVEN_ARTIFACTS = [ @@ -17,6 +19,7 @@ STARDOC_MAVEN_ARTIFACTS = [ "com.google.guava:guava:31.1-jre", "com.google.truth:truth:1.1.3", "junit:junit:4.13.2", + "com.google.protobuf:protobuf-java:4.27.1", ] maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") @@ -34,3 +37,5 @@ use_repo(maven, "stardoc_maven") # Dev-only and test-only dependencies bazel_dep(name = "rules_pkg", version = "0.10.1", dev_dependency = True) + +register_toolchains("//toolchains:all") diff --git a/WORKSPACE b/WORKSPACE index bc2138f..102bd1e 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -70,11 +70,29 @@ rules_pkg_dependencies() # Needed as a transitive dependency of @io_bazel http_archive( name = "rules_proto", - sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", - strip_prefix = "rules_proto-5.3.0-21.7", - urls = [ - "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", - ], + sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", + strip_prefix = "rules_proto-6.0.2", + url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz", +) + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") +rules_proto_dependencies() + +load("@rules_proto//proto:setup.bzl", "rules_proto_setup") +rules_proto_setup() + +load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") +rules_proto_toolchains() + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + +load("@toolchains_protoc//protoc:toolchain.bzl", "protoc_toolchains") + +protoc_toolchains( + name = "protoc_toolchains", + version = "v27.1", ) # Needed only for testing stardoc across local-repository bounds. @@ -83,13 +101,29 @@ local_repository( path = ".", ) +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") +rules_proto_dependencies() + +load("@rules_proto//proto:setup.bzl", "rules_proto_setup") +rules_proto_setup() + +load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") +rules_proto_toolchains() + +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + +load("@toolchains_protoc//protoc:toolchain.bzl", "protoc_toolchains") + +protoc_toolchains( + name = "protoc_toolchains", + version = "v25.3", +) + local_repository( name = "local_repository_test", path = "test/testdata/local_repository_test", ) -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") - -rules_proto_dependencies() - -rules_proto_toolchains() +register_toolchains("//toolchains:all") diff --git a/deps.bzl b/deps.bzl index 65bf7b9..35574b7 100644 --- a/deps.bzl +++ b/deps.bzl @@ -24,6 +24,7 @@ STARDOC_MAVEN_ARTIFACTS = [ "com.google.guava:guava:31.1-jre", "com.google.truth:truth:1.1.3", "junit:junit:4.13.2", + "com.google.protobuf:protobuf-java:4.27.1", ] def stardoc_external_deps(): diff --git a/maven_install.json b/maven_install.json index d5755ea..a3a69ae 100644 --- a/maven_install.json +++ b/maven_install.json @@ -1,7 +1,7 @@ { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": -1307148388, - "__RESOLVED_ARTIFACTS_HASH": 1764595048, + "__INPUT_ARTIFACTS_HASH": 1794655755, + "__RESOLVED_ARTIFACTS_HASH": 2130017368, "artifacts": { "com.beust:jcommander": { "shasums": { @@ -57,6 +57,12 @@ }, "version": "1.3" }, + "com.google.protobuf:protobuf-java": { + "shasums": { + "jar": "798c79f6c9fc6859cc76aa5474228aad250821438e1004dad34880d53aa745f9" + }, + "version": "4.27.1" + }, "com.google.truth:truth": { "shasums": { "jar": "fc0b67782289a2aabfddfdf99eff1dcd5edc890d49143fcd489214b107b8f4f3" @@ -166,6 +172,10 @@ "com.google.j2objc:j2objc-annotations": [ "com.google.j2objc.annotations" ], + "com.google.protobuf:protobuf-java": [ + "com.google.protobuf", + "com.google.protobuf.compiler" + ], "com.google.truth:truth": [ "com.google.common.truth" ], @@ -255,6 +265,7 @@ "com.google.guava:guava", "com.google.guava:listenablefuture", "com.google.j2objc:j2objc-annotations", + "com.google.protobuf:protobuf-java", "com.google.truth:truth", "junit:junit", "org.checkerframework:checker-qual", diff --git a/setup.bzl b/setup.bzl index d9baa7a..b70effa 100644 --- a/setup.bzl +++ b/setup.bzl @@ -44,19 +44,17 @@ def stardoc_repositories(): http_archive, name = "rules_java", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_java/releases/download/6.3.0/rules_java-6.3.0.tar.gz", - "https://github.com/bazelbuild/rules_java/releases/download/6.3.0/rules_java-6.3.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_java/releases/download/7.4.0/rules_java-7.4.0.tar.gz", + "https://github.com/bazelbuild/rules_java/releases/download/7.4.0/rules_java-7.4.0.tar.gz", ], - sha256 = "29ba147c583aaf5d211686029842c5278e12aaea86f66bd4a9eb5e525b7f2701", + sha256 = "976ef08b49c929741f201790e59e3807c72ad81f428c8bc953cdbeff5fed15eb", ) - RULES_JVM_EXTERNAL_TAG = "5.2" - RULES_JVM_EXTERNAL_SHA = "f86fd42a809e1871ca0aabe89db0d440451219c3ce46c58da240c7dcdc00125f" + RULES_JVM_EXTERNAL_TAG = "6.1" + RULES_JVM_EXTERNAL_SHA = "08ea921df02ffe9924123b0686dc04fd0ff875710bfadb7ad42badb931b0fd50" maybe( http_archive, name = "rules_jvm_external", - patch_args = ["-p1"], - patches = ["@io_bazel_stardoc//:rules_jvm_external.patch"], strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, sha256 = RULES_JVM_EXTERNAL_SHA, url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG), @@ -72,16 +70,22 @@ def stardoc_repositories(): sha256 = "4531deccb913639c30e5c7512a054d5d875698daeb75d8cf90f284375fe7c360", ) + maybe( + http_archive, + name = "toolchains_protoc", + sha256 = "3898f8e621ca5b3c7b94300c5ae19075d5bb28349d6e6f407490a466ba1e2544", + strip_prefix = "toolchains_protoc-0.3.1", + url = "https://github.com/aspect-build/toolchains_protoc/releases/download/v0.3.1/toolchains_protoc-v0.3.1.tar.gz", + ) + # Transitive dep of com_google_protobuf. Unfortunately, protobuf_deps() # pulls in a dep that's too old. maybe( http_archive, name = "rules_proto", - sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", - strip_prefix = "rules_proto-5.3.0-21.7", - urls = [ - "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", - ], + sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", + strip_prefix = "rules_proto-6.0.2", + url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz", ) # Transitive dep of com_google_protobuf. Unfortunately, protobuf_deps() diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel new file mode 100644 index 0000000..3e02065 --- /dev/null +++ b/toolchains/BUILD.bazel @@ -0,0 +1,12 @@ +proto_lang_toolchain( + name = "protoc_java_toolchain", + command_line = "--java_out=%s", + progress_message = "Generating Java proto_library %{label}", + runtime = "@stardoc_maven//:com_google_protobuf_protobuf_java", +) + +toolchain( + name = "protoc_java_toolchain.registration", + toolchain = ":protoc_java_toolchain", + toolchain_type = "@rules_java//java/proto:toolchain_type", +)