Revert most of #237 and #238 (#243)
As the review of #241 showed, `--incompatible_enable_proto_toolchain_resolution` is not ready yet; we will re-add support for it in Stardoc when we no longer need to register our own protoc toolchain in Stardoc's MODULE.bazel file.
The only parts of #237 we keep are the rules_jvm_external and rules_proto dep bumps; note that the rules_proto dep bump in turn requires a new dependency on bazel_features when using a Stardoc distro release with `--noenable_blzmod.`
Also revert most of #238 - we're no longer testing `--incompatible_enable_proto_toolchain_resolution`
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index 0244f63..387dffc 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -5,16 +5,9 @@
- ubuntu2004
- macos
-.incompatible_flags: &incompatible_flags
- ? "--config=incompatible"
-
.noenable_bzlmod_flags: &noenable_bzlmod_flags
? "--noenable_bzlmod"
-.incompatible_noenable_bzlmod_flags: &incompatible_noenable_bzlmod_flags
- ? "--config=incompatible"
- ? "--noenable_bzlmod"
-
.windows_flags: &windows_flags
# Workaround for https://github.com/bazelbuild/continuous-integration/issues/1012
? "--noexperimental_repository_cache_hardlinks"
@@ -25,11 +18,6 @@
test_targets:
- "//..."
-.incompatible_task_config: &incompatible_task_config
- <<: *common_task_config
- build_flags: *incompatible_flags
- test_flags: *incompatible_flags
-
.noenable_bzlmod_task_config: &noenable_bzlmod_task_config
build_flags: *noenable_bzlmod_flags
build_targets:
@@ -46,11 +34,6 @@
- "//test:table_of_contents_noenable_bzlmod_test"
- "//test:local_repository_test"
-.incompatible_noenable_bzlmod_task_config: &incompatible_noenable_bzlmod_task_config
- <<: *noenable_bzlmod_task_config
- build_flags: *incompatible_noenable_bzlmod_flags
- test_flags: *incompatible_noenable_bzlmod_flags
-
.windows_task_config: &windows_task_config
<<: *common_task_config
build_flags: *windows_flags
@@ -62,11 +45,6 @@
name: Build and test
platform: ${{ platform }}
- build_and_test_incompatible:
- <<: *incompatible_task_config
- name: Build and test - incompatible flags
- platform: ${{ platform }}
-
build_and_test_windows:
<<: *windows_task_config
name: Build and test - Windows
@@ -77,11 +55,6 @@
name: Build and test - legacy WORKSPACE setup
platform: ${{ platform }}
- incompatible_noenable_bzlmod:
- <<: *incompatible_noenable_bzlmod_task_config
- name: Build and test - legacy WORKSPACE setup with incompatible flags
- platform: ${{ platform }}
-
build_and_test_last_green:
<<: *common_task_config
name: Build and test - Bazel last green
@@ -100,12 +73,6 @@
platform: ${{ platform }}
working_directory: test/bzlmod
- bzlmod_usage_incompatible:
- <<: *incompatible_task_config
- name: Stardoc Bzlmod module usage test - incompatible flags
- platform: ${{ platform }}
- working_directory: test/bzlmod
-
bzlmod_usage_windows:
<<: *windows_task_config
name: Stardoc Bzlmod module usage test - Windows
diff --git a/.bazelrc b/.bazelrc
index 33808dd..b968cdc 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -4,6 +4,3 @@
# Incompatible flags which we always want in development
build --incompatible_disable_starlark_host_transitions
build --incompatible_disallow_empty_glob
-
-# Incompatible flags to test in a dedicated CI pipeline.
-build:incompatible --incompatible_enable_proto_toolchain_resolution
diff --git a/MODULE.bazel b/MODULE.bazel
index 772f583..6fe8c48 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -9,8 +9,6 @@
bazel_dep(name = "rules_java", version = "7.6.1")
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 = [
@@ -19,7 +17,6 @@
"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")
@@ -39,5 +36,3 @@
#
# 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 d7e67ac..a8f1d4c 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -67,12 +67,15 @@
rules_pkg_dependencies()
-# Needed as a transitive dependency of @io_bazel
-http_archive(
- name = "rules_proto",
- 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",
+# Needed only for testing stardoc across local-repository bounds.
+local_repository(
+ name = "stardoc", # alias the Bzlmod name of the Stardoc repo for local_repository_test
+ path = ".",
+)
+
+local_repository(
+ name = "local_repository_test",
+ path = "test/testdata/local_repository_test",
)
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
@@ -86,27 +89,3 @@
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.
-local_repository(
- name = "stardoc", # alias the Bzlmod name of the Stardoc repo for local_repository_test
- path = ".",
-)
-
-local_repository(
- name = "local_repository_test",
- path = "test/testdata/local_repository_test",
-)
-
-register_toolchains("//toolchains:all")
diff --git a/deps.bzl b/deps.bzl
index 35574b7..647a3cd 100644
--- a/deps.bzl
+++ b/deps.bzl
@@ -16,6 +16,8 @@
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@rules_jvm_external//:defs.bzl", "maven_install")
+load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
+load("@rules_proto//proto:setup.bzl", "rules_proto_setup")
# Maven artifacts required by Stardoc; keep consistent with MODULE.bazel
STARDOC_MAVEN_ARTIFACTS = [
@@ -24,7 +26,6 @@
"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():
@@ -41,8 +42,6 @@
stardoc_pinned_maven_install()
```
"""
- protobuf_deps()
-
maven_install(
name = "stardoc_maven",
artifacts = STARDOC_MAVEN_ARTIFACTS,
@@ -53,3 +52,10 @@
],
strict_visibility = True,
)
+
+ protobuf_deps()
+
+ rules_proto_dependencies()
+
+ # Note rules_proto_setup() requires @bazel_features - we define it in stardoc_repositories()
+ rules_proto_setup()
diff --git a/maven_install.json b/maven_install.json
index a3a69ae..3706219 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": 1794655755,
- "__RESOLVED_ARTIFACTS_HASH": 2130017368,
+ "__INPUT_ARTIFACTS_HASH": -1307151106,
+ "__RESOLVED_ARTIFACTS_HASH": 1764595048,
"artifacts": {
"com.beust:jcommander": {
"shasums": {
@@ -57,12 +57,6 @@
},
"version": "1.3"
},
- "com.google.protobuf:protobuf-java": {
- "shasums": {
- "jar": "798c79f6c9fc6859cc76aa5474228aad250821438e1004dad34880d53aa745f9"
- },
- "version": "4.27.1"
- },
"com.google.truth:truth": {
"shasums": {
"jar": "fc0b67782289a2aabfddfdf99eff1dcd5edc890d49143fcd489214b107b8f4f3"
@@ -172,10 +166,6 @@
"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"
],
@@ -265,7 +255,6 @@
"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",
@@ -273,5 +262,6 @@
"org.ow2.asm:asm"
]
},
+ "services": {},
"version": "2"
}
diff --git a/setup.bzl b/setup.bzl
index 985c2b3..9ebab24 100644
--- a/setup.bzl
+++ b/setup.bzl
@@ -70,14 +70,6 @@
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(
@@ -88,6 +80,17 @@
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
)
+ # Transitive dep of rules_proto. Pull in explicitly to allow calling both
+ # rules_proto_dependencies() and rules_proto_setup() in stardoc_external_deps() without forcing
+ # users to add yet another intermediate load() in their WORKSPACE files.
+ maybe(
+ http_archive,
+ name = "bazel_features",
+ sha256 = "0f23d75c7623d6dba1fd30513a94860447de87c8824570521fcc966eda3151c2",
+ strip_prefix = "bazel_features-1.4.1",
+ url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.4.1/bazel_features-v1.4.1.tar.gz",
+ )
+
# Transitive dep of com_google_protobuf. Unfortunately, protobuf_deps()
# pulls in a dep that's too old.
maybe(
diff --git a/test/bzlmod/.bazelrc b/test/bzlmod/.bazelrc
index 305a751..7a949e8 100644
--- a/test/bzlmod/.bazelrc
+++ b/test/bzlmod/.bazelrc
@@ -6,5 +6,3 @@
build --incompatible_disable_starlark_host_transitions
build --incompatible_disallow_empty_glob
-# Incompatible flags to test in a dedicated CI pipeline.
-build:incompatible --incompatible_enable_proto_toolchain_resolution
diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel
deleted file mode 100644
index 3e02065..0000000
--- a/toolchains/BUILD.bazel
+++ /dev/null
@@ -1,12 +0,0 @@
-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",
-)