Skip to content
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

Modernize protobuf rule #263

Merged
merged 2 commits into from
Apr 13, 2018
Merged

Conversation

Yannic
Copy link
Contributor

@Yannic Yannic commented Apr 12, 2018

This CL adds a new proto rule which works with Bazel's native |proto_library| rules.
We also upgrade travis to a newer version of Bazel.

Closes #190

cc: @hochhaus

@Yannic Yannic changed the title Modernize protobuf Modernize protobuf rules Apr 12, 2018
@Yannic Yannic changed the title Modernize protobuf rules Modernize protobuf rule Apr 12, 2018
@jameswex
Copy link
Collaborator

@Yannic I just started some work in tensorboard and needed this exact thing to exist, so thanks!

@jart Patching in this PR, then updating tensorboard's 3 collect_js calls to match the now-changed API, I was able to build the example protos in tensorflow using closure_proto_library and have that as a dep in my tensorboard tf_web_library component and successfully see it work in my tensorflow_html_binary demo server for that new component.

@jart
Copy link
Contributor

jart commented Apr 13, 2018

verified test this please (I hope this is the right incantation for Bazel CI these days)

@Yannic
Copy link
Contributor Author

Yannic commented Apr 13, 2018

excludes=()
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
# https://github.com/bazelbuild/rules_closure/issues/247
excludes+=('//closure/testing/test:noto_fonts_render_as_expected')
Copy link
Contributor

Choose a reason for hiding this comment

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

I would welcome a PR commenting out that test rule, saying, "hey this sometimes works, and is an example of what you could do, depending on your environment." If you do this, please also revert the complexity that rule added to this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

if ctx.files.externs:
print("closure_js_library 'externs' is deprecated; just use 'srcs'")
srcs = ctx.files.externs + srcs
def closure_js_library_impl(
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a lot of surface area change here. I feel comfortable with this because you took the time to write more tests. Thank you. I'll do further integration testing with dependent projects afterwards, at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to make sure there are no changes to the behavior of closure_js_library.
Let me know if you encounter one.

srcs, deps, testonly, suppress,
closure_library_base, closure_library_deps, _ClosureWorker,

includes=[],
Copy link
Contributor

Choose a reason for hiding this comment

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

Please note that Skylark may have the same problem as Python. If you say includes=[] instead of includes=() then code might accidentally mutate the default value. That doesn't seem to be happening here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I didn't think about that.

"CLOSURE_LIBRARY_DEPS_ATTR",
"unfurl")

# This was taken from https://github.com/bazelbuild/rules_go/blob/67f44035d84a352cffb9465159e199066ecb814c/proto/compiler.bzl#L72
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't take things. We're just borrowing code with the same copyright / license :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jart
Copy link
Contributor

jart commented Apr 13, 2018

Thanks for the contribution. I'm merging now to get folks unblocked. LGTM

@jart jart merged commit dbb9684 into bazelbuild:master Apr 13, 2018
@Yannic Yannic deleted the closure_proto_library branch April 13, 2018 20:39
Copy link
Contributor Author

@Yannic Yannic left a comment

Choose a reason for hiding this comment

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

Thanks for your quick review. I'll create a follow-up addressing your comments.

excludes=()
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
# https://github.com/bazelbuild/rules_closure/issues/247
excludes+=('//closure/testing/test:noto_fonts_render_as_expected')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

if ctx.files.externs:
print("closure_js_library 'externs' is deprecated; just use 'srcs'")
srcs = ctx.files.externs + srcs
def closure_js_library_impl(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to make sure there are no changes to the behavior of closure_js_library.
Let me know if you encounter one.

srcs, deps, testonly, suppress,
closure_library_base, closure_library_deps, _ClosureWorker,

includes=[],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I didn't think about that.

"CLOSURE_LIBRARY_DEPS_ATTR",
"unfurl")

# This was taken from https://github.com/bazelbuild/rules_go/blob/67f44035d84a352cffb9465159e199066ecb814c/proto/compiler.bzl#L72
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

ptmphuong pushed a commit to ptmphuong/rules_closure that referenced this pull request Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants