-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
291 lines (262 loc) · 10.3 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
plugins {
//id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'org.cadixdev.licenser' version '0.6.1'
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version "${version_neogradle}"
id "com.modrinth.minotaur" version "2.+"
id 'net.darkhax.curseforgegradle' version '1.1.15'
}
/*
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'maven-publish'*/
tasks.named('wrapper', Wrapper).configure {
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
distributionType = Wrapper.DistributionType.BIN
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
version = "${minecraft_version}-${mod_version}"
group = mod_group_id
archivesBaseName = mod_name
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
sourceSets {
main {
java {
srcDir 'src/generated/java'
}
resources {
srcDir 'src/generated/resources'
}
}
datagen {
compileClasspath += main.compileClasspath
compileClasspath += main.output
/* resources {
srcDirs = [
"$rootDir/src/datagen/resources",
]
}*/
}
client {}
}
minecraft {
accessTransformers {
file('src/main/resources/META-INF/accesstransformer.cfg')
}
}
runs {
// applies to all the run configs below
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
systemProperty 'forge.logging.console.level', 'debug'
modSource project.sourceSets.main
}
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
modSource project.sourceSets.client
modSource project.sourceSets.main
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
argument '--nogui'
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
data {
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// workingDirectory project.file('run-data')
//modSource project.sourceSets.datagen
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
modSource project.sourceSets.main
modSource project.sourceSets.datagen
arguments.addAll '--mod', project.mod_id,
'--all',
'--output', file('src/generated/resources/').getAbsolutePath(),
'--existing', file('src/main/resources/').getAbsolutePath()
}
}
/*
mixin {
add sourceSets.main, "caupona.refmap.json"
}
*/
repositories {
mavenLocal()
mavenCentral()
// maven { url "https://maven.shedaniel.me" }
//khjxiaogu public maven
maven { url "https://www.khjxiaogu.com/maven" }
exclusiveContent {
forRepository {
maven {
url "https://cursemaven.com/"
}
}
filter {
includeGroup "curse.maven"
}
}
//for patchouli books and jei
maven { url 'https://maven.blamejared.com' }
maven { url "https://maven.architectury.dev/" }
//for top
maven { url "https://maven.k-4u.nl" }
maven {
url "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.ftb.mods"
includeGroup "dev.latvian.mods"
}
}
}
configurations {
runtimeClasspath.extendsFrom localRuntime
}
dependencies {
//minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation "net.neoforged:neoforge:${neo_version}"
implementation "mcjty.theoneprobe:theoneprobe:${top_version}"
//implementation fg.deobf("curse.maven:diet-443570:3758891")
//compileOnly fg.deobf("mezz.jei:jei-1.19.2-common-api:11.2.0.247")
//implementation "curse.maven:jei-238222:5665038"
compileOnly("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
compileOnly("mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}")
// at runtime, use the full JEI jar for NeoForge
runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}")
compileOnly "curse.maven:diet-443570:4813904"
//implementation fg.deobf("mezz.jei:jei-1.19.3-forge:12.3.0.21")
//implementation fg.deobf("curse.maven:kiwi-303657:3974084")
//implementation fg.deobf("curse.maven:treechop-421377:4365698")
//implementation fg.deobf("curse.maven:create-328085:4371809")
//implementation fg.deobf("curse.maven:farmers-delight-398521:3573686")
//implementation fg.deobf("curse.maven:pams-harvestcraft-2-crops-361385:3276350")
//implementation fg.deobf("curse.maven:crock-pot-404523:3782459")
//implementation fg.deobf("curse.maven:simple-farming-327554:3400041")
//compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.20.1-81-FORGE:api")
compileOnly "vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}:api"
//compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:14.0.688"
//clientRuntimeOnly "me.shedaniel:RoughlyEnoughItems-neoforge:14.0.688"
// FG5 requires 0.8.3
//annotationProcessor "org.spongepowered:mixin:0.8.3:processor"
//testAnnotationProcessor "org.spongepowered:mixin:0.8.3:processor"
}
jar {
manifest {
attributes([
"Specification-Title" : "Caupona",
"Specification-Vendor" : "TeamMoeg",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.version,
"Implementation-Vendor" : "TeamMoeg",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "caupona.mixins.json"
])
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
archiveClassifier.set('sources')
}
String getChangelogText() {
def changelogFile = file('changelog.txt')
String str = "<span style=\"font-size: 18px; color: #333399;\">Caupona v${mod_version}</span> <em>for Minecraft ${minecraft_version}</em><br/>"
int lineCount = 0
boolean done = false
changelogFile.eachLine {
if (done || it == null) {
return
}
if (it.size() > 1) {
def temp = it
str += temp+"<br />"
lineCount++
}
}
return str
}
artifacts {
archives sourcesJar
}
// Automatically apply a license header when running checkLicense / updateLicense
license {
header = project.file('HEADER.txt')
ignoreFailures = true
include '**/*.java'
}
publish.finalizedBy('publishToMavenLocal')
publishing {
publications {
maven(MavenPublication) {
artifact jar
artifact sourcesJar
}
}
repositories {
maven {
url = 'https://www.khjxiaogu.com/maven'
credentials {
username = findProperty('khjmavenUser')
password = findProperty('khjmavenPass')
}
}
}
}
task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
def envApiKey = System.getenv('CURSEFORGE_API_KEY')
apiToken = envApiKey == null ? 'nope' : envApiKey
group = "publishing"
// A project ID is required to tell CurseForge which project the uploaded
// file belongs to. This is public on your project page and is not private
// information.
projectId = project.projectId
// Tells CurseForgeGradle to publish the output of the jar task. This will
// return a UploadArtifact object that can be used to further configure the
// file.
def mainFile = upload(projectId, jar)
mainFile.changelog = getChangelogText()
mainFile.changelogType = 'html'
mainFile.releaseType=project.curse_type
mainFile.addOptional("patchouli","jei")
mainFile.addGameVersion(project.minecraft_version)
mainFile.addModLoader("NeoForge")
}
modrinth {
token = System.getenv("MODRINTH_TOKEN") // Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private!
projectId = project.modrinthId // This can be the project ID or the slug. Either will work!
versionNumber = project.version // You don't need to set this manually. Will fail if Modrinth has this version already
versionType = project.curse_type // This is the default -- can also be `beta` or `alpha`
uploadFile = jar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = [project.minecraft_version] // Must be an array, even with only one version
loaders = ["neoforge"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
dependencies { // A special DSL for creating dependencies
optional.project "jei"
optional.project "patchouli"
}
}
publish.finalizedBy('modrinth','publishCurseForge')