pubref / rules_kotlin

Bazel rules for Kotlin
Other
159 stars 20 forks source link

Make the protobuf dependencies lazy or use precompiled archives. #29

Closed hsyed closed 7 years ago

hsyed commented 7 years ago

Loading the kotlin_binary rule triggers the build of some native libraries (protobuf, maybe others). It's a slightly time consuming step, so I am wondering if this step is necessary -- I haven't compiled any proto with Bazel yet so I don't know what the other language rules offering protobuf support do.

pcj commented 7 years ago

Hi @hsyed the bazel worker code introduced this step. https://github.com/pubref/rules_kotlin/commit/e82156d1fc6e370e0c2aa2905d517aeb53f5c0bb. It makes the compilation of kotlin faster and internally uses protobuf for communication/serialization with bazel itself, and so does require all that initial setup.

I think it would be possible to make use of the bazel worker optional.

hsyed commented 7 years ago

@pcj Fast is always good :D -- the Kotlin build do have a longer turn around than java builds though. I noticed the kotlin build uses the Kotlin Console ? Without the worker it will probably be unbearable.

Would it be possible to use packaged versions of the dependencies (http_archive) ? Other rules must be making use of this feature. Might be able to borrow the packaged packaged dependency logic, (the Scala rules maybe).

pcj commented 7 years ago

@hsyed I checked in the generated proto and removed dependencies on the protobuf compiler. Should be fine as the worker.proto file will change very infrequently if at all.

A clean run of bazel run //examples/helloworld:main_kt following bazel clean --expunge is now 30s vs 2m30s on my machine. Assuming travis passes will merge shortly.

See #30

pcj commented 7 years ago

Closed by #30