I\'m trying to build a project that uses both Google protocol buffers and Kotlin using Gradle. I want the proto files to compile into Java source, which is then called from my K
I was able to get this to work by adding two lines to my build.gradle.
The first line adds the directory in which the proto compiler generates Java code to the directories the :compileKotlin
looks for Java source:
sourceSets.main.java.srcDirs += 'build/generated/source/proto/main/java'
The second ensures that the Java code is (re)generated before invoking :compileKotlin
:
compileKotlin.dependsOn ':generateProto'