diff --git a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/SkieInternalExtension.kt b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/SkieInternalExtension.kt index f81baabe4..af8a9cb58 100644 --- a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/SkieInternalExtension.kt +++ b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/SkieInternalExtension.kt @@ -3,7 +3,7 @@ package co.touchlab.skie.plugin import co.touchlab.skie.plugin.configuration.skieExtension import co.touchlab.skie.plugin.shim.KgpShim import co.touchlab.skie.plugin.shim.KgpShimLoader -import co.touchlab.skie.plugin.util.SkieKotlinVariantResolver +import co.touchlab.skie.plugin.shim.SkieKotlinVariantResolver import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Project import javax.inject.Inject diff --git a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/KgpShimLoader.kt b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/KgpShimLoader.kt index 102cdc28e..03f26357e 100644 --- a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/KgpShimLoader.kt +++ b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/KgpShimLoader.kt @@ -1,10 +1,11 @@ +@file:Suppress("UnstableApiUsage") + package co.touchlab.skie.plugin.shim import co.touchlab.skie.gradle.KotlinCompilerVersion import co.touchlab.skie.gradle_plugin_impl.BuildConfig import co.touchlab.skie.plugin.util.exclude import co.touchlab.skie.plugin.util.named -import co.touchlab.skie.plugin.util.reportSkieLoaderError import org.gradle.api.Project import org.gradle.api.artifacts.Configuration import org.gradle.api.attributes.Category diff --git a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/util/SkieKotlinVariantResolver.kt b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/SkieKotlinVariantResolver.kt similarity index 99% rename from SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/util/SkieKotlinVariantResolver.kt rename to SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/SkieKotlinVariantResolver.kt index 9774d7f44..f3bcfb119 100644 --- a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/util/SkieKotlinVariantResolver.kt +++ b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/SkieKotlinVariantResolver.kt @@ -1,4 +1,4 @@ -package co.touchlab.skie.plugin.util +package co.touchlab.skie.plugin.shim import co.touchlab.skie.gradle_plugin_impl.BuildConfig import org.gradle.api.Project diff --git a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/SkieLoaderError.kt b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/SkieLoaderError.kt new file mode 100644 index 000000000..fd6604122 --- /dev/null +++ b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/shim/SkieLoaderError.kt @@ -0,0 +1,21 @@ +package co.touchlab.skie.plugin.shim + +import co.touchlab.skie.plugin.configuration.skieExtension +import org.gradle.api.Project + +fun Project.reportSkieLoaderError(error: String) { + afterEvaluate { + // Intentionally not checking for the macOS platform + val isSkieSupposedToBeEnabled = skieExtension.isEnabled.get() + + if (isSkieSupposedToBeEnabled) { + val errorMessage = """ + |Error: ${error.replace("\n", "\n|")} + |SKIE cannot not be used until this error is resolved. + |To proceed with the compilation, please remove or explicitly disable SKIE by adding 'skie { isEnabled = false }' to your Gradle configuration. + """.trimMargin() + + error(errorMessage) + } + } +} diff --git a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/util/SkieLoaderError.kt b/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/util/SkieLoaderError.kt deleted file mode 100644 index 3ec0d6f4e..000000000 --- a/SKIE/skie-gradle/plugin-impl/src/common/kotlin/co/touchlab/skie/plugin/util/SkieLoaderError.kt +++ /dev/null @@ -1,17 +0,0 @@ -package co.touchlab.skie.plugin.util - -import co.touchlab.skie.plugin.configuration.SkieExtension -import org.gradle.api.Project - -fun Project.reportSkieLoaderError(error: String) { - logger.error("Error:\n$error\nSKIE cannot not be used until this error is resolved.\n") - - gradle.taskGraph.whenReady { - val hasLinkTask = allTasks.any { it.name.startsWith("link") && it.project == project } - val isSkieEnabled = extensions.findByType(SkieExtension::class.java)?.isEnabled?.get() == true - - if (hasLinkTask && isSkieEnabled) { - error("$error\nTo proceed with the compilation, please remove or explicitly disable SKIE by adding 'skie { isEnabled.set(false) }' to your Gradle configuration.") - } - } -}