forked from josephsavona/rsocket-demo
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle.kts
133 lines (114 loc) · 3.98 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "2.5.3"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("com.google.cloud.tools.jib") version "3.1.2"
kotlin("jvm") version "1.5.21"
kotlin("plugin.spring") version "1.5.21"
id("com.squareup.wire") version "4.0.0-alpha.3"
}
group = "io.rsocket.demo"
version = "0.0.1-SNAPSHOT"
repositories {
mavenCentral()
maven(url = "https://jitpack.io") {
group = "com.github.yschimke"
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
extra["springCloudGcpVersion"] = "2.0.3"
extra["springCloudVersion"] = "2020.0.3"
extra["testcontainersVersion"] = "1.15.3"
dependencies {
implementation("org.springframework.boot:spring-boot-starter-rsocket")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.google.cloud:spring-cloud-gcp-starter-secretmanager")
implementation("com.google.cloud:spring-cloud-gcp-starter")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("com.github.yschimke:okurl:2.29") {
exclude(group = "com.squareup.okhttp3")
exclude(group = "ch.qos.logback")
exclude(group = "com.babylon.certificatetransparency", module = "certificatetransparency")
exclude(group = "org.slf4j", module = "slf4j-jdk14")
}
implementation("com.squareup.moshi:moshi:1.12.0")
implementation("com.squareup.moshi:moshi-adapters:1.12.0")
implementation("com.squareup.moshi:moshi-kotlin:1.12.0")
implementation("com.squareup.wire:wire-runtime:4.0.0-alpha.3")
implementation("com.squareup.wire:wire-moshi-adapter:4.0.0-alpha.3")
implementation("com.squareup.wire:wire-grpc-client:4.0.0-alpha.3") {
exclude(group= "com.squareup.okhttp3")
}
implementation("com.squareup.wire:wire-moshi-adapter:4.0.0-alpha.3")
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.2")
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2")
implementation("com.squareup.okhttp3:okhttp-brotli:5.0.0-alpha.2")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.testcontainers:postgresql")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
dependencyManagement {
imports {
mavenBom("com.google.cloud:spring-cloud-gcp-dependencies:${property("springCloudGcpVersion")}")
mavenBom("org.testcontainers:testcontainers-bom:${property("testcontainersVersion")}")
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
}
}
wire {
kotlin {
out = "src/main/kotlin"
javaInterop = true
}
}
jib {
from.image = "gcr.io/distroless/java:11"
to {
image = "gcr.io/rsocket-demo-1/app"
credHelper = "gcr"
auth {
username = "oauth2accesstoken"
password = gcloudAuthToken()
}
}
container {
ports = listOf("8080")
mainClass = "io.rsocket.demo.RsocketDemoApplicationKt"
// good defauls intended for Java 8 (>= 8u191) containers
jvmFlags = listOf(
"-server",
"-Djava.awt.headless=true",
"-XX:+UseG1GC",
"-XX:MaxGCPauseMillis=100",
)
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
fun gcloudAuthToken() = try {
ProcessBuilder("gcloud auth print-access-token".split(' '))
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.start()
.inputStream.bufferedReader().readText().trim()
} catch (e: Exception) {
e.printStackTrace()
null
}