jrod
03/25/2019, 7:39 PMval compileKotlinTask = project.tasks.named("compileKotlin") as TaskProvider<KotlinCompile>
compileKotlinTask.configure {
it.source(javaOutDirs) // javaOutDirs is where the java protos are generated
it.dependsOn(wireTask)
}
but my gradle output shows:
14:56:58.695 [DEBUG] [org.gradle.api.Task] [KOTLIN] all kotlin sources: src/main/java/com/squareup/dinosaurs/Sample.kt
14:56:58.695 [DEBUG] [org.gradle.api.Task] [KOTLIN] compileKotlin source roots: [
/...src/test/projects/kotlin-project-java-protos/src/main/java/com/squareup/dinosaurs/Sample.kt]
14:56:58.695 [DEBUG] [org.gradle.api.Task] [KOTLIN] compileKotlin java source roots: [
// why empty?!
]
tapchicoma
03/25/2019, 7:57 PMsetSource()
should set only kotlin sources?tapchicoma
03/25/2019, 8:00 PMsetSource()
overloads has different behaviour:
// override setSource to track source directory sets and files (for generated android folders)
override fun setSource(sources: Any?) {
sourceRootsContainer.set(sources)
super.setSource(sources)
}
// override source to track source directory sets and files (for generated android folders)
override fun source(vararg sources: Any?): SourceTask? {
sourceRootsContainer.add(*sources)
return super.source(*sources)
}
tapchicoma
03/25/2019, 8:01 PMsourceRootsContainer.set(sources)
clears already existing rootstapchicoma
03/25/2019, 8:02 PMSourceTask
jrod
03/25/2019, 8:07 PMsource()
instead of setSource()
, so it should append to the list, right?jrod
03/25/2019, 8:08 PMtapchicoma
03/25/2019, 8:08 PMtapchicoma
03/25/2019, 8:09 PMor if that's meant for kotlin sources only, is there a way to pass java sources? or will i have to invoke another javac pass for the protos themselves (not ideal...)?I would expect that this class only takes Kotlin sources via
PatternFilterable
interfacetapchicoma
03/25/2019, 8:11 PMKotlinCompile
taskstapchicoma
03/25/2019, 8:17 PM./gradlew -m generateProtos
tapchicoma
03/25/2019, 8:19 PMjrod
03/25/2019, 8:23 PM:generateProtos SKIPPED
:compileKotlin SKIPPED
:compileJava SKIPPED
jrod
03/25/2019, 8:23 PMjrod
03/25/2019, 8:51 PMjrod
03/26/2019, 5:00 PMtapchicoma
03/26/2019, 5:01 PMafterEvaluate { .. }
is deprecatedtapchicoma
03/26/2019, 5:01 PMjrod
03/26/2019, 5:16 PMjrod
03/26/2019, 5:17 PMjrod
03/26/2019, 5:17 PM