-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
175 lines (151 loc) · 5.44 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
import net.darkhax.curseforgegradle.TaskPublishCurseForge
plugins {
id 'java'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.spongepowered.mixin' version '0.7.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'com.modrinth.minotaur' version '2.+'
id 'net.darkhax.curseforgegradle' version '1.1.15'
}
version = "$mcversion-v$modversion"
base {
archivesName = modid
targetCompatibility = sourceCompatibility = JavaVersion.VERSION_17
}
minecraft {
mappings channel: "$mappingsch", version: "$mappings_version-$mcversion"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
copyIdeResources = true
runs {
configureEach {
workingDirectory file('run')
arg "-mixin.config=$modid.$mixin_file_suffix"
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'terminal.jline', 'true'
mods {
"${modid}" {
source sourceSets.main
}
}
}
client {
taskName "runClient"
}
}
}
repositories {
mavenCentral()
maven { url "https://repo.spongepowered.org/maven" }
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.tterrag.com/" }
maven { url "https://maven.blamejared.com" }
maven {
url 'https://www.cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:$mcversion-$fgversion"
// MIXINS
annotationProcessor "net.fabricmc:sponge-mixin:0.12.5+mixin.0.8.5"
compileOnly(annotationProcessor "io.github.llamalad7:mixinextras-common:0.3.5")
implementation "io.github.llamalad7:mixinextras-forge:0.3.5"
// DEPENDENCIES
implementation fg.deobf("org.embeddedt:embeddium-$mcversion:$embeddiumversion")
implementation fg.deobf("dev.nolij:zume:0.19.0")
// MOD COMPAT
compileOnly fg.deobf("curse.maven:jei-238222:$jeiversion")
implementation fg.deobf("curse.maven:roughly-enough-items-310111:$reiversion"){
implementation fg.deobf("curse.maven:architectury-api-419699:$archversion")
implementation fg.deobf("curse.maven:cloth-config-348521:$clothversion")
}
compileOnly fg.deobf("curse.maven:emi-580555:$emiversion")
runtimeOnly fg.deobf("curse.maven:oculus-581495:$oculusversion")
// MOD SUPPORT
implementation fg.deobf("com.simibubi.create:create-$mcversion:$createversion:slim") { transitive = false }
implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-$mcversion:$flywheelversion")
implementation fg.deobf("com.tterrag.registrate:Registrate:$registrateversion")
// UTILITY
runtimeOnly fg.deobf("curse.maven:worldedit-225608:${worldeditversion}")
}
mixin {
add sourceSets.main, "$modid.$mixin_refmap_suffix"
config("$modid.$mixin_file_suffix")
}
// Process target resources with mod info
tasks.processResources.outputs.upToDateWhen { false }
processResources {
filesMatching(['META-INF/mods.toml', 'pack.mcmeta', 'resourcepacks/**/pack.mcmeta']) {
expand(rootProject.properties)
}
}
jar {
manifest {
attributes([
"Specification-Title": modid,
"Specification-Vendor": modauthor,
"Specification-Version": modversion,
"Implementation-Title": modname,
"Implementation-Version": modversion,
"Implementation-Vendor" : modauthor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "$modid.$mixin_file_suffix"
])
}
finalizedBy('reobfJar')
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
}
task upload(type: GradleBuild) {
description 'Uploads new version to curseforge and modrinth'
group = 'publishing'
tasks = [ 'curseforge', 'modrinth' ]
}
tasks.modrinth.enabled = System.getenv("MODRINTH_TOKEN") != null
modrinth {
token = System.getenv("MODRINTH_TOKEN")
uploadFile = jar
projectId = modrinthid
versionName = modname + "/" + mcversion + "/v" + modversion
versionNumber = mcversion + "-v" + modversion
versionType = versiontype
gameVersions = [ mcversion ]
loaders = [ "forge", "neoforge" ]
changelog = getChangelogText(true)
dependencies {
required.project "embeddium"
optional.project "zume"
incompatible.project "xenon-forge"
}
}
task curseforge(type: TaskPublishCurseForge) {
apiToken = System.getenv("CURSEFORGE_TOKEN")
enabled = apiToken != null
disableVersionDetection()
def mainFile = upload(curseforgeid, jar)
mainFile.displayName = modname + "/" + mcversion + "/v" + modversion
mainFile.releaseType = versiontype
mainFile.addGameVersion(mcversion, "client")
mainFile.addModLoader("Forge", "NeoForge")
mainFile.addRequirement("embeddium")
mainFile.addOptional("zume")
mainFile.addIncompatibility("xenon", "magnesium-extras")
mainFile.changelog = getChangelogText(false)
mainFile.changelogType = "markdown"
}
String getChangelogText(boolean latest) {
String result = ''
List<String> lines = file('CHANGELOG.md').readLines('UTF-8')
for (String line: lines) {
if (latest && line.isEmpty()) {
return result
}
result += line + "\n"
}
return result
}