diff --git a/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/JsonPropertiesUpToDateSpec.kt b/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/JsonPropertiesUpToDateSpec.kt index c180df7..30f9ee0 100644 --- a/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/JsonPropertiesUpToDateSpec.kt +++ b/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/JsonPropertiesUpToDateSpec.kt @@ -5,7 +5,15 @@ import org.gradle.api.internal.specs.ExplainingSpec object JsonPropertiesUpToDateSpec : ExplainingSpec { - override fun isSatisfiedBy(element: Task?): Boolean = whyUnsatisfied(element) == null + override fun isSatisfiedBy(element: Task?): Boolean { + val reason = whyUnsatisfied(element) + + if (reason != null) { + println("JsonProperties not up to date:\n$reason") + } + + return reason == null + } // Returns a description explaining why the task is outdated, @@ -30,7 +38,7 @@ object JsonPropertiesUpToDateSpec : ExplainingSpec { } else { "'$it' - expected:$updatedVal, actual:$currentVal" } - }.joinToString(prefix = "package.json is not up to date. ") + }.joinToString(separator = "\n\t", prefix = "package.json is not up to date.\n\t") } else { null } diff --git a/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/UpdatePackageJson.kt b/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/UpdatePackageJson.kt index d4ce73f..d074957 100644 --- a/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/UpdatePackageJson.kt +++ b/buildSrc/src/main/kotlin/dev/adamko/kafkatorio/task/UpdatePackageJson.kt @@ -4,8 +4,8 @@ import com.github.gradle.node.NodePlugin import dev.adamko.kafkatorio.jsonMapper import javax.inject.Inject import kotlinx.serialization.encodeToString -import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.jsonObject import org.gradle.api.DefaultTask import org.gradle.api.file.RegularFileProperty @@ -69,7 +69,7 @@ abstract class UpdatePackageJson @Inject constructor( ): JsonObject { val propertiesToCheck: Map = propertiesToCheck.get() val newJsonProps = propertiesToCheck.mapValues { (_, newVal) -> - jsonMapper.parseToJsonElement(newVal) + JsonPrimitive(newVal) } return JsonObject(currentPackageJson + newJsonProps) }