forked from MightyPirates/OpenComputers
-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
308 lines (270 loc) · 8.31 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
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
id 'com.modrinth.minotaur' version '2.2.0'
}
apply plugin: 'scala'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'maven-publish'
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
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 = config.mod.group
archivesBaseName = config.mod.name
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}"
minecraft {
mappings channel: "official", version: config.minecraft.version
accessTransformer = file("src/main/resources/META-INF/accesstransformer.cfg")
runs {
client {
workingDirectory project.file("run")
property "forge.logging.markers", "REGISTRIES"
property "forge.logging.console.level", "debug"
environment "MOD_CLASSES", "opencomputers%%"
}
server {
workingDirectory project.file("run")
property "forge.logging.markers", "REGISTRIES"
property "forge.logging.console.level", "debug"
environment "MOD_CLASSES", "opencomputers%%"
}
}
}
repositories {
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
url "https://maven.cil.li/"
content {
includeGroup "li.cil.tis3d"
}
}
ivy {
name 'asie dependency mirror'
artifactPattern "http://asie.pl/javadeps/[module]-[revision](-[classifier]).[ext]"
content {
includeModule '', 'OC-LuaJ'
includeModule '', 'OC-JNLua'
includeModule '', 'OC-JNLua-Natives'
}
metadataSources {
artifact()
}
}
maven {
url "https://dvs1.progwml6.com/files/maven"
content {
includeGroup "mezz.jei"
}
}
maven {
url "https://chickenbones.net/maven/"
content {
includeGroup "codechicken"
includeGroup "mrtjp"
}
}
maven {
url "https://squiddev.cc/maven/"
content {
includeGroup "org.squiddev"
}
}
maven {
url "https://modmaven.dev/"
content {
includeGroup "appeng"
includeGroup "mekanism"
}
}
maven {
url "https://proxy-maven.covers1624.net/"
content {
includeModule "net.minecraftforge", "Scorge"
}
}
mavenCentral()
}
configurations {
embedded
implementation.extendsFrom embedded
}
task devJar(type: Jar) {
classifier = 'dev'
dependsOn(jar.dependsOn)
from(jar.source)
}
dependencies {
var jeiSlug = "jei-${config.minecraft.version}"
minecraft "net.minecraftforge:forge:${config.minecraft.version}-${config.forge.version}"
runtimeOnly files(devJar.archiveFile)
compileOnly "org.scala-lang:scala-library:2.13.4"
implementation "net.minecraftforge:Scorge:${config.scorge.version}"
embedded "com.typesafe:config:1.2.1"
compileOnly fg.deobf("li.cil.tis3d:tis3d-1.16.5-forge:${config.tis3d.version}")
compileOnly fg.deobf("curse.maven:hwyla-${config.hwyla.projectId}:${config.hwyla.fileId}")
compileOnly fg.deobf("org.squiddev:cc-tweaked-${config.minecraft.version}:${config.cct.version}")
compileOnly ("appeng:appliedenergistics2:${config.ae2.version}:api") {
transitive = false
}
compileOnly("mekanism:Mekanism:${config.mekanism.version}:api") {
transitive = false
}
compileOnly ("codechicken:CBMultipart:${config.cbmultipart.version}:universal") {
exclude module: jeiSlug
exclude module: "CodeChickenLib"
}
compileOnly ("codechicken:ChickenASM:${config.casm.version}")
compileOnly "mezz.jei:${jeiSlug}:${config.jei.version}"
compileOnly "codechicken:CodeChickenLib:${config.ccl.version}:universal"
compileOnly ("mrtjp:ProjectRed:${config.projred.version}:core") {
exclude module: "CodeChickenLib"
exclude module: jeiSlug
exclude module: "CBMultipart"
}
embedded name: 'OC-LuaJ', version: '20220907.1', ext: 'jar'
embedded name: 'OC-JNLua', version: '20220928.1', ext: 'jar'
embedded name: 'OC-JNLua-Natives', version: '20220928.1', ext: 'jar'
compileOnly "codechicken:EnderStorage:${config.enderstorage.version}:universal"
}
processResources {
def reducedScorgeVer = config.scorge.version.replaceAll(/(\d+\.\d+)(\.\d+)/, "\$1")
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = "include"
include 'META-INF/mods.toml'
expand 'version':mod_version, 'mcversion':config.minecraft.version, 'sversion':reducedScorgeVer
}
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = "include"
include 'application.conf'
filter { line ->
line.replaceAll("@VERSION@", mod_version)
}
}
}
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
configure([jar, devJar]) {
configurations.embedded.each { dep ->
from(project.zipTree(dep)) {
exclude '*', 'META-INF', 'META-INF/**'
}
}
manifest {
attributes([
"Specification-Title": "opencomputers",
"Specification-Vendor": "li.cil.oc",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": version,
"Implementation-Vendor": config.mod.group,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"FMLCorePlugin": "li.cil.oc.common.launch.TransformerLoader",
"FMLCorePluginContainsFMLMod": "true"
])
}
}
javadoc {
include 'li/cil/oc/api/**'
}
task apiJar(type: Jar) {
from sourceSets.main.allSource
from sourceSets.main.output
classifier = 'api'
include 'li/cil/oc/api/**'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier 'javadoc'
}
artifacts {
archives apiJar
archives javadocJar
}
jar.finalizedBy('reobfJar')
afterEvaluate {
prepareRuns {
dependsOn(devJar)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = project.name
version = mod_version
artifact jar
artifact apiJar
artifact javadocJar
}
}
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"]
}