This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
forked from cc-tweaked/cc-restitched
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
284 lines (227 loc) · 8.06 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
plugins {
id "jacoco"
id "maven-publish"
//id "org.jetbrains.kotlin.jvm" version "1.5.21"
id 'fabric-loom' version '0.12-SNAPSHOT'
id "com.modrinth.minotaur" version "2.+"
//id 'com.matthewprenger.cursegradle' version '1.4.0'
}
def javaVersion = JavaLanguageVersion.of(17)
java {
toolchain {
languageVersion = javaVersion
}
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaExec).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = javaVersion
}
}
version = project.mod_version
group = "dan200.computercraft"
archivesBaseName = "cc-restitched"
sourceSets {
main.resources {
srcDir 'src/generated/resources'
}
testMod {}
}
loom {
accessWidenerPath = file("src/main/resources/cc.accesswidener")
runs {
data {
server()
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}"
runDir "build/datagen"
}
}
}
repositories {
mavenCentral()
maven {
name "SquidDev"
url "https://squiddev.cc/maven"
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven {
name = "NucleoidMC"
url = "https://maven.nucleoid.xyz"
content {
includeGroup "eu.pb4"
}
}
// TODO: Limit these to a set of groups.
maven { url "https://maven.terraformersmc.com/" }
maven { url = "https://maven.nucleoid.xyz" }
mavenLocal()
}
configurations {
shade
implementation.extendsFrom shade
}
dependencies {
minecraft "com.mojang:minecraft:${mc_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
modImplementation "com.terraformersmc:modmenu:${modmenu_version}"
modImplementation "io.netty:netty-codec-http:${netty_http_version}"
modCompileOnly "eu.pb4:common-protection-api:1.0.0"
implementation 'com.electronwill.night-config:toml:3.6.3'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
modImplementation 'org.squiddev:Cobalt:0.5.5'
include 'com.electronwill.night-config:core:3.6.3'
include 'com.electronwill.night-config:toml:3.6.3'
include "io.netty:netty-codec-http:${netty_http_version}"
include('org.squiddev:Cobalt:0.5.5')
//modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:6.0.254-alpha"
//modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:6.0.254-alpha"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
//modCompileOnly "maven.modrinth:iris:1.19.x-v1.2.5"
// For running with Iris. Can be ignored most of the time.
// modRuntimeOnly "maven.modrinth:iris:1.19.x-v1.2.5"
// modRuntimeOnly "maven.modrinth:sodium:mc1.19-0.4.2"
// runtimeOnly "org.joml:joml:1.10.2"
// runtimeOnly "org.anarres:jcpp:1.4.14"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0'
testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.0'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
modImplementation include("eu.pb4:sgui:1.2.1+1.19.3")
modImplementation include("eu.pb4:polymer-core:0.4.1+1.19.4")
modImplementation include("eu.pb4:polymer-virtual-entity:0.4.1+1.19.4")
modImplementation include("eu.pb4:polymer-resource-pack:0.4.1+1.19.4")
modImplementation include("xyz.nucleoid:server-translations-api:2.0.0-beta.2+1.19.4-pre2")
modImplementation include("eu.pb4:map-canvas-api:0.2.2+1.19.4")
}
processResources {
inputs.property "version", project.version
def hash = 'none'
Set<String> contributors = []
try {
hash = ["git", "-C", projectDir, "rev-parse", "HEAD"].execute().text.trim()
def blacklist = ['GitHub', 'Daniel Ratcliffe', 'Weblate']
// Extract all authors, commiters and co-authors from the git log.
def authors = ["git", "-C", projectDir, "log", "--format=tformat:%an <%ae>%n%cn <%ce>%n%(trailers:key=Co-authored-by,valueonly)"]
.execute().text.readLines().unique()
// We now pass this through git's mailmap to de-duplicate some authors.
def remapAuthors = ["git", "check-mailmap", "--stdin"].execute()
remapAuthors.withWriter { stdin ->
if (stdin !instanceof BufferedWriter) stdin = new BufferedWriter(stdin)
authors.forEach {
if (it == "") return
if (!it.endsWith(">")) it += ">" // Some commits have broken Co-Authored-By lines!
stdin.writeLine(it)
}
stdin.close()
}
// And finally extract out the actual name.
def emailRegex = ~/^([^<]+) <.+>$/
remapAuthors.text.readLines().forEach {
def matcher = it =~ emailRegex
matcher.find()
def name = matcher.group(1)
if (!blacklist.contains(name)) contributors.add(name)
}
} catch (Exception e) {
e.printStackTrace()
}
inputs.property "commithash", hash
duplicatesStrategy = DuplicatesStrategy.INCLUDE
filesMatching(["fabric.mod.json", "data/computercraft/lua/rom/help/credits.txt"]) {
expand(
'version': mod_version,
'mcversion': mc_version,
'gitcontributors': contributors.sort(false, String.CASE_INSENSITIVE_ORDER).join('\n')
)
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
javadoc {
include "dan200/computercraft/api/**/*.java"
}
jar {
from "LICENSE"
manifest {
attributes([
"Specification-Title" : "computercraft",
"Specification-Version" : "1",
"Implementation-Title" : "CC: Restitched",
"Implementation-Version" : "${mod_version}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
from configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }
}
sourcesJar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
}
}
if (System.getenv("MODRINTH")) {
modrinth {
token = System.getenv("MODRINTH")
projectId = "MfXTuV8J"
versionNumber = "" + version // The version of the mod to upload.
versionType = "release"
uploadFile = remapJar // This links to a task that builds your mod jar and sets "uploadFile" to the mod jar.
gameVersions = [((String) project.minecraft_version)]
changelog = System.getenv("CHANGELOG")
loaders = ["fabric", "quilt"]
}
remapJar {
finalizedBy project.tasks.modrinth
}
}
/*if (System.getenv("CURSEFORGE")) {
curseforge {
apiKey = System.getenv("CURSEFORGE")
project {
id = "462672"
releaseType = "release"
changelog = System.getenv("CHANGELOG")
changelogType = "markdown"
addGameVersion ((String) project.mc_version)
addGameVersion "Fabric"
addGameVersion "Quilt"
mainArtifact(remapJar) {
displayName = "[" + ((String) project.mc_version) + "] " + version
}
afterEvaluate {
uploadTask.dependsOn("remapJar")
}
}
options {
forgeGradleIntegration = false
}
}
remapJar {
finalizedBy project.tasks.curseforge
}
}*/