From 9129bbb1ed0f6949271358f302153e2c251d5d83 Mon Sep 17 00:00:00 2001 From: Geoffrey Challen Date: Sun, 3 Oct 2021 17:02:34 -0500 Subject: [PATCH] Fix Kotlin module import. --- plugin/build.gradle.kts | 2 +- .../cs/cs125/gradlegrader/plugin/ExitManager.kt | 3 ++- .../gradlegrader/plugin/GradleGraderPlugin.kt | 16 ++-------------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 6aa7a9d..d6a3c03 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "com.github.cs125-illinois" -version = "2021.10.2" +version = "2021.10.3" dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib:1.5.31") diff --git a/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/ExitManager.kt b/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/ExitManager.kt index ed71add..34a7fa4 100644 --- a/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/ExitManager.kt +++ b/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/ExitManager.kt @@ -2,6 +2,7 @@ package edu.illinois.cs.cs125.gradlegrader.plugin import org.gradle.api.GradleException import java.lang.RuntimeException +import kotlin.system.exitProcess /** * Manages the exit of the task/process according to configuration. @@ -32,7 +33,7 @@ class ExitManager(private val policy: GradePolicyExtension) { if (!policy.keepDaemon || forceExit) { System.out.flush() System.err.flush() - System.exit(0) + exitProcess(0) } } } diff --git a/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/GradleGraderPlugin.kt b/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/GradleGraderPlugin.kt index d8d6a4c..f10085c 100644 --- a/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/GradleGraderPlugin.kt +++ b/plugin/src/main/java/edu/illinois/cs/cs125/gradlegrader/plugin/GradleGraderPlugin.kt @@ -4,9 +4,8 @@ package edu.illinois.cs.cs125.gradlegrader.plugin import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.dataformat.yaml.YAMLFactory -import com.fasterxml.jackson.module.kotlin.KotlinFeature -import com.fasterxml.jackson.module.kotlin.KotlinModule import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.registerKotlinModule import com.google.gson.Gson import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.extensions.DetektExtension @@ -209,18 +208,7 @@ class GradleGraderPlugin : Plugin { } gradeTask.dependsOn(reconfTask) if (config.checkpointing.yamlFile != null) { - val configLoader = ObjectMapper(YAMLFactory()).also { - it.registerModule( - KotlinModule.Builder() - .withReflectionCacheSize(512) - .configure(KotlinFeature.NullToEmptyCollection, false) - .configure(KotlinFeature.NullToEmptyMap, false) - .configure(KotlinFeature.NullIsSameAsDefault, false) - .configure(KotlinFeature.SingletonSupport, false) - .configure(KotlinFeature.StrictNullChecks, false) - .build() - ) - } + val configLoader = ObjectMapper(YAMLFactory()).also { it.registerKotlinModule() } val checkpointConfig = configLoader.readValue(config.checkpointing.yamlFile!!) currentCheckpoint = checkpointConfig.checkpoint gradeTask.currentCheckpoint = currentCheckpoint