2021-09-18 21:38:12 +02:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
|
|
|
2021-07-24 13:10:48 +02:00
|
|
|
plugins {
|
2021-08-09 06:36:15 +02:00
|
|
|
id 'fabric-loom' version '0.9.+'
|
2021-07-24 13:10:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
|
|
|
|
implementation project(path: ":common", configuration: 'shadow')
|
|
|
|
shadow project(path: ":common", configuration: 'shadow')
|
|
|
|
compileOnly project(":api")
|
|
|
|
modImplementation('me.lucko:fabric-permissions-api:0.1-SNAPSHOT')
|
|
|
|
|
|
|
|
minecraft "com.mojang:minecraft:1.17.1"
|
2021-08-09 06:36:15 +02:00
|
|
|
mappings "net.fabricmc:yarn:1.17.1+build.35:v2"
|
2021-07-24 13:10:48 +02:00
|
|
|
modImplementation "net.fabricmc:fabric-loader:0.11.6"
|
|
|
|
|
|
|
|
// Fabric API
|
|
|
|
Set<String> apiModules = [
|
|
|
|
'fabric-api-base',
|
|
|
|
'fabric-command-api-v1',
|
|
|
|
'fabric-entity-events-v1',
|
|
|
|
'fabric-lifecycle-events-v1',
|
|
|
|
'fabric-networking-api-v1'
|
|
|
|
]
|
|
|
|
|
|
|
|
apiModules.forEach {
|
2021-08-09 06:36:15 +02:00
|
|
|
modImplementation(fabricApi.module(it, "0.37.1+1.17"))
|
2021-07-24 13:10:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
testImplementation project(path: ":common", configuration: 'testArtifacts')
|
|
|
|
}
|
|
|
|
|
|
|
|
compileJava {
|
|
|
|
options.release = 16
|
|
|
|
}
|
|
|
|
|
2021-09-18 21:38:12 +02:00
|
|
|
tasks.register('updateVersion', Copy) {
|
|
|
|
from('src/main/resources') {
|
|
|
|
include 'fabric.mod.json'
|
|
|
|
}
|
|
|
|
into 'build/sources/resources/'
|
|
|
|
filter(ReplaceTokens, tokens: [version: '' + project.ext.fullVersion])
|
|
|
|
}
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
dependsOn updateVersion
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
|
|
from 'build/sources/resources'
|
|
|
|
}
|
|
|
|
|
2021-10-27 17:43:14 +02:00
|
|
|
//slimJar {
|
|
|
|
// relocate 'com.mysql', 'plan.com.mysql'
|
|
|
|
// relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
|
|
|
//}
|
2021-08-09 06:36:15 +02:00
|
|
|
|
2021-07-24 13:10:48 +02:00
|
|
|
shadowJar {
|
|
|
|
configurations = [project.configurations.shadow]
|
|
|
|
exclude('net.fabricmc:*')
|
|
|
|
exclude('/mappings/')
|
|
|
|
|
|
|
|
relocate('org.apache', 'plan.org.apache') {
|
|
|
|
exclude 'org/apache/logging/**'
|
|
|
|
}
|
|
|
|
relocate 'dagger', 'plan.dagger'
|
|
|
|
// Don't relocate SQLite since the org.sqlite.NativeDB class calls are not relocated properly
|
|
|
|
// relocate 'org.sqlite', 'plan.org.sqlite'
|
|
|
|
relocate 'javax.inject', 'plan.javax.inject'
|
|
|
|
relocate 'com.github.benmanes', 'plan.com.github.benmanes'
|
2021-10-27 17:43:14 +02:00
|
|
|
|
|
|
|
relocate 'com.mysql', 'plan.com.mysql'
|
|
|
|
relocate 'com.google.protobuf', 'plan.com.mysql.cj.x.google.protobuf'
|
2021-07-24 13:10:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
remapJar {
|
|
|
|
dependsOn tasks.shadowJar
|
|
|
|
mustRunAfter tasks.shadowJar
|
|
|
|
input = shadowJar.archiveFile.get()
|
|
|
|
addNestedDependencies = true
|
|
|
|
|
|
|
|
destinationDirectory.set(file("$rootDir/builds/"))
|
|
|
|
archiveBaseName.set('PlanFabric')
|
|
|
|
archiveClassifier.set('')
|
|
|
|
}
|
|
|
|
|
|
|
|
shadowJar.finalizedBy(remapJar)
|