bukman/build.gradle
Frank van der Heijden 0f9c6f4041
Relocate common module for each platform
This is needed because velocity has adventure shaded. Velocity's common module does not need to shade adventure, while BungeeCord and Bukkit do have to shade the dependency in.
2021-08-03 18:28:37 +02:00

141 lines
4.5 KiB
Groovy

plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
group = 'net.frankheijden.serverutils'
String dependencyDir = group + '.dependencies'
version = '2.5.6'
allprojects {
ext {
cloudVersion = '62e3bc97ef'
}
}
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://repo.incendo.org/content/repositories/snapshots' }
maven { url 'https://papermc.io/repo/repository/maven-public/' }
maven { url 'https://libraries.minecraft.net' }
}
dependencies {
implementation "com.github.FrankHeijden.cloud:cloud-core:${rootProject.cloudVersion}"
implementation "com.github.FrankHeijden.cloud:cloud-brigadier:${rootProject.cloudVersion}"
implementation 'com.github.FrankHeijden:MinecraftReflection:1.0.0'
implementation ('net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT') {
exclude group: 'net.kyori', module: 'adventure-api'
}
implementation 'com.google.guava:guava:30.1.1-jre'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'me.lucko:commodore:1.10'
compileOnly 'com.mojang:brigadier:1.0.17'
testCompile 'org.assertj:assertj-core:3.18.1'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testCompile 'org.junit.jupiter:junit-jupiter-params:5.7.0'
testCompile 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
compileJava {
options.compilerArgs += ["-parameters"]
options.fork = true
options.forkOptions.executable = 'javac'
}
test {
useJUnitPlatform()
}
checkstyle {
toolVersion "8.38"
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
ignoreFailures = false
maxErrors = 0
maxWarnings = 0
}
shadowJar {
exclude 'com/mojang/**'
exclude 'javax/annotation/**'
exclude 'org/checkerframework/**'
exclude 'com/google/errorprone/**'
exclude 'com/google/j2objc/**'
exclude 'com/google/thirdparty/**'
exclude 'com/google/common/annotations/**'
exclude 'com/google/common/base/**'
exclude 'com/google/common/cache/**'
exclude 'com/google/common/collect/**'
exclude 'com/google/common/escape/**'
exclude 'com/google/common/eventbus/**'
exclude 'com/google/common/hash/**'
exclude 'com/google/common/html/**'
exclude 'com/google/common/io/**'
exclude 'com/google/common/math/**'
exclude 'com/google/common/net/**'
exclude 'com/google/common/primitives/**'
exclude 'com/google/common/reflect/**'
exclude 'com/google/common/util/**'
exclude 'com/google/common/xml/**'
relocate 'com.google.gson', dependencyDir + '.gson'
relocate 'com.google.common.graph', dependencyDir + '.common.graph'
relocate 'dev.frankheijden.minecraftreflection', dependencyDir + '.minecraftreflection'
relocate 'cloud.commandframework', dependencyDir + '.cloud'
relocate 'me.lucko.commodore', dependencyDir + '.commodore'
relocate 'io.leangen.geantyref', dependencyDir + '.typetoken'
}
shadowJar.dependsOn checkstyleMain, checkstyleTest, test
}
repositories {
mavenCentral()
}
dependencies {
implementation project(path: ':Common', configuration: 'shadow')
implementation project(path: ':Bukkit', configuration: 'shadow')
implementation project(path: ':Bungee', configuration: 'shadow')
implementation project(path: ':Velocity', configuration: 'shadow')
}
shadowJar {
relocate 'org.apache.commons.codec', dependencyDir + '.codec'
relocate 'dev.frankheijden.minecraftreflection', dependencyDir + '.minecraftreflection'
archiveFileName = "${archiveBaseName.orNull}-${archiveVersion.orNull}.${archiveExtension.orNull}"
}
def outputTasks() {
[
"shadowJar",
":Bukkit:shadowJar",
":Bungee:shadowJar",
":Velocity:shadowJar",
].stream().map({ tasks.findByPath(it) })
}
task copyJars(type: Copy) {
outputTasks().forEach({ from(it) })
rename '(.*)-all.jar', '$1.jar'
into file('jars')
}
task cleanJars() {
delete file('jars')
}
clean.dependsOn cleanJars
build.dependsOn shadowJar
build.dependsOn copyJars