-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
148 lines (122 loc) · 3.24 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
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
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlin.plugin.serialization)
alias(libs.plugins.versions)
}
val javaTarget = libs.versions.javaTarget.get()
val kotlinTarget = KotlinVersion.fromVersion(libs.versions.kotlinTarget.get())
repositories {
mavenCentral()
mavenLocal()
}
kotlin {
applyDefaultHierarchyTemplate()
jvm {
// withJava()
// mainRun {
// mainClass = "com.xemantic.claudine.ClaudineKt"
// }
compilerOptions {
apiVersion = kotlinTarget
languageVersion = kotlinTarget
jvmTarget = JvmTarget.fromTarget(javaTarget)
freeCompilerArgs.add("-Xjdk-release=$javaTarget")
progressiveMode = true
}
}
// macosArm64 {
// binaries {
// executable {
// entryPoint = "com.xemantic.claudine.main"
// }
// }
// }
// js {
// browser()
// nodejs()
// }
sourceSets {
commonMain {
dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.anthropic.sdk.kotlin)
}
}
val jvmAndPosixMain by creating {
dependsOn(commonMain.get())
dependencies {
implementation(libs.kotlinx.serialization.json) // TODO is it runtimeOnly?
implementation(libs.kotlinx.io)
implementation(libs.kotlin.logging)
}
}
val jvmAndPosixTest by creating {
dependsOn(commonTest.get())
dependencies {
implementation(libs.kotlin.test)
implementation(libs.kotlinx.io)
implementation(libs.kotest.assertions.core)
}
}
jvmMain {
dependsOn(jvmAndPosixMain)
dependencies {
implementation(libs.ktor.client.java)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.logging)
implementation(libs.ktor.serialization.kotlinx.json) // TODO is it runtimeOnly?
implementation(libs.log4j.slf4j2)
implementation(libs.log4j.core)
implementation(libs.jackson.databind)
implementation(libs.jackson.dataformat.yaml)
}
}
jvmTest {
dependsOn(jvmAndPosixTest)
}
nativeMain {
dependsOn(jvmAndPosixMain)
}
nativeTest {
dependsOn(jvmAndPosixTest)
}
linuxMain {
dependencies {
implementation(libs.ktor.client.curl)
}
}
macosMain {
dependencies {
implementation(libs.ktor.client.darwin)
}
}
jsMain {
dependsOn(jvmAndPosixMain)
dependencies {
// implementation("org.jetbrains.kotlinx:kotlinx-nodejs:0.0.7")
}
}
}
}
tasks.withType<JavaExec>().configureEach {
standardInput = System.`in`
}
tasks.withType<Jar> {
doFirst {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
val main by kotlin.jvm().compilations.getting
manifest {
attributes(
"Main-Class" to "com.xemantic.claudine.ClaudineKt",
)
}
from({
main.runtimeDependencyFiles.files.filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
}