generated from Legacy-Fabric/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
104 lines (85 loc) · 2.56 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
96
97
98
99
100
101
102
103
104
plugins {
id "io.freefair.lombok" version "8.2.2"
id "fabric-loom" version "1.6-SNAPSHOT"
id "legacy-looming" version "1.6-SNAPSHOT" // Version must be the same as fabric-loom's
}
base.archivesName = project.archives_base_name
version = project.mod_version
group = project.maven_group
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
maven {
name = 'Jitpack'
url = 'https://jitpack.io'
}
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.legacyfabric:yarn:${project.minecraft_version}+build.${project.yarn_build}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "com.github.Zarzelcow:legacy-lwjgl3:main-SNAPSHOT"
include(modImplementation("it.unimi.dsi:fastutil:${project.fastutil_core_version}"))
include(modImplementation("org.joml:joml:${project.joml_version}"))
include(modImplementation("org.slf4j:slf4j-api:${project.slf4j_api_version}"))
includeLWJGLModules()
includeLWJGLNatives()
}
configurations.all {
exclude group: 'org.lwjgl.lwjgl'
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 17
}
}
jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" }
}
}
lombok {
version = project.lombok_version
}
loom { }
void includeLWJGLModules() {
String[] lwjglModules = project.lwjgl_modules.split(',')
dependencies {
lwjglModules.each { m ->
if (m == 'lwjgl') {
include(implementation("org.lwjgl:${m}:${project.lwjgl_version}"))
} else {
if (m == 'glfw') {
implementation("org.lwjgl:lwjgl-${m}:${project.lwjgl_version}")
} else {
include(implementation("org.lwjgl:lwjgl-${m}:${project.lwjgl_version}"))
}
}
}
}
}
void includeLWJGLNatives() {
String[] lwjglModules = project.lwjgl_modules.split(',')
String[] lwjglNativesArch = project.lwjgl_natives_arch.split(',')
dependencies {
lwjglModules.each { m ->
lwjglNativesArch.any { n ->
if (m == 'vulkan' && (n != 'macos' || n != 'macos-arm64'))
return
if (m == 'lwjgl') {
include(runtimeOnly("org.lwjgl:${m}:${project.lwjgl_version}:natives-${n}"))
} else {
include(runtimeOnly("org.lwjgl:lwjgl-${m}:${project.lwjgl_version}:natives-${n}"))
}
}
}
}
}