2024-08-01 17:45:28 +08:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
|
|
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
|
|
|
|
|
2024-07-30 21:30:12 +08:00
|
|
|
val projectName = rootProject.name
|
2024-08-26 21:05:35 +08:00
|
|
|
val groupName: String by extra
|
|
|
|
val projectArtifactId: String by extra
|
|
|
|
val projectVersion: String by extra
|
2024-07-30 21:30:12 +08:00
|
|
|
|
2024-07-30 19:20:43 +08:00
|
|
|
plugins {
|
2024-09-08 14:10:44 +08:00
|
|
|
id("java-library")
|
2024-08-01 17:45:28 +08:00
|
|
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
2024-07-30 19:20:43 +08:00
|
|
|
}
|
2024-08-26 21:05:35 +08:00
|
|
|
allprojects {
|
2024-09-08 14:10:44 +08:00
|
|
|
apply(plugin = "java-library")
|
2024-08-26 21:05:35 +08:00
|
|
|
val groupName by extra("cn.wzpmc")
|
|
|
|
val projectArtifactId by extra("my-bot")
|
2024-10-10 10:47:24 +08:00
|
|
|
val projectVersion by extra("1.0.5")
|
2024-08-26 21:05:35 +08:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven("https://libraries.minecraft.net")
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
// https://mvnrepository.com/artifact/org.projectlombok/lombok
|
|
|
|
compileOnly("org.projectlombok:lombok:1.18.34")
|
|
|
|
annotationProcessor("org.projectlombok:lombok:1.18.34")
|
|
|
|
// https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2
|
2024-09-08 14:10:44 +08:00
|
|
|
api("com.alibaba.fastjson2:fastjson2:2.0.52")
|
|
|
|
api("com.mojang:brigadier:1.0.18")
|
2024-08-26 21:05:35 +08:00
|
|
|
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api
|
2024-09-08 14:10:44 +08:00
|
|
|
api("org.apache.logging.log4j:log4j-api:2.23.1")
|
2024-08-26 21:05:35 +08:00
|
|
|
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
2024-10-10 08:53:42 +08:00
|
|
|
// https://mvnrepository.com/artifact/org.yaml/snakeyaml
|
2024-10-10 09:29:10 +08:00
|
|
|
api("org.yaml:snakeyaml:2.2")
|
2024-08-26 21:05:35 +08:00
|
|
|
}
|
|
|
|
tasks.compileJava {
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
}
|
|
|
|
tasks.javadoc {
|
|
|
|
options.encoding = "UTF-8"
|
|
|
|
}
|
|
|
|
}
|
2024-07-30 21:30:12 +08:00
|
|
|
group = groupName
|
|
|
|
version = projectVersion
|
2024-07-30 19:20:43 +08:00
|
|
|
|
|
|
|
dependencies {
|
2024-08-26 21:05:35 +08:00
|
|
|
implementation(project(":mybot-api"))
|
2024-08-01 17:45:28 +08:00
|
|
|
implementation("net.minecrell:terminalconsoleappender:1.3.0") {
|
|
|
|
exclude(group = "org.apache.logging.log4j", module = "log4j-core")
|
|
|
|
exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
|
|
|
}
|
2024-07-30 21:30:12 +08:00
|
|
|
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
|
|
|
|
implementation("org.apache.logging.log4j:log4j-core:2.23.1")
|
2024-08-01 17:45:28 +08:00
|
|
|
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-jul
|
|
|
|
implementation("org.apache.logging.log4j:log4j-jul:2.23.1")
|
2024-09-08 14:10:44 +08:00
|
|
|
// https://mvnrepository.com/artifact/io.netty/netty-all
|
|
|
|
implementation("io.netty:netty-all:4.1.112.Final")
|
2024-07-31 03:51:04 +08:00
|
|
|
// https://mvnrepository.com/artifact/org.jline/jline
|
2024-08-01 17:45:28 +08:00
|
|
|
implementation("org.jline:jline-terminal:3.26.3")
|
|
|
|
implementation("org.jline:jline-reader:3.26.3")
|
|
|
|
/*implementation("org.jline:jline-terminal-jni:3.26.3")
|
|
|
|
implementation("org.jline:jline-terminal-ffm:3.26.3")*/
|
|
|
|
// https://mvnrepository.com/artifact/org.jline/jline-terminal-jansi
|
|
|
|
implementation("org.jline:jline-terminal-jansi:3.26.3")
|
|
|
|
// https://mvnrepository.com/artifact/org.fusesource.jansi/jansi
|
|
|
|
implementation("org.fusesource.jansi:jansi:2.4.1")
|
2024-07-30 21:30:12 +08:00
|
|
|
}
|
|
|
|
tasks.register<Jar>("javadocJar") {
|
|
|
|
archiveClassifier.set("javadoc")
|
|
|
|
from(tasks.named("javadoc"))
|
|
|
|
}
|
|
|
|
tasks.register<Jar>("sourcesJar") {
|
|
|
|
archiveClassifier.set("sources")
|
|
|
|
from(sourceSets.main.get().allSource)
|
|
|
|
}
|
2024-08-01 17:45:28 +08:00
|
|
|
tasks.withType<ShadowJar> {
|
|
|
|
manifest {
|
|
|
|
attributes(
|
|
|
|
"Main-Class" to "cn.wzpmc.Main"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
archiveBaseName.set("MyBot")
|
|
|
|
archiveVersion.set(projectVersion)
|
|
|
|
archiveClassifier.set("")
|
|
|
|
transform(Log4j2PluginsCacheFileTransformer::class.java)
|
|
|
|
}
|
|
|
|
tasks.named("build") {
|
|
|
|
dependsOn(tasks.named("shadowJar"))
|
|
|
|
}
|
2024-07-30 19:20:43 +08:00
|
|
|
tasks.test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|