mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-01-12 14:59:43 -06:00
113 lines
2.4 KiB
Kotlin
113 lines
2.4 KiB
Kotlin
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
plugins {
|
|
// Kotlin
|
|
id("org.jetbrains.kotlin.plugin.allopen")
|
|
|
|
// Spring
|
|
kotlin("plugin.spring")
|
|
id("org.springframework.boot")
|
|
id("io.spring.dependency-management")
|
|
|
|
// Tooling
|
|
id("com.google.cloud.tools.jib")
|
|
}
|
|
|
|
dependencies {
|
|
api(project(":core"))
|
|
|
|
// Spring
|
|
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
|
|
}
|
|
|
|
kotlin {
|
|
sourceSets {
|
|
all {
|
|
kotlin.srcDir("web/src/main/kotlin")
|
|
}
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
resources {
|
|
srcDir("src/main/html")
|
|
}
|
|
}
|
|
}
|
|
|
|
jib {
|
|
to {
|
|
val buildVersion = if (System.getenv("GITHUB_RUN_NUMBER") != null) {
|
|
"$version.b${System.getenv("GITHUB_RUN_NUMBER")}"
|
|
} else {
|
|
"$version.d${System.currentTimeMillis().div(1000)}" //Seconds since epoch
|
|
}
|
|
|
|
image = "rg.nl-ams.scw.cloud/dreamexposure/discal-web"
|
|
tags = mutableSetOf("latest", buildVersion)
|
|
}
|
|
|
|
val baseImage: String by properties
|
|
from.image = baseImage
|
|
}
|
|
|
|
// The weird OS checks are because of windows. See this SO answer: https://stackoverflow.com/a/53428540
|
|
|
|
tasks {
|
|
this.register<Exec>("npm") {
|
|
var npm = "npm"
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
npm = "npm.cmd"
|
|
}
|
|
|
|
workingDir("..")
|
|
commandLine(npm, "install")
|
|
}
|
|
|
|
this.register<Exec>("cleanWeb") {
|
|
dependsOn("npm")
|
|
var gulp = "gulp"
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
gulp = "gulp.cmd"
|
|
}
|
|
commandLine(gulp, "clean:all")
|
|
}
|
|
|
|
this.register<Exec>("compileCSS") {
|
|
dependsOn("npm")
|
|
var gulp = "gulp"
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
gulp = "gulp.cmd"
|
|
}
|
|
|
|
commandLine(gulp, "build")
|
|
}
|
|
|
|
this.register<Exec>("compileTypescript") {
|
|
dependsOn("npm")
|
|
var webpack = "webpack"
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
webpack = "webpack.cmd"
|
|
}
|
|
|
|
workingDir("..")
|
|
commandLine(webpack)
|
|
}
|
|
|
|
clean {
|
|
dependsOn("npm")
|
|
finalizedBy("cleanWeb")
|
|
}
|
|
|
|
withType<KotlinCompile> {
|
|
dependsOn("npm", "compileCSS", "compileTypescript")
|
|
}
|
|
|
|
bootJar {
|
|
archiveFileName.set("DisCal-Web.jar")
|
|
}
|
|
}
|