-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle.kts
103 lines (88 loc) · 3.68 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
val nettyVersion: String by project
plugins {
id("java-library") apply true
id("io.freefair.lombok") version "8.6" apply false
id("com.github.johnrengelman.shadow") version "8.1.1" apply true
id("fabric-loom") version "1.7-SNAPSHOT" apply false
id("xyz.jpenilla.run-paper") version "2.3.0" apply false // Adds runServer and runMojangMappedServer tasks for testing
id("net.minecrell.plugin-yml.bukkit") version "0.6.0" apply false // Generates plugin.yml
id("org.spongepowered.gradle.plugin") version "2.2.0" apply false // Generates sponge_plugins.json and runServer task
id("io.papermc.paperweight.userdev") version "1.7.1" apply false
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
subprojects {
apply {
plugin("java-library")
plugin("io.freefair.lombok")
plugin("com.github.johnrengelman.shadow")
}
repositories {
mavenCentral()
repositories {
maven(url = "https://files.minecraftforge.net/maven/") {
name = "Minecraft Forge"
}
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "sonatype-oss-snapshots"
}
maven {
name = "Jitpack"
url = uri("https://jitpack.io")
}
}
}
dependencies {
compileOnly("io.netty:netty-buffer:$nettyVersion")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
}
tasks.shadowJar {
relocate("net.kyori.adventure.text.minimessage", "dev.qixils.relocated.adventure.minimessage")
relocate("net.kyori.adventure.text.serializer.legacy", "dev.qixils.relocated.adventure.serializer.legacy")
relocate("net.kyori.adventure.text.serializer.plain", "dev.qixils.relocated.adventure.serializer.plain")
relocate("net.kyori.adventure.serializer", "dev.qixils.relocated.adventure.serializer")
relocate("org.jetbrains.annotations", "dev.qixils.relocated.annotations")
relocate("org.intellij.lang.annotations", "dev.qixils.relocated.annotations.alt")
relocate("javassist", "dev.qixils.relocated.javassist")
relocate("javax.annotation", "dev.qixils.relocated.javax.annotation")
relocate("org.checkerframework", "dev.qixils.relocated.checkerframework")
if (project.name != "fabric-platform") {
relocate("cloud.commandframework", "dev.qixils.relocated.cloud")
}
}
if (project.name.endsWith("-platform")) {
// inherit resources from common module
sourceSets.main { resources.srcDir(project(":base-common").sourceSets["main"].resources.srcDirs) }
tasks {
// TODO: disable output of non-shaded jars? or make their file names more obvious?
shadowJar {
// exclude Java >8 META-INF files
if (java.targetCompatibility.isJava8) {
exclude("META-INF/versions/")
}
// set name of output file to CrowdControl-XYZ-VERSION.jar
val titleCaseName = project.name[0].uppercaseChar() + project.name.substring(1, project.name.indexOf("-platform"))
archiveBaseName.set("CrowdControl-$titleCaseName")
archiveClassifier.set("")
}
}
if (project.name != "fabric-platform") {
tasks {
build {
dependsOn(shadowJar)
}
}
}
}
}