Skip to content

Commit

Permalink
Load rules_proto correctly, include com_google_protobuf because trans…
Browse files Browse the repository at this point in the history
…itive deps are fun.
  • Loading branch information
restingbull committed Dec 2, 2024
1 parent b2a77b3 commit b9fc275
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ common --enable_bzlmod=true
common:rbe --java_runtime_version=11
common:rbe --tool_java_runtime_version=11

common:workspace --enable_bzlmod=false --enable_workspace=true

build --strategy=KotlinCompile=worker
build --test_output=all
build --verbose_failures
Expand Down
8 changes: 7 additions & 1 deletion src/main/starlark/core/repositories/download.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ def kt_download_local_dev_dependencies():
"""
Downloads all necessary http_* artifacts for rules_kotlin dev configuration.
Must be called before setup_dependencies in the versions.WORKSPACE.
Must be called before setup_dependencies in the WORKSPACE.
"""

versions.use_repository(
name = "com_google_protobuf",
rule = http_archive,
version = versions.COM_GOOGLE_PROTOBUF,
)

versions.use_repository(
name = "rules_proto",
version = versions.RULES_PROTO,
Expand Down
10 changes: 8 additions & 2 deletions src/main/starlark/core/repositories/setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
load("@cgrindel_bazel_starlib//:deps.bzl", "bazel_starlib_dependencies")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
load("@released_rules_kotlin//src/main/starlark/core/repositories:initialize.bzl", release_kotlin_repositories = "kotlin_repositories")
load("@rules_bazel_integration_test//bazel_integration_test:deps.bzl", "bazel_integration_test_rules_dependencies")
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
load("@rules_jvm_external//:defs.bzl", "maven_install")
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
Expand All @@ -32,6 +34,12 @@ def kt_configure():

native.register_toolchains("@released_rules_kotlin//kotlin/internal:default_toolchain")

protobuf_deps()
rules_proto_dependencies()

rules_java_dependencies()
rules_java_toolchains()

maven_install(
name = "kotlin_rules_maven",
fetch_sources = True,
Expand Down Expand Up @@ -71,8 +79,6 @@ def kt_configure():
rules_cc_dependencies()
rules_cc_toolchains()

rules_proto_dependencies()

rules_pkg_dependencies()

stardoc_repositories()
Expand Down
8 changes: 8 additions & 0 deletions src/main/starlark/core/repositories/versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,13 @@ versions = struct(
sha256 = "f4aadd8387f381033a9ad0500443a52a0cea5f8ad1ede4369d3c614eb7b2682e",
strip_prefix_template = "rules_cc-{version}",
),
COM_GOOGLE_PROTOBUF = version(
version = "27.1",
sha256 = "6fbe2e6f703bcd3a246529c2cab586ca12a98c4e641f5f71d51fde09eb48e9e7",
strip_prefix_template = "protobuf-{version}",
url_templates = [
"https://github.com/protocolbuffers/protobuf/archive/v{version}.tar.gz",
],
),
use_repository = _use_repository,
)

0 comments on commit b9fc275

Please sign in to comment.