2020-08-04 23:01:35 +02:00
|
|
|
import org.gradle.internal.os.OperatingSystem
|
|
|
|
|
2019-08-03 15:25:24 +02:00
|
|
|
plugins {
|
2020-05-03 16:05:04 +02:00
|
|
|
id 'java-library'
|
2020-08-10 15:48:11 +02:00
|
|
|
id 'maven-publish'
|
2021-05-05 21:41:48 +02:00
|
|
|
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
|
2020-11-18 00:50:27 +01:00
|
|
|
id 'checkstyle'
|
2021-05-22 21:56:01 +02:00
|
|
|
// Used to download our data
|
|
|
|
id 'de.undercouch.download' version '4.1.1'
|
2019-08-03 15:25:24 +02:00
|
|
|
}
|
|
|
|
|
2020-11-16 03:10:51 +01:00
|
|
|
group 'net.minestom.server'
|
|
|
|
version '1.0'
|
|
|
|
|
2021-05-18 21:34:25 +02:00
|
|
|
sourceCompatibility = 11
|
2020-08-04 23:01:35 +02:00
|
|
|
project.ext.lwjglVersion = "3.2.3"
|
|
|
|
|
|
|
|
switch (OperatingSystem.current()) {
|
|
|
|
case OperatingSystem.LINUX:
|
|
|
|
def osArch = System.getProperty("os.arch")
|
|
|
|
project.ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64")
|
|
|
|
? "natives-linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}"
|
|
|
|
: "natives-linux"
|
|
|
|
break
|
|
|
|
case OperatingSystem.MAC_OS:
|
|
|
|
project.ext.lwjglNatives = "natives-macos"
|
|
|
|
break
|
|
|
|
case OperatingSystem.WINDOWS:
|
|
|
|
project.ext.lwjglNatives = System.getProperty("os.arch").contains("64") ? "natives-windows" : "natives-windows-x86"
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
2020-06-30 02:42:02 +02:00
|
|
|
allprojects {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven { url 'https://jitpack.io' }
|
2020-08-23 22:38:27 +02:00
|
|
|
maven {
|
|
|
|
name 'sponge'
|
2020-11-18 00:50:27 +01:00
|
|
|
url 'https://repo.spongepowered.org/maven'
|
2020-08-23 22:38:27 +02:00
|
|
|
}
|
2021-03-28 20:40:27 +02:00
|
|
|
maven {
|
|
|
|
url "https://repo.velocitypowered.com/snapshots/"
|
|
|
|
}
|
2020-06-30 02:42:02 +02:00
|
|
|
}
|
2020-10-13 10:51:48 +02:00
|
|
|
javadoc {
|
|
|
|
options {
|
2020-11-15 23:39:49 +01:00
|
|
|
destinationDir(file("docs"))
|
2020-10-13 10:51:48 +02:00
|
|
|
addBooleanOption('html5', true)
|
2021-03-30 14:28:44 +02:00
|
|
|
links "https://jd.adventure.kyori.net/api/$adventureVersion/"
|
|
|
|
links "https://docs.oracle.com/en/java/javase/11/docs/api/"
|
2020-10-13 10:51:48 +02:00
|
|
|
}
|
2021-03-30 15:02:35 +02:00
|
|
|
|
|
|
|
// see https://stackoverflow.com/a/56641766
|
|
|
|
doLast {
|
|
|
|
// Append the fix to the file
|
2021-05-18 21:34:25 +02:00
|
|
|
def searchScript = new File(destinationDir, '/search.js')
|
2021-03-30 15:02:35 +02:00
|
|
|
searchScript.append '\n\n' +
|
|
|
|
'getURLPrefix = function(ui) {\n' +
|
|
|
|
' return \'\';\n' +
|
|
|
|
'};\n'
|
2020-10-13 10:51:48 +02:00
|
|
|
}
|
|
|
|
}
|
2020-11-20 01:30:01 +01:00
|
|
|
|
|
|
|
checkstyle {
|
2021-05-18 21:34:25 +02:00
|
|
|
toolVersion "8.42"
|
2020-11-20 01:30:01 +01:00
|
|
|
configFile file("${projectDir}/minestom_checks.xml")
|
|
|
|
}
|
2020-06-30 02:42:02 +02:00
|
|
|
}
|
|
|
|
|
2020-06-19 11:29:09 +02:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
|
|
|
srcDir 'src/main/java'
|
|
|
|
srcDir 'src/autogenerated/java'
|
|
|
|
}
|
|
|
|
}
|
2020-06-30 00:07:40 +02:00
|
|
|
generators {
|
2020-06-19 11:29:09 +02:00
|
|
|
java {
|
|
|
|
srcDir 'src/generators/java'
|
|
|
|
}
|
|
|
|
|
|
|
|
compileClasspath += sourceSets.main.runtimeClasspath
|
|
|
|
runtimeClasspath += sourceSets.main.runtimeClasspath
|
|
|
|
}
|
2020-08-10 14:50:39 +02:00
|
|
|
lwjgl {
|
|
|
|
java {
|
|
|
|
srcDir 'src/lwjgl/java'
|
|
|
|
}
|
|
|
|
|
|
|
|
compileClasspath += sourceSets.main.runtimeClasspath
|
|
|
|
runtimeClasspath += sourceSets.main.runtimeClasspath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
java {
|
2020-09-23 21:21:21 +02:00
|
|
|
// Minestom uses LWJGL libs as optional dependency if interfacing with a GPU is asked
|
2020-08-10 14:50:39 +02:00
|
|
|
registerFeature("lwjgl") {
|
|
|
|
usingSourceSet(sourceSets.lwjgl)
|
2020-08-10 15:20:09 +02:00
|
|
|
withJavadocJar()
|
|
|
|
withSourcesJar()
|
2020-08-10 14:50:39 +02:00
|
|
|
}
|
2020-09-20 15:04:07 +02:00
|
|
|
|
2020-09-23 21:21:21 +02:00
|
|
|
registerFeature("generators") {
|
|
|
|
usingSourceSet(sourceSets.generators)
|
|
|
|
withJavadocJar()
|
|
|
|
withSourcesJar()
|
|
|
|
}
|
|
|
|
|
2020-09-20 15:04:07 +02:00
|
|
|
withJavadocJar()
|
|
|
|
withSourcesJar()
|
2020-06-19 11:29:09 +02:00
|
|
|
}
|
|
|
|
|
2020-07-31 22:31:58 +02:00
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
2021-05-18 21:34:25 +02:00
|
|
|
tasks.withType(Zip).configureEach {
|
|
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
|
|
}
|
|
|
|
|
2019-08-03 15:25:24 +02:00
|
|
|
dependencies {
|
2020-07-13 19:34:32 +02:00
|
|
|
// Junit Testing Framework
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
|
|
|
|
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2')
|
2019-09-14 18:00:18 +02:00
|
|
|
|
2021-02-04 20:40:12 +01:00
|
|
|
// Only here to ensure J9 module support for extensions and our classloaders
|
|
|
|
testCompileOnly "org.mockito:mockito-core:2.28.2"
|
|
|
|
|
2020-07-13 19:34:32 +02:00
|
|
|
// Netty
|
2021-04-06 23:59:48 +02:00
|
|
|
api 'io.netty:netty-handler:4.1.63.Final'
|
|
|
|
api 'io.netty:netty-codec:4.1.63.Final'
|
|
|
|
api 'io.netty:netty-transport-native-epoll:4.1.63.Final:linux-x86_64'
|
|
|
|
api 'io.netty:netty-transport-native-kqueue:4.1.63.Final:osx-x86_64'
|
2021-04-15 00:44:25 +02:00
|
|
|
api 'io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.5.Final:linux-x86_64'
|
2020-04-16 16:40:29 +02:00
|
|
|
|
2019-09-14 18:00:18 +02:00
|
|
|
// https://mvnrepository.com/artifact/it.unimi.dsi/fastutil
|
2021-04-06 23:59:48 +02:00
|
|
|
api 'it.unimi.dsi:fastutil:8.5.4'
|
2019-09-14 18:00:18 +02:00
|
|
|
|
|
|
|
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
2020-07-13 19:34:32 +02:00
|
|
|
api 'com.google.code.gson:gson:2.8.6'
|
2020-04-05 10:15:21 +02:00
|
|
|
|
2020-07-13 19:34:32 +02:00
|
|
|
// Noise library for terrain generation
|
2020-05-10 16:02:49 +02:00
|
|
|
// https://jitpack.io/#Articdive/Jnoise
|
2021-05-02 12:50:18 +02:00
|
|
|
api 'com.github.Articdive:Jnoise:2.1.0'
|
2020-05-02 23:16:41 +02:00
|
|
|
|
2020-05-04 18:15:29 +02:00
|
|
|
// https://mvnrepository.com/artifact/org.rocksdb/rocksdbjni
|
2021-04-06 23:59:48 +02:00
|
|
|
api 'org.rocksdb:rocksdbjni:6.16.4'
|
2020-04-16 14:51:21 +02:00
|
|
|
|
2020-07-13 19:34:32 +02:00
|
|
|
// Logging
|
2020-11-13 09:56:28 +01:00
|
|
|
api 'org.apache.logging.log4j:log4j-core:2.14.0'
|
2020-07-13 19:34:32 +02:00
|
|
|
// SLF4J is the base logger for most libraries, therefore we can hook it into log4j2.
|
2020-11-13 09:56:28 +01:00
|
|
|
api 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.0'
|
2020-05-10 16:02:49 +02:00
|
|
|
|
2021-03-18 02:47:10 +01:00
|
|
|
// https://mvnrepository.com/artifact/org.jline/jline
|
2021-05-10 11:10:14 +02:00
|
|
|
implementation group: 'org.jline', name: 'jline', version: '3.20.0'
|
2021-03-18 02:47:10 +01:00
|
|
|
|
2021-05-12 20:41:47 +02:00
|
|
|
// Jline compatibility for windows
|
|
|
|
// https://search.maven.org/artifact/org.fusesource.jansi/jansi/2.3.2/jar
|
|
|
|
implementation 'org.fusesource.jansi:jansi:2.3.2'
|
|
|
|
|
2021-05-15 07:57:28 +02:00
|
|
|
// Guava 21.0+ required for Mixin
|
2021-02-05 21:18:40 +01:00
|
|
|
api 'com.google.guava:guava:30.1-jre'
|
2020-07-01 01:17:58 +02:00
|
|
|
|
2020-08-21 01:32:59 +02:00
|
|
|
// Code modification
|
2020-08-23 22:38:27 +02:00
|
|
|
api "org.ow2.asm:asm:${asmVersion}"
|
|
|
|
api "org.ow2.asm:asm-tree:${asmVersion}"
|
|
|
|
api "org.ow2.asm:asm-analysis:${asmVersion}"
|
|
|
|
api "org.ow2.asm:asm-util:${asmVersion}"
|
|
|
|
api "org.ow2.asm:asm-commons:${asmVersion}"
|
|
|
|
api "org.spongepowered:mixin:${mixinVersion}"
|
2020-08-21 01:32:59 +02:00
|
|
|
|
2021-03-28 20:40:27 +02:00
|
|
|
// Compression
|
|
|
|
implementation "com.velocitypowered:velocity-native:1.1.0-SNAPSHOT"
|
|
|
|
|
2020-08-10 07:24:43 +02:00
|
|
|
// Path finding
|
2021-04-06 23:59:48 +02:00
|
|
|
api 'com.github.MadMartian:hydrazine-path-finding:1.6.0'
|
2020-05-29 20:44:03 +02:00
|
|
|
|
2021-01-23 09:32:18 +01:00
|
|
|
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${project.kotlinVersion}"
|
|
|
|
api "org.jetbrains.kotlin:kotlin-reflect:${project.kotlinVersion}"
|
2020-10-24 22:57:38 +02:00
|
|
|
|
|
|
|
// NBT parsing/manipulation/saving
|
2021-01-23 09:32:18 +01:00
|
|
|
api("com.github.jglrxavpok:Hephaistos:${project.hephaistosVersion}")
|
|
|
|
api("com.github.jglrxavpok:Hephaistos:${project.hephaistosVersion}:gson")
|
|
|
|
api("com.github.jglrxavpok:Hephaistos:${project.hephaistosVersion}") {
|
2020-10-16 12:16:06 +02:00
|
|
|
capabilities {
|
|
|
|
requireCapability("org.jglrxavpok.nbt:Hephaistos-gson")
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 23:01:35 +02:00
|
|
|
|
2021-02-03 17:50:25 +01:00
|
|
|
api "com.github.Minestom:DependencyGetter:v1.0.1"
|
2020-10-24 22:57:38 +02:00
|
|
|
|
2021-03-23 13:29:22 +01:00
|
|
|
// Adventure, for user-interface
|
|
|
|
api "net.kyori:adventure-api:$adventureVersion"
|
|
|
|
api "net.kyori:adventure-text-serializer-gson:$adventureVersion"
|
|
|
|
api "net.kyori:adventure-text-serializer-plain:$adventureVersion"
|
|
|
|
api "net.kyori:adventure-text-serializer-legacy:$adventureVersion"
|
|
|
|
|
2020-08-04 23:01:35 +02:00
|
|
|
// LWJGL, for map rendering
|
2020-08-10 14:50:39 +02:00
|
|
|
lwjglApi platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
|
|
|
|
|
|
|
|
lwjglApi "org.lwjgl:lwjgl"
|
|
|
|
lwjglApi "org.lwjgl:lwjgl-egl"
|
|
|
|
lwjglApi "org.lwjgl:lwjgl-opengl"
|
|
|
|
lwjglApi "org.lwjgl:lwjgl-opengles"
|
|
|
|
lwjglApi "org.lwjgl:lwjgl-glfw"
|
2020-08-11 23:23:14 +02:00
|
|
|
lwjglApi "org.lwjgl:lwjgl-glfw"
|
|
|
|
lwjglApi 'org.joml:joml:1.9.25'
|
2020-08-10 14:50:39 +02:00
|
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
|
|
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
|
|
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl-opengles::$lwjglNatives"
|
|
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
|
2020-10-25 17:54:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
generatorsImplementation("com.squareup:javapoet:1.13.0")
|
2019-08-03 15:25:24 +02:00
|
|
|
}
|
2020-08-10 15:52:12 +02:00
|
|
|
|
2021-03-23 13:29:22 +01:00
|
|
|
configurations.all {
|
|
|
|
// we use jetbrains annotations
|
|
|
|
exclude group: "org.checkerframework", module: "checker-qual"
|
2019-08-03 15:25:24 +02:00
|
|
|
}
|
2020-08-10 15:52:12 +02:00
|
|
|
|
2021-05-25 10:42:39 +02:00
|
|
|
processResources {
|
|
|
|
dependsOn("downloadResources")
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
from components.java
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def mcVersionUnderscored = mcVersion.replace('.', '_')
|
|
|
|
def dataDest = new File(project.projectDir, "/src/main/resources/minecraft_data/")
|
|
|
|
def dataDestTags = new File(project.projectDir, "/src/main/resources/minecraft_data/tags")
|
|
|
|
def dataDestLootTable = new File(project.projectDir, "/src/main/resources/minecraft_data/loot_tables")
|
|
|
|
|
2021-05-22 21:56:01 +02:00
|
|
|
// UPDATE: Update the data to the required version
|
2021-05-25 10:42:39 +02:00
|
|
|
task downloadResources(type: Download) {
|
|
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_"
|
2021-05-22 21:56:01 +02:00
|
|
|
src([
|
|
|
|
// attributes.json
|
|
|
|
"${mainURL}attributes.json",
|
|
|
|
// biomes.json
|
|
|
|
"${mainURL}biomes.json",
|
|
|
|
// block_entities
|
|
|
|
"${mainURL}block_entities.json",
|
|
|
|
// block_properties
|
|
|
|
"${mainURL}block_properties.json",
|
|
|
|
// blocks.json
|
|
|
|
"${mainURL}blocks.json",
|
|
|
|
// custom_statistics.json
|
|
|
|
"${mainURL}custom_statistics.json",
|
|
|
|
// dimension_types.json
|
|
|
|
"${mainURL}dimension_types.json",
|
|
|
|
// enchantments.json
|
|
|
|
"${mainURL}enchantments.json",
|
|
|
|
// fluids.json
|
|
|
|
"${mainURL}fluids.json",
|
|
|
|
// items.json
|
|
|
|
"${mainURL}items.json",
|
|
|
|
// map_colors.json
|
|
|
|
"${mainURL}map_colors.json",
|
|
|
|
// particles.json
|
|
|
|
"${mainURL}particles.json",
|
|
|
|
// potion_effects.json
|
|
|
|
"${mainURL}potion_effects.json",
|
|
|
|
// potions.json
|
|
|
|
"${mainURL}potions.json",
|
|
|
|
// sounds.json
|
|
|
|
"${mainURL}sounds.json",
|
|
|
|
// villager_professions.json
|
|
|
|
"${mainURL}villager_professions.json",
|
|
|
|
// villager_types.json
|
|
|
|
"${mainURL}villager_types.json"
|
|
|
|
])
|
2021-05-25 10:42:39 +02:00
|
|
|
dest dataDest
|
2021-05-22 21:56:01 +02:00
|
|
|
overwrite true
|
2021-05-25 10:42:39 +02:00
|
|
|
dependsOn("downloadLootTables")
|
|
|
|
dependsOn("downloadTags")
|
2021-05-22 21:56:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
task downloadTags(type: Download) {
|
2021-05-25 10:42:39 +02:00
|
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_tags/${mcVersionUnderscored}_"
|
2021-05-22 21:56:01 +02:00
|
|
|
src([
|
|
|
|
// block_tags.json
|
|
|
|
"${mainURL}block_tags.json",
|
|
|
|
// entity_type_tags.json
|
|
|
|
"${mainURL}entity_type_tags.json",
|
|
|
|
// fluid_tags.json
|
|
|
|
"${mainURL}fluid_tags.json",
|
|
|
|
// item_tags.json
|
|
|
|
"${mainURL}item_tags.json",
|
|
|
|
])
|
2021-05-25 10:42:39 +02:00
|
|
|
dest dataDestTags
|
2021-05-22 21:56:01 +02:00
|
|
|
overwrite true
|
|
|
|
}
|
|
|
|
|
|
|
|
task downloadLootTables(type: Download) {
|
2021-05-25 10:42:39 +02:00
|
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_loot_tables/${mcVersionUnderscored}_"
|
2021-05-22 21:56:01 +02:00
|
|
|
src([
|
|
|
|
// block_loot_tables.json.json
|
|
|
|
"${mainURL}block_loot_tables.json",
|
|
|
|
// chest_loot_tables.json
|
|
|
|
"${mainURL}chest_loot_tables.json",
|
|
|
|
// entity_loot_tables.json
|
|
|
|
"${mainURL}entity_loot_tables.json",
|
|
|
|
// gameplay_loot_tables.json
|
|
|
|
"${mainURL}gameplay_loot_tables.json",
|
|
|
|
])
|
2021-05-25 10:42:39 +02:00
|
|
|
dest dataDestLootTable
|
2021-05-22 21:56:01 +02:00
|
|
|
overwrite true
|
2020-08-10 15:48:11 +02:00
|
|
|
}
|