-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
229 lines (189 loc) · 6.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
import com.modrinth.minotaur.dependencies.ModDependency
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import ua.pp.lumivoid.updater.UpdateChecker
plugins {
id "fabric-loom" version "1.9.2"
id "org.jetbrains.kotlin.plugin.serialization" version "2.1.0"
id "org.jetbrains.kotlin.jvm" version "2.1.0"
id "com.modrinth.minotaur" version "2.+"
id 'maven-publish'
}
version = project.mod_version + project.version_suffix
group = project.maven_group
archives_base_name = project.archives_base_name + "-" + project.minecraft_version
base {
archivesName = project.archives_base_name
}
repositories {
maven { url "https://maven.wispforest.io" }
maven {
name = "WorldEdit Maven"
url = "https://maven.enginehub.org/repo/"
}
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
implementation include("org.mariuszgromada.math:MathParser.org-mXparser:${project.mxparser_version}")
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${project.kotlinx_coroutines_version}"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:${project.kotlinx_serialization_version}"
modImplementation "io.wispforest:owo-lib:${project.owo_version}"
annotationProcessor "io.wispforest:owo-lib:${project.owo_version}"
include "io.wispforest:owo-sentinel:${project.owo_version}"
modImplementation("com.sk89q.worldedit:worldedit-fabric-mc${project.world_edit_version}") {
exclude group: "it.unimi.dsi", module: "fastutil"
exclude group: "com.google.guava", module: "guava"
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = 21
}
}
sourceSets {
testmod {
runtimeClasspath += main.runtimeClasspath
compileClasspath += main.compileClasspath
}
}
loom {
runs {
testmodClient {
client()
ideConfigGenerated project.rootProject == project
name = "Testmod Client"
source sourceSets.testmod
}
testmodServer {
server()
ideConfigGenerated project.rootProject == project
name = "Testmod Server"
source sourceSets.testmod
}
}
}
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()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jar {
from("LICENSE")
}
tasks.runClient {
doFirst {
args "--gameDir", file("run/client").absolutePath
}
}
tasks.runServer {
doFirst {
args "--gameDir", file("run/server").absolutePath
}
}
tasks.runTestmodClient {
group = "Update and tests"
doFirst {
args "--gameDir", file("run/client").absolutePath
}
}
tasks.runTestmodServer {
group = "Update and tests"
doFirst {
args "--gameDir", file("run/server").absolutePath
}
}
modrinth {
def autoReleaseNotify = "Small note, this is automatic update, it can be unstable, so report if something wrong"
token = project.hasProperty("modrinthToken") ? project.modrinthToken : System.getenv("MODRINTH_TOKEN")
projectId = project.id_main
versionNumber = project.mod_version + project.version_suffix
versionName = "Redstone Helper ${project.mod_version + project.version_suffix}"
uploadFile = remapJar
//additionalFiles = [remapSourcesJar]
gameVersions = Eval.me(project.release_minecraft_versions)
versionType = project.hasProperty("autoUpdate") ? "beta" : project.release_type
loaders = ["fabric"]
syncBodyFrom = rootProject.file("README.md").text
changelog = project.hasProperty("autoUpdate") ? rootProject.file("CHANGELOG.md").text + "\n\n" + autoReleaseNotify : rootProject.file("CHANGELOG.md").text
dependencies = [
new ModDependency(project.id_fabric_api, "required"),
new ModDependency(project.id_fabric_kotlin, "required"),
new ModDependency(project.id_owo, "required"),
new ModDependency(project.id_modmenu, "optional"),
new ModDependency(project.id_world_edit, "optional")
]
// debugMode = true
tasks.modrinth.finalizedBy(tasks.modrinthSyncBody)
}
tasks.register("UpdateRedstoneHelper") {
// Configurable
def minecraftVersionURL = "https://meta.fabricmc.net/v2/versions/game"
def yarnVersionURL = "https://meta.fabricmc.net/v2/versions/yarn"
def updateListURL = [
"loader_version": "https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml",
"fabric_kotlin_version": "https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/maven-metadata.xml",
"fabric_api_version": "https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/maven-metadata.xml",
"mxparser_version": "https://repo.maven.apache.org/maven2/org/mariuszgromada/math/MathParser.org-mXparser/maven-metadata.xml",
"owo_version": "https://maven.wispforest.io/releases/io/wispforest/owo-lib/maven-metadata.xml",
"kotlinx_coroutines_version": "https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/maven-metadata.xml",
"kotlinx_serialization_version": "https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-serialization-json-jvm/maven-metadata.xml"
]
group = "Update and tests"
doLast {
println("Updating dependencies")
def currentMinecraftVersion = project.minecraft_version
//def currentMinecraftVersion = "1.21" // Just for tests
def file = new File("gradle.properties")
def success = UpdateChecker.INSTANCE.checkForUpdates(updateListURL, minecraftVersionURL, currentMinecraftVersion, yarnVersionURL, file)
println()
println()
println()
if (success) {
println("Success updated dependencies")
} else {
throw new GradleException("Dependencies didn't update successfully")
}
}
}
tasks.register("UpdateRedstoneHelperWithTests") {
group = "Update and tests"
tasks.UpdateRedstoneHelperWithTests.dependsOn(tasks.UpdateRedstoneHelper)
tasks.UpdateRedstoneHelperWithTests.finalizedBy(tasks.runTestmodClient)
}
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = archives_base_name
groupId = project.maven_group
version = version
//noinspection GroovyAssignabilityCheck
from components.java
}
}
repositories {
maven {
name = 'Lumivoid'
url = 'https://maven.lumivoid.pp.ua/repository/lumivoid/'
credentials {
username = project.hasProperty("mavenUsername") ? project.mavenUsername : System.getenv("MAVEN_USERNAME")
password = project.hasProperty("mavenPassword") ? project.mavenPassword : System.getenv("MAVEN_PASSWORD")
}
}
}
}