diff --git a/src/backend/build.gradle.kts b/src/backend/build.gradle.kts index 02fd7a2c8..e1977da13 100644 --- a/src/backend/build.gradle.kts +++ b/src/backend/build.gradle.kts @@ -43,6 +43,7 @@ tasks { destinationDir = rootProject.rootDir.resolve("artifacts") } val jsBuildPath = project.buildDir.resolve("js") + val schemasBuildPath = project.buildDir.resolve("schemas") val copyJsAdmin = register("copyJsAdmin") { from(project(":frontend").tasks["npm_run_buildAdmin"]) destinationDir = jsBuildPath.resolve("admin") @@ -51,10 +52,20 @@ tasks { from(project(":frontend").tasks["npm_run_buildOverlay"]) destinationDir = jsBuildPath.resolve("overlay") } + val copySchema = register("copySchema") { + val genTask = project(":schema-generator").tasks["gen"] + dependsOn(genTask) + from(genTask.dependsOn) + destinationDir = schemasBuildPath.resolve("schemas") + } register("buildJs") { dependsOn(copyJsAdmin, copyJsOverlay) outputs.dir(jsBuildPath) } + register("buildSchema") { + dependsOn(copySchema) + outputs.dir(schemasBuildPath) + } } @@ -65,6 +76,7 @@ sourceSets { if (project.properties["live.dev.embedFrontend"] == "true") { srcDirs(tasks["buildJs"].outputs) } + srcDirs(tasks["buildSchema"].outputs) } } } diff --git a/src/backend/src/main/kotlin/org/icpclive/Application.kt b/src/backend/src/main/kotlin/org/icpclive/Application.kt index be4fa56d5..b390b9fc0 100644 --- a/src/backend/src/main/kotlin/org/icpclive/Application.kt +++ b/src/backend/src/main/kotlin/org/icpclive/Application.kt @@ -94,6 +94,7 @@ fun Application.module() { routing { staticFiles("/media", Config.mediaDirectory.toFile()) + staticResources("/schemas", "schemas") singlePageApplication { useResources = true applicationRoute = "admin"