-
Notifications
You must be signed in to change notification settings - Fork 172
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
Bazel Generate Code for Transitive Dependencies #138
Bazel Generate Code for Transitive Dependencies #138
Conversation
So had this PR floating around in the back of my mind recently, I was just wondering if there is any argument against extracting the bazel rules and accompanying tests into their own repository? |
Technically, I don't think there's any reason the rules couldn't be in another repository. However, I think you'd still want to have some of the bazel setup to build the protoc plugin in this repository. |
@Dig-Doug the package-lock.json file is out of sync. Run npm install in the root of the repo to synchronise it, please |
Done, though the CI still fails. When I run |
@Dig-Doug the problem is still with your package-lock.json file, nothing that will be fixed by Can you confirm you are using the node version specified in the |
The first time I ran Any other ideas? |
CI is passing now :) The problem was that some of the urls were switching from http <-> https. I'm using the same node and npm version, so I'm not sure exactly why it's happening. I manually fixed the urls that changed and it's working now. I also updated the bazel verson that's used, since it was very old and causing some issues. |
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.
Awesome work, looking forward to landing this!
Do the bazel install instructions in the Readme need updating as a result of this change?
…ransitive dependencies.
@jonnyreeves - Missed your comment about updating the readme, following up in #142 |
Updates the bazel
typescript_proto_library
rule to use an aspect to generate typescript files for the transitive dependencies of the proto.This pull request builds on the work done here by @Globegitter to make the rule compatible with the rules_typescript library.
Summary of changes:
typescript_proto_library
to use an aspectrules_typescript
version to the latest versionBUILD
files toBUILD.bazel
(the recommended name) and fixes formatting issuestypescript_proto_dependencies
fromdeps
tots_protoc_gen_deps
so it doesn't conflict with other rulestest/bazel
for checking that the transitive files are included//test/bazel:pizza_service_proto_test_suite
will fail until I can include the UMD modules forgprc-web-client
andjs-browser-headers
, which depends on this pull request and this one.Why do you need this?
Imagine you want to use
:service_proto
that has a string of dependencies to other protos:Currently, if you depend on the main
:service_ts_proto
, you also need to create and depend ontypescript_proto_library
rules for all of it's dependencies so that all of the necessary files are included in the final bundle. This becomes unmaintainable when you have a proto that transitively depends on 10s-100s of other files.This change updates the rule so that when you depend on
:service_ts_proto
, TS files are also generated for all dependencies of the service_proto rule and included automatically:API Changes / Compatibility Notes
typescript_proto_library
changes:Removed the
debug
attr: I don't think it is useful to consumers of the rule and rule authors can add logging while developing as neededRemoved the
remove_dependencies
attr: This attribute doesn't really make sense here because you can have twotypescript_proto_library
rules, each with differentremove_dependencies
values, that process the sameproto_library
. Dead code elimination can be handled by other tools.