Are there any examples of a multiplatform project ...
# multiplatform
e
Are there any examples of a multiplatform project in which a task generates .kt files that are placed in a separate sourceset? I run into problems with implicit dependencies and can't figure out how to go about this.
k
Any more details on what you're looking for? Sqldelight generates kt
e
I currently have this https://github.com/openrndr/openrndr/blob/master/openrndr-filter/build.gradle.kts . In
buildSrc
I have a task
embedShaders
that turns glsl into .kt files. I create a
shaderKotlin
sourceset on which the main sourceset depends. This part works. The thing that breaks for me is to have
shaderKotlin
's files be created by
embedShaders
as part of the build. I have added task dependencies but those trigger Gradle to detect implicit dependencies on files generated by
embedShaders
m
I think this could work if you call
srcDir()
with a provider from your code generating class that carries its task dependency:
Copy code
val shaderKotlin by creating {
            this.kotlin.srcDir(embedShaders.flatMap { it.outputDir })
        }
e
@mbonnin the
flatMap
is not needed but setting the
srcDir
to
embedShaders.outputDir
seems to do the trick. So simple in the end 🙂
👍 1
Thank you so much