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

Add bootjar so that codegenerator can be included as artifact #14

Closed
wants to merge 1 commit into from

Conversation

phcoder
Copy link

@phcoder phcoder commented Jan 26, 2019

This allows inclusing of pb-and-k from maven without any need of local
installation

This allows inclusing of pb-and-k from maven without any need of local
installation
@cretz
Copy link
Owner

cretz commented Jan 26, 2019

I don't really use spring (and many others don't either) and in general I'm not wanting to infect my build script with it. Assuming I understand the purpose here, why use maven to get the JAR if you need it all self-contained? If you want a self-contained release, there are release packages downloadable from the release area.

Can you help me understand why you need a self-contained executable boot jar instead of the executable already provided by assemble?

@phcoder
Copy link
Author

phcoder commented Jan 26, 2019

Many projects are distributed as gradle projects. The expectation is that you can compile them by typing './gradlew assembleDebug' without preinstalling anything. Having to preinstall pb-and-k breaks this expectation with this patch I can put in build.gradle
plugins {
kotlin {
artifact '....'
}
}
and gradle will automatically download pb-and-k. Unfortunately this doesn't work with standard jar.
Alternative is to have and distribute throught maven native compilations of protoc-gen-kotlin for linux-i386, linux-x64, osx-i386, osx-x64, windows. I have seen protoc-gen-kotlin-native but so far didn't manage to even compile it:
phcoder@penguin:~/pb-and-k$ ./gradlew :protoc-gen-kotlin:protoc-gen-kotlin-native

.....

  • What went wrong:
    Task 'protoc-gen-kotlin-native' not found in project ':protoc-gen-kotlin'.

@cretz
Copy link
Owner

cretz commented Jan 26, 2019

I have seen protoc-gen-kotlin-native but so far didn't manage to even compile it

I mention in the README under "Not Yet Implemented": "Protobuf code generator in Kotlin Native for easier importing". Currently the protoc-gen-kotlin generator is only built for the JVM. As mentioned in the README, to build the protoc-gen-kotlin code generator:

path/to/gradle :protoc-gen-kotlin:protoc-gen-kotlin-jvm:assembleDist

That builds the artifacts that you can also download in the releases area. To have the artifacts locally, you can run installDist instead of assembleDist and the artifacts will be in the build/install folder.

Maybe if you can tell me exactly what you are trying to do I can help you find the best way.

@phcoder
Copy link
Author

phcoder commented Jan 26, 2019

Yes "Protobuf code generator in Kotlin Native for easier importing" is exactly what I want. Maybe it would make sense if I prepare the PR to make "Protobuf code generator in Kotlin Native" work?

@cretz
Copy link
Owner

cretz commented Jan 26, 2019

@phcoder - Sure. The JVM one works fine btw, but a native one would be nice, but it's not a requirement to use the project in any way. I have already done most of the abstraction as common code at protoc-gen-kotlin/protoc-gen-kotlin-common. Just implement Platform.kt for native in protoc-gen-kotlin/protoc-gen-kotlin-native the same way I did for the JVM. You can even just throw from the serviceGenerator method for now.

One of the problems you might run into is converting bytes to CodeGeneratorRequest/CodeGeneratorResponse. This is because you can't dogfood this project until #7 is complete.

@phcoder
Copy link
Author

phcoder commented Jan 26, 2019

@cretz It seems thatit's possible to remove dependency on platform protobuf libraries. Trying to do it, let's see how it goes. How important is it to keep api source-compatible? I'd like to make Marshaller an abstract class with ByteArrayMarshaller available on all the platforms and then platform providing only functions to read/write from stream

@phcoder
Copy link
Author

phcoder commented Jan 26, 2019

I'm implementing #7 in pure kotlin. Wait couple of days

@phcoder phcoder closed this Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants