-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
227 lines (200 loc) · 5.98 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
import me.modmuss50.mpp.ReleaseType
plugins {
id 'maven-publish'
id 'java-library'
alias libs.plugins.managedversioning
alias libs.plugins.modsdotgroovy
alias libs.plugins.modpublish
alias libs.plugins.opensesame
}
opensesame {
apply(sourceSets.main)
apply(sourceSets.fabric)
apply(sourceSets.neoforge)
}
managedVersioning {
versionFile.set rootProject.file('version.properties')
metadataVersion.set libs.versions.minecraft
versionPRs()
versionSnapshots()
gitHubActions {
release {
prettyName.set 'Release'
workflowDispatch.set(true)
gradleJob {
name.set 'build'
javaVersion.set '21'
buildCache()
step {
setupGitUser()
}
readOnly.set false
gradlew 'Tag Release', 'tagRelease'
gradlew 'Build', 'build'
step {
run.set 'git push && git push --tags'
}
recordVersion 'Record Version', 'version'
dependencySubmission()
mavenRelease('github')
modPublishing()
}
gradleJob {
name.set 'publishMod'
javaVersion.set '21'
buildCache()
needs.add('build')
tag.set('${{needs.build.outputs.version}}')
gradlew 'Publish', 'publishMods'
mavenRelease('github')
modPublishing()
}
}
}
}
managedVersioning.apply()
println "Building: $version"
modsDotGroovy {
multiplatform.expose()
gather {
projectProperty('mod_id')
projectProperty('mod_name')
projectProperty('mod_description')
}
}
sourceSets.neoforge.modsDotGroovy {
platform = org.groovymc.modsdotgroovy.types.core.Platform.NEOFORGE
inferGather.set false
multiplatform.from(':', 'main')
gather {
minecraftVersion = libs.versions.minecraft.get()
platformVersion = libs.versions.neoforge.get()
}
enable()
}
sourceSets.fabric.modsDotGroovy {
platform = org.groovymc.modsdotgroovy.types.core.Platform.FABRIC
inferGather.set false
multiplatform.from(':', 'main')
gather {
minecraftVersion = libs.versions.minecraft.get()
platformVersion = libs.versions.fabric.loader.get()
}
enable()
}
dependencies {
compileOnly cLibs.bundles.compileonly
annotationProcessor cLibs.bundles.annotationprocessor
compileOnly libs.fabric.mixin
compileOnly libs.mixinextras.common
compileOnly libs.opensesame.core
compileOnly libs.codecextras
fabricCompileOnly cLibs.bundles.compileonly
fabricAnnotationProcessor cLibs.bundles.annotationprocessor
fabricImplementation libs.opensesame.fabric
fabricInclude libs.opensesame.fabric
fabricImplementation libs.codecextras
fabricInclude libs.codecextras
modFabricImplementation libs.fabric.loader
modFabricImplementation libs.fabric.api
neoforgeCompileOnly cLibs.bundles.compileonly
neoforgeAnnotationProcessor cLibs.bundles.annotationprocessor
neoforgeLocalImplementation libs.opensesame.core
neoforgeInclude libs.opensesame.core
neoforgeLocalImplementation libs.codecextras
neoforgeInclude libs.codecextras
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
java {
withSourcesJar()
withJavadocJar()
registerFeature("neoforge") {
usingSourceSet sourceSets.neoforge
capability(project.group as String, project.name, project.version as String)
capability(project.group as String, "$project.name-neoforge", project.version as String)
withSourcesJar()
withJavadocJar()
}
registerFeature("fabric") {
usingSourceSet sourceSets.fabric
capability(project.group as String, project.name, project.version as String)
capability(project.group as String, "$project.name-fabric", project.version as String)
withSourcesJar()
withJavadocJar()
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
['sourcesJar', 'fabricSourcesJar', 'neoforgeSourcesJar'].each {
tasks.named(it, Jar) {
from(files("LICENSE")) {
rename { "${it}_${project.name}" }
}
}
}
['jar', 'fabricJar', 'neoforgeJar'].each {
tasks.named(it, Jar) {
from(files("LICENSE")) {
rename { "${it}_${project.name}" }
}
manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.version,
'Implementation-Title' : "$mod_name - ${project.name}",
'Implementation-Version' : project.version,
'Implementation-Vendor' : mod_author,
'Built-On-Minecraft' : libs.versions.minecraft.get(),
'Implementation-Commit-Time': managedVersioning.timestamp.get(),
'Implementation-Commit': managedVersioning.hash.get()
])
}
}
}
def releaseType = ReleaseType.values().find { it.name() == project.release_type.toUpperCase(Locale.ROOT) } ?: ReleaseType.STABLE
publishMods {
changelog = ''
version = "${project.version}"
type = releaseType
dryRun = providers.environmentVariable("MODRINTH_KEY").getOrNull() == null || providers.environmentVariable("CURSEFORGE_KEY").getOrNull() == null
curseforge('curseforgeFabric') {
file = tasks.remapFabricJar.archiveFile
displayName = "${project.mod_name} [Fabric/Quilt] v${project.version}"
projectId = project.curseforge_id
accessToken = System.getenv('CURSEFORGE_KEY')
modLoaders = ['fabric', 'quilt']
minecraftVersions = [libs.versions.minecraft.get()]
requires('fabric-api')
}
curseforge('curseforgeNeoforge') {
file = tasks.remapNeoforgeJar.archiveFile
displayName = "${project.mod_name} [NeoForge] v${project.version}"
projectId = project.curseforge_id
accessToken = System.getenv('CURSEFORGE_KEY')
modLoaders = ['neoforge']
minecraftVersions = [libs.versions.minecraft.get()]
}
modrinth('modrinthFabric') {
file = tasks.remapFabricJar.archiveFile
displayName = "${project.mod_name} [Fabric/Quilt] v${project.version}"
projectId = project.modrinth_id
accessToken = System.getenv('MODRINTH_KEY')
minecraftVersions = [libs.versions.minecraft.get()]
modLoaders = ['fabric', 'quilt']
requires('fabric-api')
}
modrinth('modrinthNeoforge') {
file = tasks.remapNeoforgeJar.archiveFile
displayName = "${project.mod_name} [NeoForge] v${project.version}"
projectId = project.modrinth_id
accessToken = System.getenv('MODRINTH_KEY')
minecraftVersions = [libs.versions.minecraft.get()]
modLoaders = ['neoforge']
}
}