Skip to content

Commit

Permalink
Revert most of bazelbuild#237
Browse files Browse the repository at this point in the history
As the review of bazelbuild#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 bazelbuild#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.
  • Loading branch information
tetromino committed Jul 9, 2024
1 parent da374a5 commit 5fb954b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 71 deletions.
5 changes: 0 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ bazel_dep(name = "bazel_skylib", version = "1.6.1")
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 = [
Expand All @@ -19,7 +17,6 @@ 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")
Expand All @@ -39,5 +36,3 @@ 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")
39 changes: 9 additions & 30 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

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")
Expand All @@ -86,27 +89,3 @@ 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.
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")
12 changes: 9 additions & 3 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -24,7 +26,6 @@ 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():
Expand All @@ -41,8 +42,6 @@ def stardoc_external_deps():
stardoc_pinned_maven_install()
```
"""
protobuf_deps()

maven_install(
name = "stardoc_maven",
artifacts = STARDOC_MAVEN_ARTIFACTS,
Expand All @@ -53,3 +52,10 @@ def stardoc_external_deps():
],
strict_visibility = True,
)

protobuf_deps()

rules_proto_dependencies()

# Note rules_proto_setup() requires @bazel_features - we define it in stardoc_repositories()
rules_proto_setup()
16 changes: 3 additions & 13 deletions maven_install.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
],
Expand Down Expand Up @@ -265,13 +255,13 @@
"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",
"org.hamcrest:hamcrest-core",
"org.ow2.asm:asm"
]
},
"services": {},
"version": "2"
}
19 changes: 11 additions & 8 deletions setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ 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(
Expand All @@ -88,6 +80,17 @@ def stardoc_repositories():
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(
Expand Down
12 changes: 0 additions & 12 deletions toolchains/BUILD.bazel

This file was deleted.

0 comments on commit 5fb954b

Please sign in to comment.