-
Notifications
You must be signed in to change notification settings - Fork 432
/
build.gradle
317 lines (283 loc) · 9.94 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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
name = "gt"
url = "https://gregtech.overminddl1.com/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11'
}
}
plugins {
id 'scala'
id 'idea'
id 'maven-publish'
id "com.matthewprenger.cursegradle" version "1.4.0"
id 'com.modrinth.minotaur' version '2.2.0'
}
apply plugin: 'forge'
file "build.properties" withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
version = "${mod_version}"
if (version.endsWith("-snapshot")) {
version += "-" + (new Date().format('yyyyMMdd'))
}
group = "li.cil.oc"
archivesBaseName = "OpenComputers"
def getGitRef() {
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Throwable e) {
return "unknown"
}
}
version += "+" + getGitRef()
ext.simpleVersion = version
version = "MC${config.minecraft.version}-${project.version}"
runClient {
jvmArgs '-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader'
}
runServer {
jvmArgs '-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader'
}
compileScala {
configure(scalaCompileOptions.forkOptions) {
memoryMaximumSize = '1g'
}
}
repositories {
maven {
name = "mightypirates"
url = "https://maven.cil.li/"
metadataSources {
mavenPom()
artifact()
}
}
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
// These are necessary because some parts of the maven repo is weirdly structured, this needs to be fixed.
ivy {
name 'weird maven repos'
artifactPattern "https://maven.cil.li/[module]/[revision]/[module]-[revision].[ext]"
metadataSources {
artifact()
}
}
ivy {
name 'weird maven repos 2'
artifactPattern "https://maven.cil.li/[module]/[revision]/[module]-[revision]-[classifier].[ext]"
metadataSources {
artifact()
}
}
ivy {
name 'asie dependency mirror'
artifactPattern "https://asie.pl/javadeps/[module]-[revision](-[classifier]).[ext]"
metadataSources {
artifact()
}
}
}
configurations {
embedded
implementation.extendsFrom embedded
}
dependencies {
compileOnly "appeng:RotaryCraft:${config.rotc.version}:api"
compileOnly ("appeng:appliedenergistics2:${config.ae2.version}:dev") {
exclude module: 'buildcraft'
}
compileOnly "codechicken:CodeChickenLib:${config.minecraft.version}-${config.ccl.version}:dev"
compileOnly "codechicken:EnderStorage:${config.minecraft.version}-${config.es.version}:dev"
compileOnly "codechicken:ForgeMultipart:${config.minecraft.version}-${config.fmp.version}:dev"
compileOnly "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev"
compileOnly "codechicken:WR-CBE:${config.minecraft.version}-${config.wrcbe.version}:dev"
compileOnly "com.bluepowermod:BluePower:${config.bluepower.version}:deobf"
compileOnly "com.gregoriust.gregtech:gregtech_${config.minecraft.version}:${config.gt.version}:dev"
compileOnly "igwmod:IGW-Mod-1.7.10:${config.igwmod.version}:userdev"
compileOnly "li.cil.tis3d:TIS-3D:${config.tis3d.version}:dev"
compileOnly "mcp.mobius.waila:Waila:${config.waila.version}_${config.minecraft.version}:dev"
compileOnly "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
compileOnly "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev"
compileOnly "dev.modwarriors.notenoughkeys:NotEnoughKeys:${config.minecraft.version}-${config.nek.version}:deobf-dev"
compileOnly "qmunity:QmunityLib:${config.qmunitylib.version}:deobf"
compileOnly "tmech:TMechworks:${config.minecraft.version}-${config.tmech.version}:deobf"
compileOnly ("mrtjp:ProjectRed:${config.projred.version}:dev") {
exclude module: 'CoFHCore'
}
// compileOnly "coloredlightscore:ColoredLightsCore:${config.coloredlights.version}:api"
compileOnly name: 'buildcraft', version: config.bc.version, classifier: 'dev', ext: 'jar'
compileOnly name: 'GalacticraftCoreAll', version: config.gc.version, ext: 'jar'
compileOnly name: 'MekanismAll', version: config.mekanism.version, ext: 'jar'
compileOnly name: 'redlogic', version: config.redlogic.version, classifier: 'dev', ext: 'jar'
compileOnly name: 'CoFHLib', version: config.cofhlib.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'MineFactoryReloaded', version: config.mfr.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'ComputerCraft', version: config.cc.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'EnderIO', version: config.eio.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'Railcraft', version: config.rc.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'BloodMagic', version: config.bloodmagic.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'ExtraCells', version: config.ec.version, ext: 'jar', classifier: 'dev'
compileOnly name: 'thaumicenergistics', version: config.thaumicenergistics.version, ext: 'jar', classifier: 'dev'
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
embedded name: 'OC-LuaJ', version: '20220907.1', ext: 'jar'
embedded name: 'OC-JNLua', version: '20230530.0', ext: 'jar'
embedded name: 'OC-JNLua-Natives', version: '20220928.1', ext: 'jar'
testCompile "junit:junit:4.13"
testCompile "org.mockito:mockito-all:1.10.19"
testCompile "org.scalactic:scalactic_2.11:2.2.6"
testCompile "org.scalatest:scalatest_2.11:2.2.6"
}
minecraft {
version = "${config.minecraft.version}-${config.forge.version}"
replace "@VERSION@", "${mod_version}"
replace "/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version},${config.minecraft.version}+)\""
}
processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': "${mod_version}", 'mcversion': config.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
include 'application.conf'
filter { line ->
line.replaceAll("@VERSION@", "${mod_version}")
}
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'application.conf'
}
// Move access transformer to META-INF
rename '(.+_at.cfg)', 'META-INF/$1'
}
def commonManifest = {
attributes FMLCorePlugin: "li.cil.oc.common.launch.TransformerLoader"
attributes FMLCorePluginContainsFMLMod: "true"
attributes FMLAT: "oc_at.cfg"
}
jar {
exclude "cofh/**"
exclude "mods/**"
configurations.embedded.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
classifier = 'universal'
manifest commonManifest
}
javadoc {
include 'li/cil/oc/api/**'
}
// because the normal default jar task has been modified to be obfuscated
task deobfJar(type: Jar) {
from sourceSets.main.output
exclude "cofh/**"
exclude "mods/**"
configurations.embedded.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
classifier = 'dev'
manifest commonManifest
}
task apiJar(type: Jar) {
from sourceSets.main.output
from sourceSets.main.java
classifier = 'api'
include 'li/cil/oc/api/**'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from 'build/docs/javadoc'
classifier 'javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.java
from sourceSets.main.scala
classifier = 'sources'
}
artifacts {
archives deobfJar
archives apiJar
archives javadocJar
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = project.name
version = mod_version
artifact jar
artifact apiJar
artifact javadocJar
artifact sourcesJar
artifact deobfJar { classifier 'dev' }
}
}
repositories {
maven {
name = "GitHubPackages"
url = System.getenv("GITHUB_MAVEN_URL") ?: ""
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
curseforge {
apiKey = System.getenv('CURSEFORGE_API_KEY') ?: ""
project {
id = config.curse.project.id
releaseType = System.getenv('CURSEFORGE_RELEASE_TYPE') ?: "alpha"
changelogType = "markdown"
changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
addGameVersion config.minecraft.version
addGameVersion "Java 8"
addGameVersion "Forge"
}
}
modrinth {
token = System.getenv("MODRINTH_API_KEY") ?: ""
projectId = config.modrinth.project.id
changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
versionNumber = mod_version
versionName = "${rootProject.name}-${version}"
versionType = System.getenv('MODRINTH_RELEASE_TYPE') ?: "alpha"
uploadFile = jar
gameVersions = [config.minecraft.version]
loaders = ["forge"]
}
// this is needed for IntelliJ so we don't have to copy over the assets manually every time
idea {
module {
inheritOutputDirs = true
}
}