Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode

plugins {
java
kotlin("jvm")
Expand All @@ -21,8 +23,10 @@ kotlin {
compilerOptions {
allWarningsAsErrors = true
compilerOptions {
freeCompilerArgs.add("-Xjvm-default=all")
jvmDefault = JvmDefaultMode.NO_COMPATIBILITY
freeCompilerArgs.add("-Xcontext-parameters")
freeCompilerArgs.add("-Xreturn-value-checker=full")
progressiveMode = true
optIn.addAll(listOf(
"kotlinx.serialization.ExperimentalSerializationApi",
"kotlin.time.ExperimentalTime",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.icpclive.gradle.tasks

import gradle.kotlin.dsl.accessors._0efe46a4cec2e9e682da24afc1fcb716.sourceSets
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.modules.*
Expand Down
23 changes: 12 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
[versions]
ktor = "3.3.2" # https://ktor.io/
ktor = "3.3.3" # https://ktor.io/
datetime = "0.7.1" # https://github.com/Kotlin/kotlinx-datetime
serialization = "1.9.0" # https://github.com/Kotlin/kotlinx.serialization
kotlin = "2.2.21"
ksp = "2.3.3" # https://github.com/google/ksp
kotlin = "2.3.0"
ksp = "2.3.4" # https://github.com/google/ksp
slf4j = "2.0.17" # https://www.slf4j.org/download.html
logback = "1.5.21" # https://logback.qos.ch/download.html
logback = "1.5.22" # https://logback.qos.ch/download.html
node-plugin = "7.1.0" # https://github.com/node-gradle/gradle-node-plugin
coroutines = "1.10.2" # https://github.com/Kotlin/kotlinx.coroutines/
shadow-plugin = "9.2.2" # https://github.com/GradleUp/shadow
shadow-plugin = "9.3.0" # https://github.com/GradleUp/shadow
clikt = "5.0.3" # https://ajalt.github.io/clikt/
immutable = "0.4.0" # https://github.com/Kotlin/kotlinx.collections.immutable
protobuf-plugin = "0.9.5" # https://github.com/google/protobuf-gradle-plugin
protobuf = "4.32.1" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-kotlin
grpc = "1.73.0" # https://mvnrepository.com/artifact/io.grpc/grpc-stub
grpc-kotlin = "1.4.1" # https://mvnrepository.com/artifact/io.grpc/grpc-kotlin-stub
protobuf-plugin = "0.9.6" # https://github.com/google/protobuf-gradle-plugin
protobuf = "4.33.2" # https://mvnrepository.com/artifact/com.google.protobuf/protobuf-kotlin
grpc = "1.77.0" # https://mvnrepository.com/artifact/io.grpc/grpc-stub
grpc-kotlin = "1.5.0" # https://mvnrepository.com/artifact/io.grpc/grpc-kotlin-stub
dokka = "2.1.0" # https://github.com/Kotlin/dokka
kxs-ts-gen = "0.2.4" # https://github.com/adamko-dev/kotlinx-serialization-typescript-generator
apache-commons-csv = "1.14.1" # https://commons.apache.org/proper/commons-csv/
graphql = "8.8.1" # https://github.com/ExpediaGroup/graphql-kotlin/tree/master
json-schema-validator = "0.5.2" # https://github.com/OptimumCode/json-schema-validator
json-schema-validator = "0.5.3" # https://github.com/OptimumCode/json-schema-validator

[libraries]

Expand Down Expand Up @@ -63,7 +63,8 @@ cli = { version.ref = "clikt", group = "com.github.ajalt.clikt", name = "clikt"

grpc-netty = { version.ref = "grpc", group = "io.grpc", name = "grpc-netty" }
grpc-protobuf = { version.ref = "grpc", group = "io.grpc", name = "grpc-protobuf" }
grpc-stub = { version.ref = "grpc-kotlin", group = "io.grpc", name = "grpc-kotlin-stub" }
grpc-stub = { version.ref = "grpc", group = "io.grpc", name = "grpc-stub" }
grpc-kotlin-stub = { version.ref = "grpc-kotlin", group = "io.grpc", name = "grpc-kotlin-stub" }
grpc-gen-java = { version.ref = "grpc", group = "io.grpc", name = "protoc-gen-grpc-java" }
grpc-gen-kotlin = { version.ref = "grpc-kotlin", group = "io.grpc", name = "protoc-gen-grpc-kotlin" }

Expand Down
2 changes: 1 addition & 1 deletion src/backend/src/main/kotlin/org/icpclive/admin/Routing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ fun Route.configureAdminApiRouting() {
validate = {
try {
// check if parsable
TuningRule.listFromString(it)
val _ = TuningRule.listFromString(it)
} catch (e: SerializationException) {
throw ApiActionException("Failed to deserialize advanced.json: ${e.message}", e)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LocatorWidgetController(manager: Manager<in TeamLocatorWidget>) :
override suspend fun checkSettings(settings: ExternalTeamLocatorSettings) {
val info = DataBus.currentContestInfo()
settings.circles.forEach {
it.getTeam(info) ?: throw ApiActionException("No team for circle $it")
val _ = it.getTeam(info) ?: throw ApiActionException("No team for circle $it")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ abstract class SingleWidgetController<SettingsType : ObjectSettings, DataType :
overlayWidgetId = null
}

@IgnorableReturnValue
fun launchWhileWidgetExists(block: suspend () -> Unit) = widgetScope.launch { block() }
@IgnorableReturnValue
fun launchWhileWidgetShown(block: suspend () -> Unit) = widgetShowScope?.launch { block() }

suspend fun getSettings() = mutex.withLock { settings }
Expand Down
1 change: 1 addition & 0 deletions src/backend/src/main/kotlin/org/icpclive/data/Manager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ abstract class ManagerWithEvents<T : TypeWithId, E> : Manager<T>() {
items.forEach(block)
}

@IgnorableReturnValue
private fun removeById(id: String) : Boolean {
val myItems = items.filter { it.id == id }
for (item in myItems) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ internal class ClicsExporter(private val mediaDirectory: Path) : Exporter {
.normalize()
.takeIf { it.startsWith(mediaDirectory) }
?.takeIf { it.exists() }
if (local != null) {
"media/" + local.relativeTo(mediaDirectory).joinToString("/", prefix = "media/").also {
localFiles[local] = it
}
}
local?.relativeTo(mediaDirectory)
?.joinToString("/", prefix = "media/")
?.also { localFiles[local] = it }
}
url.value
}
Expand Down
4 changes: 2 additions & 2 deletions src/cds/core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -3267,8 +3267,8 @@ public final class org/icpclive/cds/tunning/TemplateSubstitutionBuilder {
public final fun addJson (Ljava/lang/String;Lkotlinx/serialization/json/JsonElement;)V
public final fun addOrganization (Lorg/icpclive/cds/api/OrganizationInfo;Ljava/lang/String;)V
public static synthetic fun addOrganization$default (Lorg/icpclive/cds/tunning/TemplateSubstitutionBuilder;Lorg/icpclive/cds/api/OrganizationInfo;Ljava/lang/String;ILjava/lang/Object;)V
public final fun addRegex (Ljava/lang/String;Lorg/icpclive/cds/tunning/TemplateRegexParser;Ljava/lang/String;)Lorg/icpclive/cds/tunning/TemplateSubstitutionBuilder;
public static synthetic fun addRegex$default (Lorg/icpclive/cds/tunning/TemplateSubstitutionBuilder;Ljava/lang/String;Lorg/icpclive/cds/tunning/TemplateRegexParser;Ljava/lang/String;ILjava/lang/Object;)Lorg/icpclive/cds/tunning/TemplateSubstitutionBuilder;
public final fun addRegex (Ljava/lang/String;Lorg/icpclive/cds/tunning/TemplateRegexParser;Ljava/lang/String;)V
public static synthetic fun addRegex$default (Lorg/icpclive/cds/tunning/TemplateSubstitutionBuilder;Ljava/lang/String;Lorg/icpclive/cds/tunning/TemplateRegexParser;Ljava/lang/String;ILjava/lang/Object;)V
public final fun addTeam (Lorg/icpclive/cds/api/TeamInfo;Ljava/lang/String;Z)V
public static synthetic fun addTeam$default (Lorg/icpclive/cds/tunning/TemplateSubstitutionBuilder;Lorg/icpclive/cds/api/TeamInfo;Ljava/lang/String;ZILjava/lang/Object;)V
public final fun build ()Lorg/icpclive/cds/tunning/TemplateSubstitutor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public fun <T> Flow<T>.transformContestState(block: suspend FlowCollector<Contes
if (isUseless) return@collect
}
curContestState = curContestState.applyEvent(value)
curContestState?.let { emit(it) }
emit(curContestState)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class TemplateSubstitutionBuilder @PublishedApi internal constructor() {
public fun addOrganization(info: OrganizationInfo, name: String = "org") {
addJson(name, Json.encodeToJsonElement(info) as JsonObject)
}
public fun addRegex(groupName: String, parser: TemplateRegexParser, name: String = "regexes") : TemplateSubstitutionBuilder = apply {
public fun addRegex(groupName: String, parser: TemplateRegexParser, name: String = "regexes") {
fun <T> Result<T>.getOrNullAndWarn(regex: Regex, value: String, replacement: String? = null): T? {
exceptionOrNull()?.let {
logger(OverrideTeamTemplate::class).error(it) {
Expand Down
1 change: 1 addition & 0 deletions src/cds/plugins/codedrills/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ dependencies {
runtimeOnly(libs.grpc.netty)
implementation(libs.grpc.protobuf)
implementation(libs.grpc.stub)
implementation(libs.grpc.kotlin.stub)
}
16 changes: 8 additions & 8 deletions src/cds/tests/src/test/kotlin/AllConfigsAreParsable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class AllConfigsAreParsable {
@OptIn(ExperimentalPathApi::class)
private fun test(
configDir: Path,
nameFileter: (String) -> Boolean,
parser: (Path) -> Unit
nameFilter: (String) -> Boolean,
parser: (Path) -> Any?
) : List<DynamicTest> {
return configDir.walk()
.filter { nameFileter(it.name) }
.filter { nameFilter(it.name) }
.map {
DynamicTest.dynamicTest(it.relativeTo(configDir).toString()) { parser(it) }
DynamicTest.dynamicTest(it.relativeTo(configDir).toString()) { val _ = parser(it) }
}.toList()
.also { require(it.isNotEmpty()) }
}
Expand All @@ -32,7 +32,7 @@ class AllConfigsAreParsable {
fun testSettings() : List<DynamicTest> {
return test(
Path("").absolute().parent.parent.parent.resolve("config"),
nameFileter = { it == "settings.json" },
nameFilter = { it == "settings.json" },
parser = { CDSSettings.fromFile(it) { "" } }
)
}
Expand All @@ -42,7 +42,7 @@ class AllConfigsAreParsable {
fun testAdvancedJson() : List<DynamicTest> {
return test(
Path("").absolute().parent.parent.parent.resolve("config"),
nameFileter = { it == "advanced.json" },
nameFilter = { it == "advanced.json" },
parser = { path ->
path.toFile().inputStream().use {
TuningRule.listFromInputStream(it)
Expand All @@ -63,7 +63,7 @@ class AllConfigsAreParsable {
}
return test(
projectDir.resolve("config"),
nameFileter = { it.startsWith("visual-config") || it.startsWith("visualConfig") },
nameFilter = { it.startsWith("visual-config") || it.startsWith("visualConfig") },
parser = { path ->
path.toFile().inputStream().use {
jsonSchema.validate(json.decodeFromStream<JsonElement>(it)) {error ->
Expand All @@ -79,7 +79,7 @@ class AllConfigsAreParsable {
fun testAdvancedJsonExamples() : List<DynamicTest> {
return test(
Path("").absolute().parent.parent.parent.resolve("config/_examples/_advanced"),
nameFileter = { true },
nameFilter = { true },
parser = { path ->
path.toFile().inputStream().use {
TuningRule.listFromInputStream(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ object ClicsTimeTest {
)

for (pp in relSigns) for (hh in relHours) for (mm in relMinutes) for (ss in relSeconds) {
hh.first ?: continue
mm.first ?: continue
if (hh.first == null) continue
if (mm.first == null) continue
val duration = (hh.second.hours + mm.second.minutes + ss.second.seconds) * pp.second
val durationString = formatClicsRelativeTime(duration)
parseClicsRelativeTime(durationString)
parseClicsRelativeTime(durationString).also { assertEquals(duration, it) }
val obj = ObjectWithDuration(duration)
val encodedString = Json.encodeToString(obj)
assertEquals("{\"dur\":\"$durationString\"}", encodedString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ fun Route.setupRouting() {
call.adminApiAction {
log.info { "hello!!!" }
val request = call.receive<OracleRequest>()
OracleMover.moveToTeam(request.oracleId, request.teamId)
Unit
val _ = OracleMover.moveToTeam(request.oracleId, request.teamId)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")

package org.icpclive.oracle

import kotlinx.coroutines.runBlocking
Expand Down