-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
224 lines (203 loc) · 8.78 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import java.util.*
val micronautCoreVersion by properties
val micronautParentVersion by properties
plugins {
kotlin("multiplatform") version "2.0.0"
kotlin("kapt") version "2.0.0"
kotlin("plugin.allopen") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.diffplug.spotless") version "6.25.0"
id("idea")
}
group = "com.github.ikovalyov"
version = "0.0.1"
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
}
maven {
url = uri("https://kotlin.bintray.com/kotlinx")
}
}
kotlin {
/* Targets configuration omitted.
* To find out how to configure the targets, please follow the link:
* https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets */
jvm {
withJava()
compilations.all {
tasks.named<Test>("${target.name}Test") {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
// showStandardStreams = true
}
}
}
}
js(IR) {
browser {
commonWebpackConfig {
cssSupport {
enabled.set(true)
}
}
}
binaries.executable()
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("io.github.microutils:kotlin-logging:3.0.5")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
implementation("com.benasher44:uuid:0.8.4")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
implementation(
project.dependencies.enforcedPlatform(
"org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:1.0.0-pre.785",
),
)
implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-tanstack-react-table")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
implementation(npm("react", "18.2.0"))
implementation(npm("react-dom", "18.2.0"))
implementation(npm("react-is", "18.2.0"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.8.1")
implementation(project.dependencies.platform("io.micronaut:micronaut-core-bom:$micronautCoreVersion"))
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-http-server-netty")
implementation("io.micronaut:micronaut-inject-java")
runtimeOnly("org.yaml:snakeyaml")
implementation(project.dependencies.platform("io.micronaut.platform:micronaut-parent:$micronautParentVersion"))
implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
implementation("io.micronaut.aws:micronaut-aws-sdk-v2")
implementation("io.micronaut.aws:micronaut-aws-ua")
implementation("io.micronaut.views:micronaut-views-freemarker")
implementation("io.micronaut.picocli:micronaut-picocli")
implementation("io.micronaut.security:micronaut-security-oauth2")
implementation("io.micronaut.security:micronaut-security-jwt")
implementation("software.amazon.awssdk:dynamodb") {
exclude(group = "software.amazon.awssdk", module = "apache-client")
exclude(group = "software.amazon.awssdk", module = "url-connection-client")
}
implementation("software.amazon.awssdk:netty-nio-client")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.freemarker:freemarker:2.3.33")
implementation("org.apache.logging.log4j:log4j-core:2.23.1")
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.23.1")
implementation("org.freemarker:freemarker:2.3.33")
configurations["kapt"].dependencies.addAll(
listOf(
project.dependencies.create("io.micronaut:micronaut-inject-java:$micronautCoreVersion"),
project.dependencies.create("info.picocli:picocli-codegen:4.7.6"),
),
)
if (System.getProperty("os.name").lowercase(Locale.getDefault()).contains("mac")) {
implementation("io.micronaut:micronaut-runtime-osx")
implementation("net.java.dev.jna:jna")
implementation("io.methvin:directory-watcher")
}
}
}
val jvmTest by getting {
dependencies {
configurations["kaptTest"].dependencies.addAll(
listOf(
project.dependencies.create("io.micronaut:micronaut-inject-java:$micronautCoreVersion"),
project.dependencies.create("info.picocli:picocli-codegen:4.7.6"),
),
)
implementation(kotlin("test-junit5"))
implementation("io.micronaut.test:micronaut-test-junit5")
runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.0")
implementation("org.testcontainers:junit-jupiter")
implementation("org.testcontainers:localstack")
implementation("com.amazonaws:aws-java-sdk-core:1.12.767") // testcontainers need it
}
}
}
}
tasks {
val shadowCreate by creating(ShadowJar::class) {
manifest {
attributes["Main-Class"] = "com.github.ikovalyov.MyApp"
}
archiveClassifier.set("all")
from(kotlin.jvm().compilations.getByName("main").output)
configurations = mutableListOf(kotlin.jvm().compilations.getByName("main").compileDependencyFiles)
}
val build by existing {
dependsOn(shadowCreate)
}
val jvmProcessResources by existing(Copy::class) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE // allow duplicates
}
val jvmRun by creating(JavaExec::class) {
group = "Execution"
description = "Run the main class with JavaExecTask"
classpath = sourceSets.findByName("main")!!.runtimeClasspath
mainClass.set("com.github.ikovalyov.MyApp")
jvmArgs("-XX:TieredStopAtLevel=1", "-Dcom.sun.management.jmxremote")
}
val execDynamoDbScript by creating(JavaExec::class) {
group = "Execution"
description = "Run the main class with JavaExecTask"
classpath = sourceSets.findByName("main")!!.runtimeClasspath
mainClass.set("com.github.ikovalyov.command.DynamoDbInitCommand")
jvmArgs("-XX:TieredStopAtLevel=1", "-Dcom.sun.management.jmxremote")
}
}
kapt {
arguments {
arg("project", "${project.group}/${project.name}")
}
}
spotless {
kotlin {
val files = project.fileTree(rootDir)
files.include("**/*.kt")
target(files)
ktlint("1.3.0")
.editorConfigOverride(
mapOf(
"max_line_length" to "256",
"insert_final_newline" to "true",
),
)
}
}