Comments (18)
Looks good to me.
from pb-and-k.
Yes, you need kotlin and protobufjs deps. The conformance/conformance-js tests show this kinda, but I agree there does need to be a JS example. Not sure if I plan to publish to npm though.
from pb-and-k.
I see both kotlin.js and protobuf.js (from the light distro) coming down the wire. (via network tab in chrome). They show up before pbandk-runtime-js.js. I stuck a console.log in kotlin.js and protobuf.js so I could confirm they were being started..
Kotlin is loaded
Proto buf is loaded
pbandk-runtime-js.js:11402 Uncaught ReferenceError: module is not defined
at pbandk-runtime-js.js:11402
It must be something simple with javascript and modules to which I'm ignorant -- but figuring out what I'm ignorant about is proving frustrating..:)
from pb-and-k.
@Radisovik - I know this is an old issue and you may not need it anymore, but I have put an example in master. Feedback appreciated. I'll close this on next release.
from pb-and-k.
Thanks for the heads up.. I'll go check it out. I ended up putting off my serialization woes and just using JSON until I could get pb and k working within my build. My problems center around the fact that I'm not using any sort of module system. (I think). I'll go check out your example and see!
from pb-and-k.
I had also not been using kotlin-frontend-plugin since it wasn't up to date with gradle multi-platform.. but now it is!
from pb-and-k.
did you miss checking in a settings.gradle file for the example?
Project directory 'XXXXX/pb-and-k/examples/browser-js' is not part of the build defined by settings file 'XXXXX/pb-and-k/settings.gradle'. If this is an unrelated build, it must have it's own settings file.
from pb-and-k.
You don't need a settings.gradle
file for a single project named the same as the directory. How are you running this and what gradle version are you using?
from pb-and-k.
I'm on gradle 5.0 -- is pb and k still only working with 4.7? (oh how I miss the gradle wrapper! :) ) I'm just changing to the examples/browser-js directory and typing "gradle build"
from pb-and-k.
Haven't tried with 5 I don't think, latest 4.x is what I was using (oh how annoying it would be to now have checked in the gradle wrapper 4 times for 3 examples and the root and make sure to upgrade them all each gradle update :-) ).
I will try and get back to you.
from pb-and-k.
I went back to 4.7 and it got farther. I am now down to:
- What went wrong:
Execution failed for task ':generateProto'.
Codegen plugin kotlin not defined
Was going to check the path to the batch -- but getting pulled away by the kids. Will check back later.
from pb-and-k.
@Radisovik - Yeah, I'm getting that too strangely even with protoc-gen-kotlin
on the PATH. May have to be hand-set, checking...
EDIT: Confirmed, doing some changes now...
from pb-and-k.
Ok, I confirmed this is caused by 0.8.6 in https://github.com/google/protobuf-gradle-plugin and fixed in 0.8.7. Updating all examples...
from pb-and-k.
Ok, fixed for Gradle 4.x, it now properly uses protoc-gen-kotlin
on the PATH
(also basically released 0.3.0 of this lib). Now checking 5.x...
from pb-and-k.
Ok, Gradle 5 does require a local settings.gradle file (completely empty is fine) or it looks up parent paths which I don't like but meh. So I can touch a few files. However, Kotlin frontend plugin has problems. I opened up an issue at #13.
Let me know if this now works for you w/ Gradle 4.x.
from pb-and-k.
In the example -- it looks like addressbook.kt is generated after compiling the kotlin code?
To illustrate -- if I remove addressbook.kt -- I get compile failures -- because Web.kt depends on it. But shouldn't the code generator kicked in and created it before the kotlin compiler? (I know this is a nuance.. and one might argue that is okay... as long as you always check your generated files into source control... but if that is the intent its something that should be documented)
from pb-and-k.
@Radisovik - it is a personal preference of mine to check in the generated code and generate manually. But I admit it's not the most common. I can change it (I think I have to just reenable compileJava and add that file to gitignore), will do it next week.
from pb-and-k.
@Radisovik - Take a peek at my recent commit. I just added the task as a dependency of the compileKotlin2Js
task. Is the example reasonable now?
from pb-and-k.
Related Issues (12)
- gradle installDist fails with error HOT 17
- Support pluggable grpc service generation via ServiceLoader-like plugin HOT 2
- Packed Bool EOF Conformance Test Failure in Latest Protobuf Suite HOT 2
- Gradle 5.0 Compat/Update
- [Feature Request] Support for visibility config
- Provide a protoc-gen-kotlin maven artifact that's compatible with the protobuf gradle plugin
- Add build instructions to README HOT 11
- Repeated fields of non-numeric values should be marked "never packed" HOT 1
- Kotlin Native support HOT 4
- If no package is set then compile fails HOT 4
- Is it possible to support generate .proto file from a .kt model file? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pb-and-k.