2022-01-15 01:18:02 +01:00
|
|
|
import com.github.gradle.node.npm.task.NpmTask
|
|
|
|
import java.io.IOException
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
java
|
|
|
|
`java-library`
|
2022-12-04 00:18:45 +01:00
|
|
|
`maven-publish`
|
2022-01-15 01:18:02 +01:00
|
|
|
id("com.diffplug.spotless") version "6.1.2"
|
2022-12-18 18:03:04 +01:00
|
|
|
id ("com.github.node-gradle.node") version "3.5.0"
|
2022-01-15 01:18:02 +01:00
|
|
|
}
|
|
|
|
|
2024-04-04 02:07:09 +02:00
|
|
|
group = "de.bluecolored.bluemap"
|
|
|
|
version = System.getProperty("bluemap.version") ?: "?" // set by BlueMapCore
|
|
|
|
val lastVersion = System.getProperty("bluemap.lastVersion") ?: "?" // set by BlueMapCore
|
2022-01-15 01:18:02 +01:00
|
|
|
|
2024-03-29 13:08:59 +01:00
|
|
|
val javaTarget = 16
|
2022-01-15 01:18:02 +01:00
|
|
|
java {
|
|
|
|
sourceCompatibility = JavaVersion.toVersion(javaTarget)
|
|
|
|
targetCompatibility = JavaVersion.toVersion(javaTarget)
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2024-04-04 02:07:09 +02:00
|
|
|
maven ("https://libraries.minecraft.net")
|
|
|
|
maven ("https://repo.bluecolored.de/releases")
|
2022-01-15 01:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
api ("com.mojang:brigadier:1.0.17")
|
2024-05-15 23:47:25 +02:00
|
|
|
|
2024-04-04 02:07:09 +02:00
|
|
|
api ("de.bluecolored.bluemap:BlueMapCore")
|
2022-01-15 01:18:02 +01:00
|
|
|
|
2022-05-28 21:55:41 +02:00
|
|
|
compileOnly ("org.jetbrains:annotations:16.0.2")
|
2024-05-12 20:11:31 +02:00
|
|
|
compileOnly ("org.projectlombok:lombok:1.18.32")
|
2024-02-07 20:43:37 +01:00
|
|
|
|
2024-05-12 20:11:31 +02:00
|
|
|
annotationProcessor ("org.projectlombok:lombok:1.18.32")
|
2022-05-28 21:55:41 +02:00
|
|
|
|
2022-01-15 01:18:02 +01:00
|
|
|
testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2")
|
|
|
|
testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
|
|
|
}
|
|
|
|
|
|
|
|
spotless {
|
|
|
|
java {
|
|
|
|
target ("src/*/java/**/*.java")
|
|
|
|
|
|
|
|
licenseHeaderFile("../HEADER")
|
|
|
|
indentWithSpaces()
|
|
|
|
trimTrailingWhitespace()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
node {
|
2022-12-18 18:03:04 +01:00
|
|
|
version.set("16.15.0")
|
2022-01-15 01:18:02 +01:00
|
|
|
download.set(true)
|
2022-12-18 17:30:00 +01:00
|
|
|
nodeProjectDir.set(file("webapp/"))
|
2022-01-15 01:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile::class).configureEach {
|
|
|
|
options.apply {
|
|
|
|
encoding = "utf-8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(AbstractArchiveTask::class).configureEach {
|
|
|
|
isReproducibleFileOrder = true
|
|
|
|
isPreserveFileTimestamps = false
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("buildWebapp", type = NpmTask::class) {
|
|
|
|
doFirst {
|
2022-12-18 17:30:00 +01:00
|
|
|
if (!file("webapp/dist/").deleteRecursively())
|
2022-01-15 01:18:02 +01:00
|
|
|
throw IOException("Failed to delete build directory!")
|
|
|
|
}
|
|
|
|
|
|
|
|
dependsOn ("npmInstall")
|
|
|
|
args.set(listOf("run", "build"))
|
|
|
|
|
2022-12-18 17:30:00 +01:00
|
|
|
inputs.dir("webapp/")
|
|
|
|
outputs.dir("webapp/dist/")
|
2022-01-15 01:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("zipWebapp", type = Zip::class) {
|
|
|
|
dependsOn ("buildWebapp")
|
2022-12-18 17:30:00 +01:00
|
|
|
from (fileTree("webapp/dist/"))
|
2022-01-15 01:18:02 +01:00
|
|
|
archiveFileName.set("webapp.zip")
|
|
|
|
destinationDirectory.set(file("src/main/resources/de/bluecolored/bluemap/"))
|
|
|
|
|
|
|
|
//outputs.upToDateWhen { false }
|
2022-12-18 17:30:00 +01:00
|
|
|
inputs.dir("webapp/dist/")
|
2022-01-15 01:18:02 +01:00
|
|
|
outputs.file("src/main/resources/de/bluecolored/bluemap/webapp.zip")
|
|
|
|
}
|
|
|
|
|
|
|
|
//always update the zip before build
|
|
|
|
tasks.processResources {
|
|
|
|
dependsOn("zipWebapp")
|
|
|
|
}
|
2022-12-04 00:18:45 +01:00
|
|
|
|
|
|
|
publishing {
|
2024-04-04 02:07:09 +02:00
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = "bluecolored"
|
|
|
|
|
|
|
|
val releasesRepoUrl = "https://repo.bluecolored.de/releases"
|
|
|
|
val snapshotsRepoUrl = "https://repo.bluecolored.de/snapshots"
|
|
|
|
url = uri(if (version == lastVersion) releasesRepoUrl else snapshotsRepoUrl)
|
|
|
|
|
|
|
|
credentials {
|
|
|
|
username = project.findProperty("bluecoloredUsername") as String? ?: System.getenv("BLUECOLORED_USERNAME")
|
|
|
|
password = project.findProperty("bluecoloredPassword") as String? ?: System.getenv("BLUECOLORED_PASSWORD")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-04 00:18:45 +01:00
|
|
|
publications {
|
|
|
|
create<MavenPublication>("maven") {
|
|
|
|
groupId = project.group.toString()
|
|
|
|
artifactId = project.name
|
|
|
|
version = project.version.toString()
|
|
|
|
|
|
|
|
from(components["java"])
|
2024-04-04 02:07:09 +02:00
|
|
|
|
|
|
|
versionMapping {
|
|
|
|
usage("java-api") {
|
|
|
|
fromResolutionOf("runtimeClasspath")
|
|
|
|
}
|
|
|
|
}
|
2022-12-04 00:18:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|