mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-28 20:18:10 +01:00
299 lines
9.7 KiB
Groovy
299 lines
9.7 KiB
Groovy
import org.gradle.internal.os.OperatingSystem
|
|
|
|
plugins {
|
|
id 'java-library'
|
|
id 'maven-publish'
|
|
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
|
|
id 'checkstyle'
|
|
// Used to download our data
|
|
id 'de.undercouch.download' version '4.1.1'
|
|
}
|
|
|
|
group 'net.minestom.server'
|
|
version '1.0'
|
|
|
|
sourceCompatibility = 11
|
|
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
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
mavenCentral()
|
|
maven { url 'https://jitpack.io' }
|
|
maven {
|
|
name 'sponge'
|
|
url 'https://repo.spongepowered.org/maven'
|
|
}
|
|
maven {
|
|
url "https://repo.velocitypowered.com/snapshots/"
|
|
}
|
|
}
|
|
javadoc {
|
|
options {
|
|
destinationDir(file("docs"))
|
|
addBooleanOption('html5', true)
|
|
links "https://jd.adventure.kyori.net/api/$adventureVersion/"
|
|
links "https://docs.oracle.com/en/java/javase/11/docs/api/"
|
|
}
|
|
|
|
// see https://stackoverflow.com/a/56641766
|
|
doLast {
|
|
// Append the fix to the file
|
|
def searchScript = new File(destinationDir, '/search.js')
|
|
searchScript.append '\n\n' +
|
|
'getURLPrefix = function(ui) {\n' +
|
|
' return \'\';\n' +
|
|
'};\n'
|
|
}
|
|
}
|
|
|
|
checkstyle {
|
|
toolVersion "8.42"
|
|
configFile file("${projectDir}/minestom_checks.xml")
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir 'src/main/java'
|
|
srcDir 'src/autogenerated/java'
|
|
}
|
|
}
|
|
lwjgl {
|
|
java {
|
|
srcDir 'src/lwjgl/java'
|
|
}
|
|
|
|
compileClasspath += sourceSets.main.runtimeClasspath
|
|
runtimeClasspath += sourceSets.main.runtimeClasspath
|
|
}
|
|
}
|
|
|
|
java {
|
|
// Minestom uses LWJGL libs as optional dependency if interfacing with a GPU is asked
|
|
registerFeature("lwjgl") {
|
|
usingSourceSet(sourceSets.lwjgl)
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
tasks.withType(Zip).configureEach {
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
}
|
|
|
|
dependencies {
|
|
// Junit Testing Framework
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
|
|
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2')
|
|
|
|
// Only here to ensure J9 module support for extensions and our classloaders
|
|
testCompileOnly "org.mockito:mockito-core:2.28.2"
|
|
|
|
// Netty
|
|
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'
|
|
api 'io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.5.Final:linux-x86_64'
|
|
|
|
// https://mvnrepository.com/artifact/it.unimi.dsi/fastutil
|
|
api 'it.unimi.dsi:fastutil:8.5.4'
|
|
|
|
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
|
api 'com.google.code.gson:gson:2.8.6'
|
|
|
|
// Noise library for terrain generation
|
|
// https://jitpack.io/#Articdive/Jnoise
|
|
api 'com.github.Articdive:Jnoise:2.1.0'
|
|
|
|
// https://mvnrepository.com/artifact/org.rocksdb/rocksdbjni
|
|
api 'org.rocksdb:rocksdbjni:6.16.4'
|
|
|
|
// Logging
|
|
api 'org.apache.logging.log4j:log4j-core:2.14.0'
|
|
// SLF4J is the base logger for most libraries, therefore we can hook it into log4j2.
|
|
api 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.0'
|
|
|
|
// https://mvnrepository.com/artifact/org.jline/jline
|
|
implementation group: 'org.jline', name: 'jline', version: '3.20.0'
|
|
|
|
// 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'
|
|
|
|
// Guava 21.0+ required for Mixin
|
|
api 'com.google.guava:guava:30.1-jre'
|
|
|
|
// Code modification
|
|
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}"
|
|
|
|
// Compression
|
|
implementation "com.velocitypowered:velocity-native:1.1.0-SNAPSHOT"
|
|
|
|
// Path finding
|
|
api 'com.github.MadMartian:hydrazine-path-finding:1.6.0'
|
|
|
|
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${project.kotlinVersion}"
|
|
api "org.jetbrains.kotlin:kotlin-reflect:${project.kotlinVersion}"
|
|
|
|
// NBT parsing/manipulation/saving
|
|
api("com.github.jglrxavpok:Hephaistos:${project.hephaistosVersion}")
|
|
api("com.github.jglrxavpok:Hephaistos:${project.hephaistosVersion}:gson")
|
|
api("com.github.jglrxavpok:Hephaistos:${project.hephaistosVersion}") {
|
|
capabilities {
|
|
requireCapability("org.jglrxavpok.nbt:Hephaistos-gson")
|
|
}
|
|
}
|
|
|
|
api "com.github.Minestom:DependencyGetter:v1.0.1"
|
|
|
|
// 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"
|
|
|
|
// LWJGL, for map rendering
|
|
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"
|
|
lwjglApi "org.lwjgl:lwjgl-glfw"
|
|
lwjglApi 'org.joml:joml:1.9.25'
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl-opengles::$lwjglNatives"
|
|
lwjglRuntimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
|
|
}
|
|
|
|
configurations.all {
|
|
// we use jetbrains annotations
|
|
exclude group: "org.checkerframework", module: "checker-qual"
|
|
}
|
|
|
|
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")
|
|
|
|
// UPDATE: Update the data to the required version
|
|
task downloadResources(type: Download) {
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_"
|
|
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",
|
|
// entities.json
|
|
"${mainURL}entities.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"
|
|
])
|
|
dest dataDest
|
|
overwrite true
|
|
dependsOn("downloadLootTables")
|
|
dependsOn("downloadTags")
|
|
}
|
|
|
|
task downloadTags(type: Download) {
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_tags/${mcVersionUnderscored}_"
|
|
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",
|
|
])
|
|
dest dataDestTags
|
|
overwrite true
|
|
}
|
|
|
|
task downloadLootTables(type: Download) {
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_loot_tables/${mcVersionUnderscored}_"
|
|
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",
|
|
])
|
|
dest dataDestLootTable
|
|
overwrite true
|
|
} |