diff --git a/generator/accessor-plugin/src/main/kotlin/me/kcra/takenaka/generator/accessor/plugin/AccessorGeneratorPlugin.kt b/generator/accessor-plugin/src/main/kotlin/me/kcra/takenaka/generator/accessor/plugin/AccessorGeneratorPlugin.kt index a12845197df..436bf50032c 100644 --- a/generator/accessor-plugin/src/main/kotlin/me/kcra/takenaka/generator/accessor/plugin/AccessorGeneratorPlugin.kt +++ b/generator/accessor-plugin/src/main/kotlin/me/kcra/takenaka/generator/accessor/plugin/AccessorGeneratorPlugin.kt @@ -26,6 +26,7 @@ import me.kcra.takenaka.generator.common.provider.impl.SimpleMappingProvider import me.kcra.takenaka.gradle.BuildConfig import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.Task import org.gradle.api.artifacts.dsl.DependencyHandler import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.tasks.compile.JavaCompile @@ -81,6 +82,14 @@ class AccessorGeneratorPlugin : Plugin { dependsOn(generateAccessors) } + @Suppress("UNCHECKED_CAST") + runCatching { Class.forName("org.jetbrains.kotlin.gradle.tasks.KotlinCompile") as Class } + .onSuccess { klass -> + target.tasks.withType(klass) { + dependsOn(generateAccessors) + } + } + target.afterEvaluate { val defaultLocation = layout.buildDirectory.dir("takenaka/output").get().asFile