Skip to content

Instantly share code, notes, and snippets.

@drawers
Last active January 29, 2023 21:27
Embed
What would you like to do?
private fun KotlinCompilation.generatedSourceFor(fileName: String): String {
return kspSourcesDir.walkTopDown()
.firstOrNull { it.name == fileName }
?.readText()
?: throw IllegalArgumentException(
"Unable to find $fileName in ${
kspSourcesDir.walkTopDown().filter { it.isFile }.toList()
}"
)
}
private val KotlinCompilation.kspWorkingDir: File
get() = workingDir.resolve("ksp")
private val KotlinCompilation.kspSourcesDir: File
get() = kspWorkingDir.resolve("sources")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment