-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
105 lines (86 loc) · 3.08 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
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
import java.io.ByteArrayOutputStream
val affComposeVersion: String = "11ab9d8e92"
val kotlinVersion: String by project
val ktorVersion: String by project
val ktomlVersion: String by project
val kamlVersion: String by project
val logbackVersion: String by project
val xmlutilVersion: String by project
plugins {
kotlin("jvm") version "2.0.0-RC1"
kotlin("plugin.serialization") version "1.9.23"
id("io.ktor.plugin") version "2.3.10"
java
application
`maven-publish`
}
group = "io.sn"
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation(kotlin("reflect"))
implementation("io.ktor:ktor-server-core-jvm")
implementation("io.ktor:ktor-server-netty-jvm")
implementation("io.ktor:ktor-server-content-negotiation")
implementation("ch.qos.logback:logback-classic:${logbackVersion}")
implementation("io.ktor:ktor-serialization-kotlinx-json:${ktorVersion}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
implementation("com.akuleshov7:ktoml-core:${ktomlVersion}")
implementation("com.akuleshov7:ktoml-file:${ktomlVersion}")
implementation("com.charleskorn.kaml:kaml:${kamlVersion}")
testImplementation("io.ktor:ktor-server-tests-jvm")
implementation("org.reflections:reflections:0.10.2")
implementation("com.github.freeze-dolphin:aff-compose:${affComposeVersion}")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
fun getGitCommitHash(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD") // 获取短格式的提交哈希
standardOutput = stdout
}
return stdout.toString().trim()
}
application {
mainClass.set("io.sn.aetherium.GenesisKt")
val isDevelopment = true
applicationDefaultJvmArgs =
listOf("-Dio.ktor.development=$isDevelopment")
}
distributions.main {
distributionBaseName = "Aetherium-${getGitCommitHash()}"
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
val createEtoileScriptsTask = tasks.create<CreateStartScripts>("createEtoileScripts") {
mainClass = "io.sn.aetherium.implementations.crystals.EtoileRessurectionKt"
applicationName = "Etoile"
outputDir = file("${layout.projectDirectory.dir("build")}/tmp/scripts")
classpath = files("Aetherium.jar").plus(sourceSets.main.get().runtimeClasspath)
}
tasks.named("distZip") {
dependsOn(createEtoileScriptsTask)
}
tasks.named("distTar") {
dependsOn(createEtoileScriptsTask)
}
application.applicationDistribution.from("${layout.projectDirectory.dir("build")}/tmp/scripts") {
into("bin")
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
version = project.version.toString()
groupId = project.group.toString()
artifactId = "aetherium"
}
}
}