-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
95 lines (78 loc) · 2.87 KB
/
build.gradle
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
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id "com.gradleup.shadow" version "8.3.5"
}
group = project.maven_group
version = project.mod_version
repositories {
mavenCentral()
flatDir {
dirs "./libs"
}
}
def urlFile = { url, name, version ->
File file = new File("${rootDir}/libs/${name}-${version}.jar")
file.parentFile.mkdirs()
if (!file.exists()) {
new URL(url).withInputStream { downloadStream ->
file.withOutputStream { fileOut -> fileOut << downloadStream
}
}
}
return [name: name, version: version]
}
configurations {
// include libraries
implementation.extendsFrom(library)
shadow.extendsFrom(library)
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
modImplementation urlFile("https://github.com/nothub/baritone-mirror/raw/refs/heads/main/${project.minecraft_version}/baritone-api-fabric-${project.minecraft_version}.jar", "baritone", "${project.minecraft_version}")
shadow "io.prometheus:prometheus-metrics-core:${project.prometheus_lib_version}"
shadow "io.prometheus:prometheus-metrics-instrumentation-jvm:${project.prometheus_lib_version}"
shadow "io.prometheus:prometheus-metrics-exporter-httpserver:${project.prometheus_lib_version}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${project.junit_version}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}"
}
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 21
}
processResources {
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
filter { line -> line.replace("@mod_version@", project.mod_version) }
filter { line -> line.replace("@minecraft_version@", project.minecraft_version) }
filter { line -> line.replace("@fabric_loader_version@", project.fabric_loader_version) }
filter { line -> line.replace("@fabric_api_version@", project.fabric_api_version) }
}
}
shadowJar {
configurations = [project.configurations.shadow]
archiveClassifier.set('shadow')
archiveVersion.set('')
}
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
enableRelocation true
relocationPrefix "lol.hub.headlessbot.shady"
}
remapJar {
dependsOn shadowJar
inputFile.set(shadowJar.archiveFile)
archiveFileName = "${project.mod_name}.jar"
doLast {
file(shadowJar.archiveFile).delete()
}
}
test {
useJUnitPlatform()
}
clean.doLast {
delete "${rootDir}/run/"
}