-
Notifications
You must be signed in to change notification settings - Fork 94
Conversation
Fix windows CI? |
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.
LGTM
/cc @cgrushko |
Add example that uses it under a karma test. Fixes bazelbuild#61
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 great! I'm excited to see how you'll remove the need for the rollup.config
message Car { | ||
string make = 1; | ||
string model = 2; | ||
int32 year = 3; |
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 might consider exercising your test with a message containing an int64. pbjs
has a couple of modes for handing int64
in JS and one of the requires that the long
node_module be used. We should test that we integrated that scenario correctly
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.
thanks, good point
examples/tsconfig.json
Outdated
@@ -1,7 +1,8 @@ | |||
{ | |||
"compilerOptions": { | |||
"strict": true, | |||
"lib": ["es2015.promise", "dom", "es5"] | |||
"lib": ["es2015.promise", "dom", "es5"], | |||
"rootDirs": [".", "../bazel-bin/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.
Is this for editor support of generated files?
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.
Yes, exactly, I'll add a comment
cc @iirina |
/cc @pherl - anyone from your team care to be in the loop for Bazel / TypeScript proto usage? |
@@ -106,6 +116,7 @@ ts_devserver = rule( | |||
"serving_path": attr.string(), | |||
"data": attr.label_list(allow_files = True, cfg = "data"), | |||
"static_files": attr.label_list(allow_files = True), | |||
"bootstrap": attr.label_list(allow_files = [".js"]), | |||
# User scripts for the devserver to concat before the source files | |||
"scripts": attr.label_list(allow_files = True), |
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.
Suppose it is correct to limit scripts to [".js"] as well
type_blacklisted_declarations = [], | ||
es5_sources = depset([js_es5]), | ||
es6_sources = depset([js_es6]), | ||
transitive_es5_sources = depset(), |
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 tried this PR out and had issues because the transitive sources here don't include the normal sources. I think transitive should be direct + indirect sources? In my case this causes issues when this is read by collect_es6_sources which only reads transitive_es6_sources
...
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.
Thanks! I didn't test it in a production bundle, that's missing here...
My 2 cents - ts_proto_library should be implemented in terms of a Bazel Aspect (I scanned the code and didn't see anything about it). |
Carmi, what would such an aspect do? Is there actually an action to cache
at each proto_library node in the graph? In this case, the proto compiler
does a global compilation over all the transitive sources so I don't think
it would be an improvement, and adds complexity.
…On Fri, May 4, 2018 at 7:21 AM Carmi Grushko ***@***.***> wrote:
My 2 cents - ts_proto_library should be implemented in terms of a Bazel
Aspect (I scanned the code and didn't see anything about it).
There are some details in
https://blog.bazel.build/2017/02/27/protocol-buffers.html (look for
"Bazel Aspects").
If this is already using Aspects, sorry, please disregard :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#193 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC5I-OECUywVWwjTKnsmA6miH85B1W8ks5tvGP-gaJpZM4Tq_mQ>
.
|
For all languages, protoc reads all transitive sources, and this step is
unavoidable (due to protoc architecture) but also super cheap.
OTOH, compiling the TS files themselves could he expensive. Java and C++
are expensive enough to be worth it. Remember that the number of compiled
files is quadratic in the depth of the dependency tree.
The bigger problem is ODR, though - without aspects you will end up with
the same symbols generated by multiple rules. Depending on the language
this could lead to linking errors (e.g. C++) or output file conflicts if
the name of the output is derived from the names of the .proto files.
Aspects also allow parallelism when compiling the generated files, vs
transitive compilation.
…On Fri, May 4, 2018, 10:37 Alex Eagle ***@***.***> wrote:
Carmi, what would such an aspect do? Is there actually an action to cache
at each proto_library node in the graph? In this case, the proto compiler
does a global compilation over all the transitive sources so I don't think
it would be an improvement, and adds complexity.
On Fri, May 4, 2018 at 7:21 AM Carmi Grushko ***@***.***>
wrote:
> My 2 cents - ts_proto_library should be implemented in terms of a Bazel
> Aspect (I scanned the code and didn't see anything about it).
> There are some details in
> https://blog.bazel.build/2017/02/27/protocol-buffers.html (look for
> "Bazel Aspects").
> If this is already using Aspects, sorry, please disregard :)
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#193 (comment)
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AAC5I-OECUywVWwjTKnsmA6miH85B1W8ks5tvGP-gaJpZM4Tq_mQ
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#193 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB5_YYVnb6lsxQoAp-bWr3S__cD4LNd3ks5tvGehgaJpZM4Tq_mQ>
.
|
Add example that uses it under a karma test.
Fixes #61
/cc @kellycampbell