-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
258 lines (230 loc) · 7.92 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
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
maven { url = 'https://maven.parchmentmc.org' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forgegradle_version}", changing: true
classpath group: 'org.spongepowered', name: 'mixingradle', version: "${mixingradle_version}"
classpath group: 'org.parchmentmc', name: 'librarian', version: "${librarian_version}"
}
}
plugins {
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'idea'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'maven-publish'
apply plugin: 'idea'
version = "${minecraft_version}-${mod_version}"
group = 'com.teammoeg'
archivesBaseName = 'ImmersiveIndustry'
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '17'
repositories {
mavenLocal()
maven {
name = "BlameJared"
url = "https://maven.blamejared.com/"
}
maven {
name = "DVS1 Maven FS"
url = "https://dvs1.progwml6.com/files/maven"
}
maven {
name = "TeamMoeg COS Maven"
url = "https://maven-1301510336.cos.ap-guangzhou.myqcloud.com"
}
}
sourceSets {
main {
resources {
srcDirs = [
"$rootDir/src/main/resources",
'src/generated/resources'
]
}
}
datagen {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
compileClasspath += main.output
runtimeClasspath += main.output
}
}
minecraft {
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
arg "-mixin.config=" + "immersiveindustry.mixins.json"
property 'forge.logging.console.level', 'debug'
mods {
immersiveindustry {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
arg "-mixin.config=" + "immersiveindustry.mixins.json"
property 'forge.logging.console.level', 'debug'
mods {
immersiveindustry {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
arg "-mixin.config=" + "immersiveindustry.mixins.json"
property 'forge.logging.console.level', 'debug'
args '--mod', 'immersiveindustry', '--all', '--output', file('src/generated/resources/'),'validate', '--existing', file('src/main/resources/'), '--existing-mod', 'immersiveengineering'
mods {
immersiveindustry {
source sourceSets.main
source sourceSets.datagen
}
}
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}")
implementation fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}:datagen")
//compile fg.deobf('com.cannolicatfish:Project-Rankine:1.16.5-1.3')
//implementation fg.deobf('com.cannolicatfish:Project-Rankine:1.16.5-1.3')
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"))
// at runtime, use the full JEI jar for Forge
implementation(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
// implementation fg.deobf("com.teammoeg:FrostedHeart:+")
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
testAnnotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
jar {
manifest {
attributes([
"Specification-Title" : "Immersive Industry",
"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": "immersiveindustry.mixins.json"
])
}
finalizedBy('reobfJar')
}
def getPrivateString(String key) {
File propFile = file("private.properties")
if (propFile.exists()) {
Properties props = new Properties()
props.load(new FileInputStream(propFile))
if ((props[key]).isEmpty()) {
return "NULL"
} else return props[key]
} else {
return "NULL"
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
archiveClassifier.set('sources')
}
task deobfJar(type: Jar) {
from sourceSets.main.output
archiveClassifier.set('deobf')
}
javadoc {
source = [sourceSets.main.allJava]
// prevent java 8's strict doclint for javadocs from failing builds
options.addStringOption('Xdoclint:none', '-quiet')
}
artifacts {
archives sourcesJar
archives deobfJar
}
String getChangelogText() {
def changelogFile = file('changelog.txt')
String str = ''
int lineCount = 0
boolean done = false
changelogFile.eachLine {
if (done || it == null) {
return
}
if (it.size() > 1) {
def temp = it
if (lineCount == 0) {
temp = "ImmersiveIndustry ${version}"
temp = "<span style=\"font-size: 18px; color: #333399;\">ImmersiveIndustry v${mod_version}</span> <em>for Minecraft ${minecraft_version}</em><br/>"
} else if (it.startsWith('-')) {
temp = " $temp<br/>"
} else {
temp = "<h4>$temp</h4>"
}
str += temp
lineCount++
}
}
return str
}
curseforge {
project {
def envApiKey = System.getenv('CURSEFORGE_API_KEY')
apiKey = envApiKey == null ? 'nope' : envApiKey
id = '542053' // Immersive Industry
changelog = getChangelogText()
changelogType = 'markdown'
releaseType = 'release' // Default versions are marked release
addGameVersion "1.20.1"
mainArtifact (jar) {
relations {
requiredDependency 'immersive-engineering'
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact deobfJar
artifact sourcesJar
}
}
repositories {
maven {
name = "TeamMoeg"
url = "http://server.teammoeg.com:8888/releases"
credentials {
username = getPrivateString("mavenUser")
password = getPrivateString("mavenToken")
}
authentication {
basic(BasicAuthentication)
}
}
maven {
name = "COS"
url = "http://127.0.0.1:9999"
}
}
}