Skip to content

Commit

Permalink
Merge pull request #460 from dres-dev/dev
Browse files Browse the repository at this point in the history
DRES v2.0.0
  • Loading branch information
sauterl authored Mar 11, 2024
2 parents f504069 + 823d9b1 commit 8c43e8b
Show file tree
Hide file tree
Showing 36 changed files with 599 additions and 885 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ] #TODO add kotlin as soon as it is supported
language: [ 'javascript' ] #TODO kotlin support is currently in beta
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

Expand All @@ -42,7 +42,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
13 changes: 6 additions & 7 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ compileTestKotlin {

dependencies {

def javalinOpenapi = '5.6.1'

///// Frontend files (produced by sub-project).
implementation frontendClasspath(project(path: ":frontend", configuration: 'frontendFiles'))

Expand All @@ -64,11 +62,11 @@ dependencies {

////// Javalin
implementation group: 'io.javalin', name: 'javalin', version: version_javalin
kapt("io.javalin.community.openapi:openapi-annotation-processor:$javalinOpenapi")
kapt("io.javalin.community.openapi:openapi-annotation-processor:$version_javalinopenapi")

implementation group: 'io.javalin.community.openapi', name: 'javalin-openapi-plugin', version: javalinOpenapi
implementation group: 'io.javalin.community.openapi', name:'javalin-swagger-plugin', version: javalinOpenapi
implementation group: 'io.javalin.community.ssl', name: 'ssl-plugin', version: version_javalin
implementation group: 'io.javalin.community.openapi', name: 'javalin-openapi-plugin', version: version_javalinopenapi
implementation group: 'io.javalin.community.openapi', name:'javalin-swagger-plugin', version: version_javalinopenapi
implementation group: 'io.javalin.community.ssl', name: 'ssl-plugin', version: version_javalinssl

////// Bcrypt
implementation group: 'org.mindrot', name: 'jbcrypt', version: version_bcrypt
Expand All @@ -90,7 +88,6 @@ dependencies {
////// Jaffree ffmpeg wrapper
implementation group: 'com.github.kokorin.jaffree', name: 'jaffree', version: version_jaffree


////// Log4J
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: version_log4j
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: version_log4j
Expand Down Expand Up @@ -119,8 +116,10 @@ dependencies {
kapt {
correctErrorTypes true
useBuildCache true
targetCompatibility = 11
}


test {
useJUnitPlatform()
}
Expand Down
10 changes: 6 additions & 4 deletions backend/src/main/kotlin/dev/dres/DRES.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ package dev.dres
import dev.dres.api.cli.Cli
import dev.dres.api.cli.OpenApiCommand
import dev.dres.api.rest.RestApi
import dev.dres.data.model.config.Config
import dev.dres.data.model.admin.DbRole
import dev.dres.data.model.admin.DbUser
import dev.dres.data.model.config.Config
import dev.dres.data.model.media.*
import dev.dres.data.model.run.*
import dev.dres.data.model.submissions.*
import dev.dres.data.model.template.DbEvaluationTemplate
import dev.dres.data.model.template.task.*
import dev.dres.data.model.template.task.options.*
import dev.dres.data.model.template.team.DbTeam
import dev.dres.data.model.template.team.DbTeamAggregator
import dev.dres.data.model.template.team.DbTeamGroup
import dev.dres.data.model.run.*
import dev.dres.data.model.submissions.*
import dev.dres.mgmt.MediaCollectionManager
import dev.dres.mgmt.TemplateManager
import dev.dres.mgmt.admin.UserManager
Expand Down Expand Up @@ -42,7 +42,7 @@ import kotlin.system.exitProcess
*/
object DRES {
/** Version of DRES. */
const val VERSION = "2.0.0-RC4"
const val VERSION = "2.0.0"

/** Application root; should be relative to JAR file or classes path. */
val APPLICATION_ROOT: Path =
Expand Down Expand Up @@ -100,6 +100,8 @@ object DRES {
println("Starting DRES (application: $APPLICATION_ROOT, data: $DATA_ROOT)")
println("Initializing...")



/* Initialize Xodus based data store. */
val store = this.prepareDatabase()

Expand Down
20 changes: 11 additions & 9 deletions backend/src/main/kotlin/dev/dres/api/cli/EvaluationCommand.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.dres.api.cli

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.NoOpCliktCommand
import com.github.ajalt.clikt.core.subcommands
Expand Down Expand Up @@ -31,7 +31,8 @@ import java.nio.file.StandardOpenOption
* @author Ralph Gasser
* @version 2.0.0
*/
class EvaluationCommand(internal val store: TransientEntityStore) : NoOpCliktCommand(name = "evaluation") {
class EvaluationCommand(internal val store: TransientEntityStore) :
NoOpCliktCommand(name = "evaluation") {

init {
subcommands(
Expand All @@ -49,9 +50,10 @@ class EvaluationCommand(internal val store: TransientEntityStore) : NoOpCliktCom
override fun aliases(): Map<String, kotlin.collections.List<String>> {
return mapOf(
"ls" to listOf("ongoing"),
"la" to listOf("list"),
"ll" to listOf("list"),
"remove" to listOf("delete"),
"drop" to listOf("delete")
"drop" to listOf("delete"),
"rm" to listOf("delete")
)
}

Expand Down Expand Up @@ -247,22 +249,22 @@ class EvaluationCommand(internal val store: TransientEntityStore) : NoOpCliktCom
/** Flag indicating whether export should be pretty printed.*/
private val pretty: Boolean by option("-p", "--pretty", help = "Flag indicating whether exported JSON should be pretty printed.").flag("-u", "--ugly", default = true)



override fun run() = this@EvaluationCommand.store.transactional(true) {
val evaluation = DbEvaluation.query(DbEvaluation::id eq this.id).firstOrNull()
if (evaluation == null) {
println("Evaluation ${this.id} does not seem to exist.")
return@transactional
}

val mapper = jacksonObjectMapper()
val mapper = ObjectMapper()
Files.newBufferedWriter(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE).use {
/*val writer = if (this.pretty) {
val writer = if (this.pretty) {
mapper.writerWithDefaultPrettyPrinter()
} else {
mapper.writer()
}
writer.writeValue(it, run)*/
// TODO: Export must be re-conceived based on API classes.
writer.writeValue(it, evaluation.toApi())
}
println("Successfully exported evaluation ${this.id} to $path.")
}
Expand Down
Loading

0 comments on commit 8c43e8b

Please sign in to comment.