-
Notifications
You must be signed in to change notification settings - Fork 764
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
Add bazel rule closure_grpc_web_library #219
Conversation
Wow, this is great! Thanks for the contribution! I will take a closer look shortly. Will let test run first. |
ctx.attr._grpc_web_clientreadablestream, | ||
ctx.attr._grpc_web_error, | ||
ctx.attr._grpc_web_grpcwebclientbase | ||
] |
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 wonder why only these 4 classes? Why not Status
and StatusCode
etc?
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.
We only need to add the directly goog.required
classes to deps, Status
, StatusCode
, etc are included as transitive deps by those 4 classes.
https://github.com/grpc/grpc-web/blob/master/javascript/net/grpc/web/grpc_generator.cc#L409
(Only mode GrpcWeb
seems to be open source).
), | ||
"_grpc_web_grpcwebclientbase": attr.label( | ||
default = Label("//javascript/net/grpc/web:grpcwebclientbase"), | ||
), |
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.
Ditto, why just these 4 classes?
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.
See above
sha256 = "a80acb69c63d5f6437b099c111480a4493bad4592015af2127a2f49fb7512d8d", | ||
strip_prefix = "rules_closure-0.7.0", | ||
sha256 = "248a7a98eb3962d9f0013e543ea79c5063a83bac7af349ebf412d844e6ab3035", | ||
strip_prefix = "rules_closure-53f2cab21fa6c608f32f114387d88ffd7868c5fc", |
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.
Why this particular commit? Something new available after 0.7.0?
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.
This commit includes bazelbuild/rules_closure#278, which is required for this because closure_proto_aspect
, which we need to generate the normal proto js files, is not exposed by rules_closure
(Everything which starts with _
is private in bazel).
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.
So we can only merge this PR after bazelbuild/rules_closure#278 got merged right?
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.
Technically you can merge this, you'll just be dependent on a commit that's not in rules_closure
's master
branch (until it gets merged, that is).
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.
It's exactly like @oferb said, there is no technical reason to block this until the other PR is merged.
ctx.attr._grpc_web_clientreadablestream, | ||
ctx.attr._grpc_web_error, | ||
ctx.attr._grpc_web_grpcwebclientbase | ||
] |
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.
We only need to add the directly goog.required
classes to deps, Status
, StatusCode
, etc are included as transitive deps by those 4 classes.
https://github.com/grpc/grpc-web/blob/master/javascript/net/grpc/web/grpc_generator.cc#L409
(Only mode GrpcWeb
seems to be open source).
), | ||
"_grpc_web_grpcwebclientbase": attr.label( | ||
default = Label("//javascript/net/grpc/web:grpcwebclientbase"), | ||
), |
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.
See above
sha256 = "a80acb69c63d5f6437b099c111480a4493bad4592015af2127a2f49fb7512d8d", | ||
strip_prefix = "rules_closure-0.7.0", | ||
sha256 = "248a7a98eb3962d9f0013e543ea79c5063a83bac7af349ebf412d844e6ab3035", | ||
strip_prefix = "rules_closure-53f2cab21fa6c608f32f114387d88ffd7868c5fc", |
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.
This commit includes bazelbuild/rules_closure#278, which is required for this because closure_proto_aspect
, which we need to generate the normal proto js files, is not exposed by rules_closure
(Everything which starts with _
is private in bazel).
bazel/closure_grpc_web_library.bzl
Outdated
), | ||
'import_style': attr.string( | ||
default = 'closure', | ||
values = ['closure', 'commonjs'], |
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 think I'd like to remove commonjs
as a possible value for now. Most of rules_closure
doesn't work with commonjs
anyway.
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.
Is it because the output of this rule is expected to mostly feed into other closure_js_library
rule, which expects goog.require()
style includes anyways?
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.
The restriction to goog.require()
is required because closure_proto_{aspect,library}
(which generates the protobuf messages for us to avoid duplicate provide errors) does not support commonjs
import style (yet). I will create a follow-up PR once this is fixed in rules_closure (Maybe we can create an issue for this and assign it to me).
I just want to confirm the goal of this:
|
scripts/kokoro.sh
Outdated
@@ -25,6 +25,7 @@ docker build -t grpc-web:ubuntu_16_04 \ | |||
docker-compose build | |||
|
|||
bazel test javascript/net/grpc/web/... | |||
bazel test net/grpc/gateway/examples/... |
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.
Looks like this needs to be bazel build
for now, instead of bazel test
. Since there's no test target for now, the exit status of this command is 4, which invalidates the whole kokoro run.
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.
Done
Exactly.
Well, the |
No description provided.