diff options
Diffstat (limited to 'kvision-tools/kvision-compiler-plugin/src/main/kotlin/pl/treksoft')
-rw-r--r-- | kvision-tools/kvision-compiler-plugin/src/main/kotlin/pl/treksoft/kvision/plugin/KVProcessor.kt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kvision-tools/kvision-compiler-plugin/src/main/kotlin/pl/treksoft/kvision/plugin/KVProcessor.kt b/kvision-tools/kvision-compiler-plugin/src/main/kotlin/pl/treksoft/kvision/plugin/KVProcessor.kt index 43d83aef..e09c9021 100644 --- a/kvision-tools/kvision-compiler-plugin/src/main/kotlin/pl/treksoft/kvision/plugin/KVProcessor.kt +++ b/kvision-tools/kvision-compiler-plugin/src/main/kotlin/pl/treksoft/kvision/plugin/KVProcessor.kt @@ -61,9 +61,17 @@ class KVProcessor : AbstractProcessor() { if (it is Element.ClassElement && it.classDescriptor.name.asString().startsWith("I") && it.classDescriptor.name.asString().endsWith("Service") ) { + tailrec fun findBuildFolder(path: String): String { + val preSrcDir = path.substringBeforeLast("/src") + return if (path == preSrcDir || File(preSrcDir, "build").isDirectory) { + "$preSrcDir/build" + } else { + findBuildFolder(preSrcDir) + } + } + val cl = it.classDescriptor - val projectFolder = cl.canonicalFilePath()?.split("/src")?.get(0) ?: "" - val buildFolder = "$projectFolder/build" + val buildFolder = cl.canonicalFilePath()?.let { path -> findBuildFolder(path) } val genRootDir = File(buildFolder, "generated-src").apply { mkdirs() } |