Skip to content

Instantly share code, notes, and snippets.

@drawers
Last active January 29, 2023 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drawers/d815c26210fbb1ca1b2c0748f7339c76 to your computer and use it in GitHub Desktop.
Save drawers/d815c26210fbb1ca1b2c0748f7339c76 to your computer and use it in GitHub Desktop.
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