-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
80 lines (68 loc) · 1.72 KB
/
build.gradle.kts
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
import com.xpdustry.toxopid.extension.anukeXpdustry
import com.xpdustry.toxopid.spec.ModMetadata
import com.xpdustry.toxopid.spec.ModPlatform
plugins {
alias(libs.plugins.indra.common)
alias(libs.plugins.shadow)
alias(libs.plugins.toxopid)
}
val metadata = ModMetadata.fromJson(rootProject.file("plugin.json"))
group = "com.xpdustry"
version = metadata.version
description = metadata.description
toxopid {
compileVersion = "v${metadata.minGameVersion}"
platforms = setOf(ModPlatform.SERVER)
}
repositories {
mavenCentral()
anukeXpdustry()
}
dependencies {
compileOnly(toxopid.dependencies.arcCore)
compileOnly(toxopid.dependencies.mindustryCore)
}
indra {
javaVersions {
target(17)
minimumToolchain(17)
}
mitLicense()
if (metadata.repository.isNotBlank()) {
val repo = metadata.repository.split("/")
github(repo[0], repo[1]) {
ci(true)
issues(true)
scm(true)
}
}
configurePublications {
pom {
developers {
developer {
id = metadata.author
}
}
}
}
}
val generateMetadataFile by tasks.registering {
inputs.property("metadata", metadata)
val output = temporaryDir.resolve("plugin.json")
outputs.file(output)
doLast {
output.writeText(ModMetadata.toJson(metadata))
}
}
tasks.shadowJar {
archiveFileName = "${metadata.name}.jar"
archiveClassifier = "plugin"
from(generateMetadataFile)
from(rootProject.file("LICENSE.md")) { into("META-INF") }
minimize()
}
tasks.register<Copy>("release") {
dependsOn(tasks.build)
from(tasks.shadowJar)
destinationDir = temporaryDir
}