diff --git a/plugin/src/main/kotlin/com/github/gmazzo/buildconfig/BuildConfigPlugin.kt b/plugin/src/main/kotlin/com/github/gmazzo/buildconfig/BuildConfigPlugin.kt index b252e37..7ff21bf 100644 --- a/plugin/src/main/kotlin/com/github/gmazzo/buildconfig/BuildConfigPlugin.kt +++ b/plugin/src/main/kotlin/com/github/gmazzo/buildconfig/BuildConfigPlugin.kt @@ -42,10 +42,10 @@ class BuildConfigPlugin : Plugin { .convention(findProperty("com.github.gmazzo.buildconfig.generateAtSync")?.toString()?.toBoolean() ?: true) .finalizeValueOnRead() - if (rootProject.tasks.names.contains("prepareKotlinBuildScriptModel")) { - rootProject.tasks.named("prepareKotlinBuildScriptModel") { - it.dependsOn(extension.generateAtSync - .map { enabled -> if (enabled) tasks.withType() else files() }) + // generate at sync + afterEvaluate { + if (extension.generateAtSync.get()) { + tasks.maybeCreate("prepareKotlinIdeaImport").dependsOn(tasks.withType()) } }