Plan/Plan/fabric/build.gradle

131 lines
4.0 KiB
Groovy

apply plugin: 'fabric-loom'
dependencies {
shadow project(path: ":api")
shadow project(path: ":extensions")
shadow project(path: ":common")
shadow project(path: ":common", configuration: "swaggerJson")
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
minecraft "com.mojang:minecraft:1.20.2"
mappings "net.fabricmc:yarn:1.20.2+build.1:v2"
modImplementation "net.fabricmc:fabric-loader:0.14.22"
modImplementation('me.lucko:fabric-permissions-api:0.3-SNAPSHOT')
// Fabric API
Set<String> apiModules = [
'fabric-api-base',
'fabric-command-api-v2',
'fabric-entity-events-v1',
'fabric-lifecycle-events-v1',
'fabric-networking-api-v1',
'fabric-message-api-v1'
]
apiModules.forEach {
modImplementation(fabricApi.module(it, "0.89.1+1.20.2"))
}
testImplementation project(path: ":common", configuration: 'testArtifacts')
}
loom {
// Defining separate refmap file prevents conflicts with plugin mixins
mixin.defaultRefmapName.set("plan-fabric-refmap.json")
}
tasks.withType(JavaCompile).configureEach {
options.release.set(17)
}
processResources {
inputs.property "version", project.ext.fullVersion
filesMatching("fabric.mod.json") {
expand "version": project.ext.fullVersion
}
}
shadowJar {
configurations = [project.configurations.shadow]
from findProject(':extensions:adventure').tasks.shadowJar.archiveFile
exclude('net.fabricmc:*')
exclude('/mappings/')
// Exclude these files
exclude "**/*.svg"
exclude "**/*.psd"
exclude "**/*.map"
exclude "LICENSE*.txt"
exclude "jetty-dir.css"
exclude "**/module-info.class"
exclude "module-info.class"
exclude 'META-INF/versions/' // Causes Sponge to crash
exclude 'mozilla/**/*'
// Exclude extra dependencies
exclude 'org/apache/http/**/*' // Unnecessary http client depended on by geolite2 implementation
exclude "org/junit/**/*" // see extensions/build.gradle
exclude "org/opentest4j/**/*" // see extensions/build.gradle
exclude "org/checkerframework/**/*" // Dagger compiler
exclude "com/google/common/**/*"
exclude "com/google/thirdparty/**/*"
// Exclude swagger
exclude "org/yaml/**/*"
exclude "nonapi/**/*"
exclude "io/github/classgraph/**/*"
exclude "io/swagger/**/*"
exclude "com/sun/activation/**/*"
exclude "jakarta/activation/**/*"
exclude "jakarta/validation/**/*"
exclude "jakarta/ws/**/*"
exclude "jakarta/xml/**/*"
exclude "javassist/**/*"
relocate('org.apache', 'plan.org.apache') {
exclude 'org/apache/logging/**'
}
relocate 'dagger', 'plan.dagger'
// Don't relocate MySQL or SQLite since they are loaded with a isolated class loader
// relocate 'org.sqlite', 'plan.org.sqlite'
// relocate 'com.mysql', 'plan.com.mysql'
// relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
relocate 'javax.inject', 'plan.javax.inject'
relocate 'com.github.benmanes', 'plan.com.github.benmanes'
relocate 'dev.vankka.dependencydownload', 'plan.dev.vankka.dependencydownload'
relocate 'com.maxmind', 'plan.com.maxmind'
relocate 'com.fasterxml', 'plan.com.fasterxml'
relocate 'com.zaxxer', 'plan.com.zaxxer'
relocate 'com.google.gson', 'plan.com.google.gson'
relocate 'com.google.errorprone', 'plan.com.google.errorprone'
relocate 'org.bstats', 'plan.org.bstats'
relocate 'org.eclipse.jetty', 'plan.org.eclipse.jetty'
relocate 'jakarta.servlet', 'plan.jakarta.servlet'
relocate 'javax.servlet', 'plan.javax.servlet'
relocate 'org.slf4j', 'plan.org.slf4j'
relocate 'org.json.simple', 'plan.org.json.simple'
mergeServiceFiles()
}
remapJar {
dependsOn tasks.shadowJar
mustRunAfter tasks.shadowJar
inputFile = shadowJar.archiveFile.get()
addNestedDependencies = true
destinationDirectory.set(file("$rootDir/builds/"))
archiveBaseName.set('PlanFabric')
archiveClassifier.set('')
}
shadowJar.finalizedBy(remapJar)