-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.gradle.kts
102 lines (94 loc) · 3.88 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
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization") version "1.4.31"
kotlin("kapt")
id("java")
}
val vertxVersion = ext.get("vertxVersion")
kotlin {
jvm { }
js {
browser { }
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting {
dependencies {
implementation("io.vertx:vertx-core:$vertxVersion")
implementation("io.vertx:vertx-codegen:$vertxVersion")
implementation("io.vertx:vertx-service-proxy:$vertxVersion")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.1")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.2")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-guava:2.12.2")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1")
implementation("org.jooq:jooq:3.14.8")
}
}
val jvmTest by getting {
dependencies {
implementation("io.vertx:vertx-core:$vertxVersion")
implementation("com.google.guava:guava:30.1-jre")
implementation("junit:junit:4.13.2")
implementation(project(":protocol"))
//todo: shouldn't be 2.10.3
implementation("com.fasterxml.jackson.core:jackson-core:2.10.3")
implementation("com.fasterxml.jackson.core:jackson-databind:2.10.3")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.3")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.2")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-guava:2.12.2")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.10.3")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.31")
}
}
}
}
dependencies {
"kapt"("io.vertx:vertx-codegen:$vertxVersion:processor")
}
tasks {
configure<SourceSetContainer> {
named("main") {
java.srcDir("$buildDir/generated/source/kapt/main")
dependencies {
implementation("io.vertx:vertx-core:$vertxVersion")
implementation("io.vertx:vertx-codegen:$vertxVersion")
implementation("io.vertx:vertx-service-proxy:$vertxVersion")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1")
compileOnly(project(":protocol"))
}
}
}
register("makeExternalJar") {
mustRunAfter("jar")
dependsOn("mergeJars")
doFirst {
file("$buildDir/libs/protocol-jvm.jar").delete()
file("$buildDir/libs/protocol-jvm-final.jar")
.renameTo(file("$buildDir/libs/protocol-jvm.jar"))
}
}
register<Jar>("mergeJars") {
dependsOn("jar")
from(zipTree("$buildDir/libs/protocol.jar"))
from(zipTree("$buildDir/libs/protocol-jvm.jar"))
archiveBaseName.set("protocol-jvm-final")
}
}
tasks.register<Copy>("setupJsonMappers") {
from(file("$projectDir/src/jvmMain/resources/META-INF/vertx/json-mappers.properties"))
into(file("$buildDir/tmp/kapt3/src/main/resources/META-INF/vertx"))
}
tasks.getByName("compileKotlinJvm").dependsOn("setupJsonMappers")
tasks.getByName("build").dependsOn("makeExternalJar")