2024-09-12 17:45:21 +02:00
|
|
|
import com.github.gradle.node.npm.task.NpmTask
|
|
|
|
import java.io.IOException
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
bluemap.base
|
|
|
|
alias ( libs.plugins.node.gradle )
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
api ( project( ":core" ) )
|
|
|
|
|
|
|
|
api ( libs.brigadier )
|
|
|
|
|
|
|
|
compileOnly ( libs.jetbrains.annotations )
|
|
|
|
compileOnly ( libs.lombok )
|
|
|
|
|
|
|
|
annotationProcessor ( libs.lombok )
|
|
|
|
|
|
|
|
// tests
|
|
|
|
testImplementation ( libs.junit.core )
|
|
|
|
testRuntimeOnly ( libs.junit.engine )
|
|
|
|
testRuntimeOnly ( libs.lombok )
|
|
|
|
testAnnotationProcessor ( libs.lombok )
|
|
|
|
}
|
|
|
|
|
|
|
|
node {
|
|
|
|
version = "20.14.0"
|
|
|
|
download = true
|
|
|
|
nodeProjectDir = file("webapp/")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("buildWebapp", type = NpmTask::class) {
|
|
|
|
dependsOn ("npmInstall")
|
|
|
|
args = listOf("run", "build")
|
|
|
|
|
|
|
|
inputs.dir("webapp/")
|
|
|
|
outputs.dir("webapp/dist/")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("zipWebapp", type = Zip::class) {
|
|
|
|
dependsOn ("buildWebapp")
|
|
|
|
from (fileTree("webapp/dist/"))
|
|
|
|
archiveFileName = "webapp.zip"
|
|
|
|
destinationDirectory = file("src/main/resources/de/bluecolored/bluemap/")
|
|
|
|
|
2024-09-21 16:34:21 +02:00
|
|
|
val replacements = mapOf(
|
|
|
|
"version" to project.version
|
|
|
|
)
|
|
|
|
|
|
|
|
inputs.properties(replacements)
|
2024-09-12 17:45:21 +02:00
|
|
|
inputs.dir("webapp/dist/")
|
|
|
|
outputs.file("src/main/resources/de/bluecolored/bluemap/webapp.zip")
|
2024-09-21 16:34:21 +02:00
|
|
|
|
|
|
|
filesMatching(listOf(
|
|
|
|
"index.html",
|
|
|
|
)) { expand(properties) }
|
2024-09-12 17:45:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.processResources {
|
|
|
|
dependsOn("zipWebapp")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.getByName("sourcesJar") {
|
|
|
|
dependsOn("zipWebapp")
|
|
|
|
}
|
|
|
|
|
2024-09-21 16:34:21 +02:00
|
|
|
tasks.register<CopyFileTask>("release") {
|
|
|
|
group = "publishing"
|
|
|
|
dependsOn("zipWebapp")
|
|
|
|
|
|
|
|
inputFile = tasks.getByName("zipWebapp").outputs.files.singleFile
|
|
|
|
outputFile = releaseDirectory.resolve("bluemap-${project.version}-webapp.zip")
|
|
|
|
}
|
|
|
|
|
2024-09-12 17:45:21 +02:00
|
|
|
tasks.clean {
|
|
|
|
doFirst {
|
|
|
|
if (!file("webapp/dist/").deleteRecursively())
|
|
|
|
throw IOException("Failed to delete build directory!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
create<MavenPublication>("maven") {
|
|
|
|
groupId = project.group.toString()
|
|
|
|
artifactId = "bluemap-${project.name}"
|
|
|
|
version = project.version.toString()
|
|
|
|
|
|
|
|
from(components["java"])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|