Skip to content

Commit

Permalink
Clean up GraderConfiguration and Config
Browse files Browse the repository at this point in the history
- Delete unused method
- disableTimeouts should not replace config, rather set only required property
- Config TimeoutTransformer should be a data class for copy method
  • Loading branch information
alexstaeding committed May 25, 2024
1 parent 3a54861 commit e44b968
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.property
import org.sourcegrade.jagr.launcher.env.Config
import org.sourcegrade.jagr.launcher.env.Jagr
import org.sourcegrade.jagr.launcher.env.Transformers

abstract class GraderConfiguration(
name: String,
Expand Down Expand Up @@ -81,12 +80,6 @@ abstract class GraderConfiguration(
}
}

private fun <K, V> MutableMap<K, Set<V>>.mergeAll(other: Map<K, Set<V>>) {
other.forEach { (key, value) ->
merge(key, value) { a, b -> a + b }
}
}

internal fun getSourceSetNamesRecursive(): Set<ProjectSourceSetTuple> {
val result = mutableSetOf<ProjectSourceSetTuple>()
result.addAll(sourceSetNames.get())
Expand Down Expand Up @@ -128,6 +121,8 @@ abstract class GraderConfiguration(
}

fun disableTimeouts() {
config.set(Config(transformers = Transformers(timeout = Transformers.TimeoutTransformer(enabled = false))))
config.map {
it.copy(transformers = it.transformers.copy(timeout = it.transformers.timeout.copy(enabled = false)))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ data class Transformers(
}

@ConfigSerializable
class TimeoutTransformer(
data class TimeoutTransformer(
override val enabled: Boolean = true,
) : Transformer
}

0 comments on commit e44b968

Please sign in to comment.