Skip to content

feat: allow proto_library as js_library#dep - #2721

Merged
alexeagle merged 6 commits into
mainfrom
protoc-gen-es
Feb 11, 2026
Merged

feat: allow proto_library as js_library#dep#2721
alexeagle merged 6 commits into
mainfrom
protoc-gen-es

Conversation

@alexeagle

@alexeagle alexeagle commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Design:

  • user expected to register a toolchain providing their protoc plugin for gen-es
  • use an aspect to adapt ProtoInfo to JsInfo, so a proto_library target can appear anywhere a js_library does
  • no need for js_proto_library targets to pollute the package where the proto_library appears
  • similar to feat: allow proto_library as rb_library#dep bazel-contrib/rules_ruby#292

Example of use currently in aspect-build/rules_ts#894

TODO:

  • for typescript, place .d.ts files in the source tree, with @kormide using diff.bzl as a validation action. Maybe this belongs in rules_ts
  • support connect_query - we didn't have any test/example usage of it

Design:
- user expected to register a toolchain providing their protoc plugin for gen-es
- Adapt ProtoInfo to JsInfo so a proto_library target can appear anywhere a js_library does

Example of use currently in aspect-build/rules_ts#894
@github-actions

github-actions Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Status Count
🔍 Total 159
✅ Successful 137
⏳ Timeouts 0
🔀 Redirected 17
👻 Excluded 0
❓ Unknown 0
🚫 Errors 5
⛔ Unsupported 0

Errors per input

Errors in docs/pnpm.md

Errors in docs/README.md

Errors in docs/troubleshooting.md

Errors in README.md

Redirects per input

Redirects in docs/README.md

Redirects in docs/troubleshooting.md

Redirects in README.md

Comment thread js/toolchains/BUILD
@@ -0,0 +1,3 @@
package(default_visibility = ["//visibility:public"])

toolchain_type(name = "protoc_plugin")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dzbarsky should we drop this in contrib_toolchains ?

@aspect-workflows

aspect-workflows Bot commented Feb 11, 2026

Copy link
Copy Markdown

Bazel 7 (Test)

Buildkite build #12135 is running...


Bazel 8 (Test)

All tests were cache hits

275 tests (100.0%) were fully cached saving 37s.


Bazel 9 (Test)

All tests were cache hits

275 tests (100.0%) were fully cached saving 35s.


Bazel 7 (Test)

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 634ms.


Bazel 8 (Test)

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 819ms.


Bazel 9 (Test)

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 701ms.


Bazel 7 (Test)

e2e/git_dep_metadata

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Bazel 8 (Test)

e2e/git_dep_metadata

All tests were cache hits

1 test (100.0%) was fully cached saving 23ms.


Bazel 9 (Test)

e2e/git_dep_metadata

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Bazel 7 (Test)

e2e/gyp_no_install_script

All tests were cache hits

2 tests (100.0%) were fully cached saving 149ms.


Bazel 8 (Test)

e2e/gyp_no_install_script

All tests were cache hits

1 test (100.0%) was fully cached saving 53ms.


Bazel 9 (Test)

e2e/gyp_no_install_script

All tests were cache hits

1 test (100.0%) was fully cached saving 84ms.


Bazel 7 (Test)

e2e/js_binary_workspace

All tests were cache hits

1 test (100.0%) was fully cached saving 44ms.


Bazel 8 (Test)

e2e/js_binary_workspace

All tests were cache hits

1 test (100.0%) was fully cached saving 37ms.


Bazel 9 (Test)

e2e/js_binary_workspace

All tests were cache hits

1 test (100.0%) was fully cached saving 35ms.


Bazel 7 (Test)

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 6s.


Bazel 7 (Test)

e2e/npm_link_package

All tests were cache hits

2 tests (100.0%) were fully cached saving 227ms.


Bazel 8 (Test)

e2e/npm_link_package

All tests were cache hits

2 tests (100.0%) were fully cached saving 266ms.


Bazel 9 (Test)

e2e/npm_link_package

All tests were cache hits

2 tests (100.0%) were fully cached saving 202ms.


Bazel 7 (Test)

e2e/npm_link_package-esm

All tests were cache hits

2 tests (100.0%) were fully cached saving 269ms.


Bazel 8 (Test)

e2e/npm_link_package-esm

All tests were cache hits

2 tests (100.0%) were fully cached saving 625ms.


Bazel 9 (Test)

e2e/npm_link_package-esm

All tests were cache hits

2 tests (100.0%) were fully cached saving 248ms.


Bazel 7 (Test)

e2e/npm_link_package-rerooted

All tests were cache hits

2 tests (100.0%) were fully cached saving 251ms.


Bazel 8 (Test)

e2e/npm_link_package-rerooted

All tests were cache hits

2 tests (100.0%) were fully cached saving 230ms.


Bazel 9 (Test)

e2e/npm_link_package-rerooted

All tests were cache hits

2 tests (100.0%) were fully cached saving 231ms.


Bazel 7 (Test)

e2e/npm_translate_lock

All tests were cache hits

3 tests (100.0%) were fully cached saving 701ms.


Bazel 8 (Test)

e2e/npm_translate_lock

All tests were cache hits

3 tests (100.0%) were fully cached saving 416ms.


Bazel 9 (Test)

e2e/npm_translate_lock

All tests were cache hits

3 tests (100.0%) were fully cached saving 455ms.


Bazel 7 (Test)

e2e/npm_translate_lock_disable_hooks

All tests were cache hits

3 tests (100.0%) were fully cached saving 268ms.


Bazel 8 (Test)

e2e/npm_translate_lock_disable_hooks

All tests were cache hits

1 test (100.0%) was fully cached saving 26ms.


Bazel 9 (Test)

e2e/npm_translate_lock_disable_hooks

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/npm_translate_lock_empty

All tests were cache hits

2 tests (100.0%) were fully cached saving 132ms.


Bazel 8 (Test)

e2e/npm_translate_lock_empty

All tests were cache hits

2 tests (100.0%) were fully cached saving 123ms.


Bazel 9 (Test)

e2e/npm_translate_lock_empty

All tests were cache hits

2 tests (100.0%) were fully cached saving 105ms.


Bazel 7 (Test)

e2e/npm_translate_lock_exclude_package_contents

All tests were cache hits

1 test (100.0%) was fully cached saving 33ms.


Bazel 8 (Test)

e2e/npm_translate_lock_exclude_package_contents

All tests were cache hits

1 test (100.0%) was fully cached saving 40ms.


Bazel 9 (Test)

e2e/npm_translate_lock_exclude_package_contents

All tests were cache hits

1 test (100.0%) was fully cached saving 86ms.


Bazel 7 (Test)

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 106ms.


Bazel 8 (Test)

e2e/npm_translate_lock_multi

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 113ms.


Bazel 7 (Test)

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 26ms.


Bazel 8 (Test)

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 28ms.


Bazel 9 (Test)

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 38ms.


Bazel 7 (Test)

e2e/npm_translate_lock_replace_packages

All tests were cache hits

4 tests (100.0%) were fully cached saving 393ms.


Bazel 8 (Test)

e2e/npm_translate_lock_replace_packages

All tests were cache hits

4 tests (100.0%) were fully cached saving 385ms.


Bazel 9 (Test)

e2e/npm_translate_lock_replace_packages

All tests were cache hits

4 tests (100.0%) were fully cached saving 424ms.


Bazel 7 (Test)

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 94ms.


Bazel 8 (Test)

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 67ms.


Bazel 9 (Test)

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 67ms.


Bazel 7 (Test)

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 25ms.


Bazel 8 (Test)

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 26ms.


Bazel 9 (Test)

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 25ms.


Bazel 8 (Test)

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 26ms.


Bazel 9 (Test)

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 32ms.


Bazel 7 (Test)

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 224ms.


Bazel 8 (Test)

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 275ms.


Bazel 9 (Test)

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 312ms.


Bazel 7 (Test)

e2e/patch_from_repo

All tests were cache hits

1 test (100.0%) was fully cached saving 25ms.


Bazel 7 (Test)

e2e/pnpm_lockfiles

All tests were cache hits

37 tests (100.0%) were fully cached saving 4s.


Bazel 8 (Test)

e2e/pnpm_lockfiles

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/pnpm_lockfiles

All tests were cache hits

11 tests (100.0%) were fully cached saving 1s.


Bazel 7 (Test)

e2e/pnpm_repo_install

All tests were cache hits

1 test (100.0%) was fully cached saving 840ms.


Bazel 8 (Test)

e2e/pnpm_repo_install

All tests were cache hits

1 test (100.0%) was fully cached saving 1s.


Bazel 9 (Test)

e2e/pnpm_repo_install

All tests were cache hits

1 test (100.0%) was fully cached saving 1s.


Bazel 7 (Test)

e2e/pnpm_version

All tests were cache hits

1 test (100.0%) was fully cached saving 56ms.


Bazel 8 (Test)

e2e/pnpm_version

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/pnpm_version

All tests were cache hits

1 test (100.0%) was fully cached saving 58ms.


Bazel 7 (Test)

e2e/pnpm_workspace

All tests were cache hits

15 tests (100.0%) were fully cached saving 3s.


Bazel 8 (Test)

e2e/pnpm_workspace

All tests were cache hits

14 tests (100.0%) were fully cached saving 2s.


Bazel 9 (Test)

e2e/pnpm_workspace

All tests were cache hits

14 tests (100.0%) were fully cached saving 3s.


Bazel 7 (Test)

e2e/pnpm_workspace_deps

All tests were cache hits

3 tests (100.0%) were fully cached saving 355ms.


Bazel 8 (Test)

e2e/pnpm_workspace_deps

All tests were cache hits

3 tests (100.0%) were fully cached saving 384ms.


Bazel 9 (Test)

e2e/pnpm_workspace_deps

All tests were cache hits

3 tests (100.0%) were fully cached saving 410ms.


Bazel 7 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12135 is running...


Bazel 8 (Test)

e2e/pnpm_workspace_rerooted

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/pnpm_workspace_rerooted

All tests were cache hits

14 tests (100.0%) were fully cached saving 2s.


Bazel 7 (Test)

e2e/repo_mapping

Buildkite build #12135 is running...


Bazel 8 (Test)

e2e/repo_mapping

All tests were cache hits

3 tests (100.0%) were fully cached saving 212ms.


Bazel 9 (Test)

e2e/repo_mapping

All tests were cache hits

3 tests (100.0%) were fully cached saving 333ms.


Bazel 7 (Test)

e2e/runfiles

All tests were cache hits

1 test (100.0%) was fully cached saving 179ms.


Bazel 8 (Test)

e2e/runfiles

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/runfiles

Buildkite build #12135 is running...


Bazel 7 (Test)

e2e/stamped_package_json

All tests were cache hits

1 test (100.0%) was fully cached saving 48ms.


Bazel 8 (Test)

e2e/stamped_package_json

All tests were cache hits

1 test (100.0%) was fully cached saving 39ms.


Bazel 9 (Test)

e2e/stamped_package_json

All tests were cache hits

1 test (100.0%) was fully cached saving 130ms.


Bazel 7 (Test)

e2e/vendored_node

All tests were cache hits

1 test (100.0%) was fully cached saving 126ms.


Bazel 8 (Test)

e2e/vendored_node

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/vendored_node

Buildkite build #12135 is running...


Bazel 7 (Test)

e2e/vendored_tarfile

All tests were cache hits

1 test (100.0%) was fully cached saving 25ms.


Bazel 8 (Test)

e2e/vendored_tarfile

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/vendored_tarfile

Buildkite build #12135 is running...


Bazel 7 (Test)

e2e/verify_patches

All tests were cache hits

2 tests (100.0%) were fully cached saving 92ms.


Bazel 8 (Test)

e2e/verify_patches

Buildkite build #12135 is running...


Bazel 9 (Test)

e2e/verify_patches

All tests were cache hits

2 tests (100.0%) were fully cached saving 120ms.


Bazel 7 (Test)

e2e/worker

All tests were cache hits

1 test (100.0%) was fully cached saving 75ms.


Bazel 8 (Test)

e2e/worker

All tests were cache hits

1 test (100.0%) was fully cached saving 62ms.


Bazel 9 (Test)

e2e/worker

All tests were cache hits

1 test (100.0%) was fully cached saving 92ms.


Buildifier      Format

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5210cdb3d7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
@alexeagle alexeagle changed the title feat: add js_proto_toolchain feat: allow proto_library as js_library#dep Feb 11, 2026
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl
@jbedard

jbedard commented Feb 11, 2026

Copy link
Copy Markdown
Member

If this is the direction other rulesets such as ruby then I definitely think we should do the same.

It might be nice to land this for the v3 release, which I thought was basically ready to go until seeing this...

Comment thread js/private/proto.bzl Outdated

@dzbarsky dzbarsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github changed how comments work, i keep forgetting to submit now...

Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto.bzl Outdated
Comment thread js/private/proto_common.bzl
Comment thread js/private/proto.bzl
@alexeagle
alexeagle merged commit a413051 into main Feb 11, 2026
90 of 95 checks passed
@alexeagle
alexeagle deleted the protoc-gen-es branch February 11, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants