google / protobuf-gradle-plugin

Protobuf Plugin for Gradle
Other
1.73k stars 269 forks source link

Fix plugin compatibility with Kotlin Gradle Plugin 1.9.0 release (#715) (v0.9.x backport) #721

Closed YifeiZhuang closed 11 months ago

YifeiZhuang commented 11 months ago

Kotlin Gradle Plugin 1.9.0 release has changed how kapt tasks are configured: https://youtrack.jetbrains.com/issue/KT-54468/KAPT-Gradle-plugin-causes-eager-task-creation. Because of this change, generated proto sources are not passed to kaptGenerateStubs task leading to compilation error even in default setup.

If the Kotlin plugin version is 1.7.20 - protobuf plugin now, instead of directly configuring KotlinCompile task inputs, configures related KotlinSourceSet. This way additional sources are passed both for KotlinCompile and KaptGenerateStubs tasks.

Fixes issue #714

backport of #715