forked from Noobulus/Tetra-Pak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
235 lines (204 loc) · 7.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
228
229
230
231
232
233
234
235
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
mavenCentral()
maven { url = 'https://dist.creeper.host/Sponge/maven' }
maven { url = 'https://repo.spongepowered.org/maven' }
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
}
plugins {
id 'com.github.gmazzo.buildconfig' version '3.0.1'
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'org.spongepowered.mixin'
repositories {
maven {
// Location of the maven that hosts JEI files (and TiC)
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
url 'https://jitpack.io/'
}
maven {
// Location of the maven for mixed mappings, Registrate, and Flywheel
name = "tterrag maven"
url = "https://maven.tterrag.com/"
}
}
version = "${minecraft_version}-${mod_version}"
group = "mod.noobulus.${modid}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "${modid}"
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
mappings channel: 'official', version: "${minecraft_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
arg "-mixin.config=${modid}.mixins.json".toString()
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
"${modid}" {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
arg "-mixin.config=${modid}.mixins.json".toString()
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
"${modid}" {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
args "--mod", modid, "--all", "--output", file('src/generated/resources/'), "--existing", file('src/main/resources/')
mods {
"${modid}" {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("curse.maven:tetra-289712:3506628")
implementation fg.deobf("curse.maven:mgui-351914:3456505")
// implementation fg.deobf("curse.maven:create-328085:3419412")
// implementation fg.deobf("curse.maven:flywheel-486392:3419392")
runtimeOnly fg.deobf("curse.maven:druidcraft-340991:3177267")
runtimeOnly fg.deobf("curse.maven:openloader-354339:3199872")
runtimeOnly fg.deobf("curse.maven:neat-238372:3182258")
runtimeOnly fg.deobf("curse.maven:quark-243121:3394265")
runtimeOnly fg.deobf("curse.maven:quarkoddities-301051:3088871")
runtimeOnly fg.deobf("curse.maven:autoreglib-250363:3326041")
runtimeOnly fg.deobf("curse.maven:eidolon-429625:3157832")
runtimeOnly fg.deobf("curse.maven:curios-309927:3343065")
runtimeOnly fg.deobf("curse.maven:abnormals_core-382216:3457851")
runtimeOnly fg.deobf("curse.maven:autumnity-365045:3295700")
runtimeOnly fg.deobf("curse.maven:upgrade_aquatic-326895:3249419")
runtimeOnly fg.deobf("curse.maven:endergetic_expansion-291509:3154938")
runtimeOnly fg.deobf("curse.maven:betterend_reforked-537247:3507856")
runtimeOnly fg.deobf("curse.maven:infernal_expansion-395078:3487698")
// compileOnly fg.deobf("mezz.jei:jei-1.16.5:${jei_version}:api")
implementation fg.deobf("mezz.jei:jei-1.16.5:${jei_version}")
implementation fg.deobf("com.jozufozu.flywheel:Flywheel:${flywheel_version}")
implementation fg.deobf("com.simibubi.create:Create:${create_version}")
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}
compileJava.options.encoding = 'UTF-8'
jar {
manifest {
attributes([
"Specification-Title" : "${modid}",
"Specification-Vendor" : "Noobulus",
"Specification-Version" : "0.1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : "${version}",
"Implementation-Vendor" : "Noobulus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs" : "${modid}.mixins.json"
])
}
}
jar.finalizedBy('reobfJar')
mixin {
add sourceSets.main, "${modid}.refmap.json"
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
def hasUnstaged = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'status', '--porcelain'
standardOutput = stdout
}
def result = stdout.toString().replaceAll("M gradlew", "").trim()
if (!result.isEmpty())
println("Found stageable results:\n${result}\n")
return !result.isEmpty()
}
def hasCommandInstalled = { cmd ->
if (!DefaultNativePlatform.currentOperatingSystem.isWindows())
return true
def stdout = new ByteArrayOutputStream()
def stderr = new ByteArrayOutputStream()
return exec {
ignoreExitValue = true
standardOutput = stdout
errorOutput = stderr
commandLine "where", cmd
}.getExitValue() == 0 && stdout.toString().trim().contains(cmd)
}
def getGitInfo = { ->
if (!hasCommandInstalled("git")) {
println("No git install found in PATH")
return "NOGIT"
}
def stdout = new ByteArrayOutputStream()
exec {
standardOutput = stdout
commandLine "git", "--version"
}
println(stdout.toString().trim())
return "${getGitHash()}" + (hasUnstaged() ? "-modified" : "")
}
buildConfig {
buildConfigField 'String', 'MODID', "\"${modid}\""
buildConfigField 'String', 'VERSION', "\"${project.version}\""
def gitstage = getGitInfo()
println("Using git stage ${gitstage}")
buildConfigField "String", "GITHASH", "\"${gitstage}\""
version = project.version
packageName = project.group
}