-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Support protoc Kotlin code generation #44552
base: main
Are you sure you want to change the base?
Conversation
🎊 PR Preview 3dff5a4 has been successfully built and deployed to https://quarkus-pr-main-44552-preview.surge.sh/version/main/guides/
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
This looks promising, thanks for the PR.
I suggested some minor doc changes and more importantly it seems some Gradle tests are failing and I think that's the important bit:
2024-11-17T17:13:44.2059374Z Options for KOTLIN DAEMON: IncrementalCompilationOptions(super=CompilationOptions(compilerMode=INCREMENTAL_COMPILER, targetPlatform=JVM, reportCategories=[0, 3], reportSeverity=2, requestedCompilationResults=[0], kotlinScriptExtensions=[]), areFileChangesKnown=false, modifiedFiles=null, deletedFiles=null, classpathChanges=NotAvailableForNonIncrementalRun, workingDir=/home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/kotlin/compileKotlin/cacheable, multiModuleICSettings=MultiModuleICSettings(buildHistoryFile=/home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/kotlin/compileKotlin/local-state/build-history.bin, useModuleDetection=false), usePreciseJavaTracking=true, icFeatures=IncrementalCompilationFeatures(withAbiSnapshot=false, preciseCompilationResultsBackup=true, keepIncrementalCompilationCachesInMemory=true, enableUnsafeIncrementalCompilationForMultiplatform=false), outputFiles=[/home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/classes/kotlin/main, /home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/kotlin/compileKotlin/cacheable, /home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/kotlin/compileKotlin/local-state])
2024-11-17T17:13:44.2061194Z e: file:///home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/classes/java/quarkus-generated-sources/grpc/io/quarkus/example/HelloMsgKt.kt:15:17 Annotation argument must be a compile-time constant.
2024-11-17T17:13:44.2063191Z e: file:///home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/classes/java/quarkus-generated-sources/grpc/io/quarkus/example/HelloMsgKt.kt:15:37 Unresolved reference 'kotlin'.
2024-11-17T17:13:44.2065030Z e: file:///home/runner/work/quarkus/quarkus/integration-tests/gradle/target/kotlin-grpc-project12669661681070306965/build/classes/java/quarkus-generated-sources/grpc/io/quarkus/example/HelloMsgKt.kt:16:24 Unresolved reference 'kotlin'.
2024-11-17T17:13:44.2065363Z Finished executing kotlin compiler using DAEMON strategy
@cdsap I'm not sure if it's related to this change but I have seen the following in the logs and it doesn't look like something we would want:
|
@gsmet I tested with a version without the configuration cache changes (3.15.1), I'm observing the same log: Note that I'm executing the build like: Will confirm with the team |
3227bb7
to
8c47257
Compare
Thanks for the feedback. I am aware of the failing tests, as I described in the PR description I am not sure what the problem is since I dont have much experienced with mixed java/kotlin generated sources. Do the generated kotlin sources have to be in another folder than the generated java code? (see my original PR description) |
Status for workflow
|
Status for workflow
|
Status | Name | Step | Failures | Logs | Raw logs | Build scan |
---|---|---|---|---|---|---|
✖ | Gradle Tests - JDK 17 | Build |
Failures | Logs | Raw logs | 🔍 |
✖ | Gradle Tests - JDK 17 Windows | Build |
Failures | Logs | Raw logs | 🔍 |
Full information is available in the Build summary check run.
You can consult the Develocity build scans.
Failures
⚙️ Gradle Tests - JDK 17 #
- Failing: integration-tests/gradle
📦 integration-tests/gradle
✖ io.quarkus.gradle.KotlinGRPCProjectBuildTest.testBasicMultiModuleBuild
- History - More details - Source on GitHub
java.lang.AssertionError: Gradle build failed with exit code 1
at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
at app//io.quarkus.gradle.KotlinGRPCProjectBuildTest.testBasicMultiModuleBuild(KotlinGRPCProjectBuildTest.java:14)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
✖ io.quarkus.gradle.devmode.KotlinProjectWithCompilerArgsDevModeTest.main
- History - More details - Source on GitHub
java.lang.AssertionError:
Expecting actual:
"BROKEN: quarkusDev mode has terminated"
to contain:
"[Banana!]!"
at app//io.quarkus.gradle.devmode.KotlinProjectWithCompilerArgsDevModeTest.testDevMode(KotlinProjectWithCompilerArgsDevModeTest.java:17)
at app//io.quarkus.gradle.devmode.QuarkusDevGradleTestBase.main(QuarkusDevGradleTestBase.java:60)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
⚙️ Gradle Tests - JDK 17 Windows #
- Failing: integration-tests/gradle
📦 integration-tests/gradle
✖ io.quarkus.gradle.KotlinGRPCProjectBuildTest.testBasicMultiModuleBuild
- History - More details - Source on GitHub
java.lang.AssertionError: Gradle build failed with exit code 1
at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
at app//io.quarkus.gradle.KotlinGRPCProjectBuildTest.testBasicMultiModuleBuild(KotlinGRPCProjectBuildTest.java:14)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
✖ io.quarkus.gradle.devmode.KotlinProjectWithCompilerArgsDevModeTest.main
- History - More details - Source on GitHub
java.lang.AssertionError:
Expecting actual:
"BROKEN: quarkusDev mode has terminated"
to contain:
"[Banana!]!"
at app//io.quarkus.gradle.devmode.KotlinProjectWithCompilerArgsDevModeTest.testDevMode(KotlinProjectWithCompilerArgsDevModeTest.java:17)
at app//io.quarkus.gradle.devmode.QuarkusDevGradleTestBase.main(QuarkusDevGradleTestBase.java:60)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
Closes #39127
This PR adds support to generate Kotlin DSLs/Extensions for protoc via adding the
kotlin_out
parameter to theprotoc
command:io.quarkus:quarkus-kotlin
is presentquarkus.generate-code.grpc.kotlin.generate
propertyTo test it I reused the
kotlin-grpc-project
integration-test to use the generated DSL forHelloMsg
.Now currently when running the
KotlinGRPCProjectBuildTest
,compileKotlin
fails with:HelloMsgKt.kt
I am guessing this is because the generated kotlin code should not be in
build/classes/java
but ratherbuild/classes/kotlin
?But if we provide a different output path for the
kotlin_out
than forjava_out
we would need a way to add this extra path also to the compile sources, which is done inCodeGenerator.init()
, right?