cretz / pb-and-k

Kotlin Code Generator and Runtime for Protocol Buffers
MIT License
138 stars 15 forks source link

Add build instructions to README #2

Closed cretz closed 6 years ago

Radisovik commented 6 years ago

Just for some added data. Issue #1 refers to my efforts on osx.. but even on linux I run into problems. For example on a linux (via google cloud shell, and running from the top of the newly cloned repo)..

~/gradle-4.8.1/bin/gradle :protoc-gen-kotlin:protoc-gen-kotlin-jvm:installDist

results in:


FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':runtime:runtime-common:classes'.
> Task with path 'compileJava' not found in project ':runtime:runtime-common'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Radisovik commented 6 years ago

~/gradle-4.8.1/bin/gradle :protoc-gen-kotlin:protoc-gen-kotlin-jvm:assemble

Results in the same error

cretz commented 6 years ago

This looks to be a Kotlin + Gradle 4.8 thing. I see it at https://github.com/JetBrains/kotlin-native-calculator-sample/issues/8 too. I have confirmed this issue happens on Gradle 4.8.1 and I have confirmed the build is successful in Gradle 4.7. I will make sure to put that requirement in the docs.

Radisovik commented 6 years ago

Wonder if adding gradle wrapper scripts (gradlew) would be good -- so you could ensure folks are using the known working version of gradle?

cretz commented 6 years ago

It might be...I try to avoid it even though it is common practice. I don't include a certain working JDK :-) If the Gradle 4.8 thing is not fixed soon or this becomes an issue that is too much to document, I will start distributing it. But in general I don't like putting binaries/libs in the repo especially on projects that are usually used in other ways (i.e. as deps or with downloads).

Radisovik commented 6 years ago

I can see that. I wonder if gradle 4.8 was some of the reasons I was having trouble using the protobuf gradle plugin/pb and k as well. I can give that a go later this evening.

cretz commented 6 years ago

Also I need to note that on macOS (and test on Linux too) that the --plugin arg is required and the target dir needs to be present.

cretz commented 6 years ago

@Radisovik - can you confirm that you absolutely have to give the --plugin arg to protoc even if protoc-gen-kotlin is on the PATH and executable on macOS? In other words can you show me the output without the --plugin arg and the output of which protoc-gen-kotlin?

cretz commented 6 years ago

I have independently confirmed on Linux that if the protoc-gen-kotlin is on the PATH it does not have to be specified via --plugin.

cretz commented 6 years ago

I put the Gradle version requirement and the runtime lib build instructions in the README. If it is needed to explicitly supply --plugin on macOS, as confirmation requested above, then I will update the README to mention that.

Radisovik commented 6 years ago

I did a careful controlled test on OSX and I must have accidentally set the path wrong or something like that the first time. Works fine when the protoc-gen-kotlin script is on the path.