Skip to content

Commit

Permalink
Serve json schemas from backend
Browse files Browse the repository at this point in the history
  • Loading branch information
kunyavskiy committed Aug 28, 2023
1 parent 4469648 commit 434d3d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Copy>("copyJsAdmin") {
from(project(":frontend").tasks["npm_run_buildAdmin"])
destinationDir = jsBuildPath.resolve("admin")
Expand All @@ -51,10 +52,20 @@ tasks {
from(project(":frontend").tasks["npm_run_buildOverlay"])
destinationDir = jsBuildPath.resolve("overlay")
}
val copySchema = register<Copy>("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)
}
}


Expand All @@ -65,6 +76,7 @@ sourceSets {
if (project.properties["live.dev.embedFrontend"] == "true") {
srcDirs(tasks["buildJs"].outputs)
}
srcDirs(tasks["buildSchema"].outputs)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/backend/src/main/kotlin/org/icpclive/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ fun Application.module() {

routing {
staticFiles("/media", Config.mediaDirectory.toFile())
staticResources("/schemas", "schemas")
singlePageApplication {
useResources = true
applicationRoute = "admin"
Expand Down

0 comments on commit 434d3d6

Please sign in to comment.