-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
121 lines (100 loc) · 3.76 KB
/
build.gradle.kts
File metadata and controls
121 lines (100 loc) · 3.76 KB
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
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import com.vanniktech.maven.publish.MavenPublishBaseExtension
plugins {
id("java-library")
id("com.vanniktech.maven.publish") version "0.35.0" apply false
}
subprojects {
apply(plugin = "java-library")
apply(plugin = "com.vanniktech.maven.publish")
group = "org.allaymc.stateupdater"
project.version = rootProject.property(project.name + ".version").toString()
val minifyJsonTask by tasks.registering {
dependsOn(tasks.processResources)
doLast {
val resourcesDir = layout.buildDirectory.dir("resources/main").get().asFile
if (!resourcesDir.exists()) {
logger.warn("Resources directory does not exist: ${resourcesDir.absolutePath}")
return@doLast
}
resourcesDir.walkTopDown().filter { it.isFile && it.extension == "json" }.forEach { file ->
try {
val parsed = JsonSlurper().parse(file)
val minified = JsonOutput.toJson(parsed)
file.writeText(minified)
logger.lifecycle("Minified: ${file.name}")
} catch (e: Exception) {
logger.warn("Failed to minify ${file.name}: ${e.message}")
}
}
}
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
}
// We already have sources jar, so no need to build Javadoc, which would cause a lot of warnings
withType<Javadoc> {
enabled = false
}
withType<Test> {
useJUnitPlatform()
}
named("classes") {
dependsOn(minifyJsonTask)
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
withSourcesJar()
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind:2.20.1")
implementation("org.allaymc:nbt:3.0.10")
compileOnly("org.projectlombok:lombok:1.18.42")
annotationProcessor("org.projectlombok:lombok:1.18.42")
testImplementation("org.junit.jupiter:junit-jupiter:6.0.1")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:6.0.1")
testAnnotationProcessor("org.projectlombok:lombok:1.18.42")
}
configure<MavenPublishBaseExtension> {
publishToMavenCentral()
signAllPublications()
coordinates(project.group.toString(), project.name, project.version.toString())
pom {
name.set(project.name)
description.set("Updates Minecraft: Bedrock Edition block & item states to the latest version.")
inceptionYear.set("2024")
url.set("https://github.com/AllayMC/StateUpdater")
scm {
connection.set("scm:git:git://github.com/AllayMC/StateUpdater.git")
developerConnection.set("scm:git:ssh://github.com/AllayMC/StateUpdater.git")
url.set("https://github.com/AllayMC/StateUpdater")
}
licenses {
license {
name.set("LGPL 3.0")
url.set("https://www.gnu.org/licenses/lgpl-3.0.en.html")
}
}
developers {
developer {
name.set("CloudburstMC Team")
organization.set("CloudburstMC")
organizationUrl.set("https://github.com/CloudburstMC")
}
developer {
name.set("AllayMC Team")
organization.set("AllayMC")
organizationUrl.set("https://github.com/AllayMC")
}
}
}
}
}