-
Notifications
You must be signed in to change notification settings - Fork 87
Fix closure-js output #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Sorry about that. We have bigint codepaths internally that are exposed at the setter/getter level. We don't presently have that functionality in open source, so I tried to remove the references in the reader/writer code during the backport. The correct thing to do here would be to clean up any remaining references that I previously missed. Adding an explicit cast should be OK. We actively rely on those packing targets, especially dist_zip. Removing them will break the release process, so please restore them. |
BUILD.bazel
Outdated
|
|
||
| filegroup( | ||
| name = "dist_all", | ||
| name = "javascript", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have no objection to keeping this file group, but we need to keep the dist targets. They are used after running gulp dist (aka npm run build): https://github.com/protocolbuffers/protobuf-javascript/blob/main/.github/workflows/build.yml#L73-L101
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just use a patch I guess. This should really be re-thought though... The root BUILD file of the project is simply broken. Among other things the project can't be published to the bazel central registry in this state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not wrong. The existing state is extremely fragile and a general pain. I'd much prefer to get everything into bazel, but I'm not presently well acquainted with the non-google bazel ecosystem.
Taking a step back for a moment: was your original motivation here to try to publish this project to BCR? Is there an FR you'd consider filing to make this project more usable to you as a closure user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have several projects that rely on rules_closure, which in a previous state made it possible to use open-source versions of the closure-library + closure-templates + protobuf-javascript. rules_closure has been stripped down to pretty much only support j2cl. I have a fork of rules_closure that adds all that back in, and relies on protobuf-javascript (https://github.com/stackb/rules_closure/blob/main/MODULE.bazel#L39-L46).
If you have interest, I could prepare a PR that adds the BCR and github workflow boilerplate to publish to the BCR, which would make it easier to consume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm interested and would accept that PR.
Separately, # NOTE: cannot upgrade past protobuf editions..., we permit edition 2023 as of 4.0.0. Conformance failures are listed in https://github.com/protocolbuffers/protobuf-javascript/blob/main/conformance/failing_tests.txt
Following #238, emitted closure js code is broken.
The issues I observe are as follows:
Missing function
.writeZigzagVarint64BigInt:The
binary/encoder.jshas multiple references to a function that simply does not exist:This PR shims that with:
Missing shim for
jspb.ByteSourceThe
js_generator.ccfile emits broken code that includes@param {jspb.ByteSource} bytes The bytes to deserialize, butjspb.ByteSourceno longer exists. Other code external to this repo still relies on this type also. The generator has been updated to reference the correct type, and a new shim filebinary/bytesource_alias.jshas been added.Broken import
The code in
internal_public.jsappears incorrect:This code does compile:
Explicit non-null cast needed
The closure-compiler rejects
jspb.Message.clone_(jspb.asserts.assert(o))but is OK withjspb.Message.clone_(/** @type {!Object} */(jspb.asserts.assert(o)))Out-of-date bazel packaging code
The deleted targets like
:dist_filesreference seemingly non-existent files and fails withError in glob: glob pattern 'google/protobuf/*.js' didn't match anything, but allow_empty is set to False (the default value of allow_empty can be set with --incompatible_disallow_empty_glob)..I took the liberty of removing these, and added a convenience glob to access the necessary
.jsfiles that represents thepbjslibrary. I could take this out of the PR and just use a patch instead however.