-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
119 lines (99 loc) · 3.22 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("jvm")
id("fabric-loom")
`maven-publish`
java
id("io.github.goooler.shadow") version("8.1.8")
}
group = property("maven_group")!!
version = "${property("mod_version")}+${property("minecraft_version_group")}"
repositories {
mavenCentral()
maven("https://maven.shedaniel.me/")
maven("https://maven.nucleoid.xyz/")
maven("https://jitpack.io")
maven("https://repo.spongepowered.org/maven/")
}
val fapiModules: Array<String> = arrayOf(
"fabric-api-base",
"fabric-command-api-v2",
)
dependencies {
fun modIncludeImplement(any: Any) {
include(modImplementation(any)!!)
}
minecraft("com.mojang:minecraft:${property("minecraft_version")}")
mappings("net.fabricmc:yarn:${property("yarn_mappings")}:v2")
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
fapiModules.forEach {
modIncludeImplement(fabricApi.module(it, property("fabric_api_version").toString()))
}
modIncludeImplement("net.fabricmc:fabric-language-kotlin:${property("fabric_kotlin_version")}")
modIncludeImplement("eu.pb4:placeholder-api:${property("placeholder_api_version")}")
// Shadow and include some extra dependencies
modIncludeImplement("org.spongepowered:configurate-extra-kotlin:4.1.2")
implementation(shadow("org.spongepowered:configurate-core:4.1.2")!!)
implementation(shadow("org.spongepowered:configurate-hocon:4.1.2")!!)
implementation(shadow("dev.kord:kord-core:0.13.1")!!)
implementation(shadow("com.vdurmont:emoji-java:5.1.1")!!)
}
tasks {
processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") {
expand(getProperties())
expand(mutableMapOf("version" to project.version))
}
}
shadowJar {
archiveClassifier = "bundle"
relocationPrefix = "dependencies"
configurations = listOf(project.configurations.shadow.get())
isEnableRelocation = true
exclude(
"**/META-INF/**",
"DebugProbesKt.bin",
"org/intellij/**",
"org/jetbrains/annotations/**",
"*.kotlin_module"
)
minimize()
}
remapJar {
inputFile = file(shadowJar.get().archiveFile)
dependsOn(shadowJar)
}
jar {
from("LICENSE")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(remapJar) {
builtBy(remapJar)
}
artifact(kotlinSourcesJar) {
builtBy(remapSourcesJar)
}
}
}
// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
}
}
compileKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
}
}
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
// configure the maven publication