-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.gradle.kts
160 lines (140 loc) · 5.63 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
import kotlinx.benchmark.gradle.JvmBenchmarkTarget
// import com.graphql_java_generator.plugin.conf.CustomScalarDefinition
// import com.graphql_java_generator.plugin.conf.PluginMode
description = "Sample code for GraphQL server with r2dbc"
@Suppress("DSL_SCOPE_VIOLATION") // TODO remove when https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
plugins {
alias(libs.plugins.spring.boot)
alias(libs.plugins.spring.dependencyManagement)
alias(libs.plugins.kotlin.spring)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlin.jpa)
alias(libs.plugins.gradle.flyway)
// TODO: enable when 2.x is released.
// https://github.com/graphql-java-generator/graphql-maven-plugin-project/issues/170
// alias(libs.plugins.gradle.graphql.generator)
alias(libs.plugins.kotlin.benchmark)
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
dependencies {
implementation(projects.libs.core)
implementation(projects.libs.graphql)
// Spring
implementation(libs.bundles.spring.graphql)
// implementation(libs.spring.boot.starter.rsocket) // rsocket-starter is optional
implementation(libs.spring.boot.starter.data.r2dbc)
implementation(libs.spring.boot.starter.oauth2.resource.server)
// TODO: enable when 2.x is released.
// implementation(libs.graphql.java.client.runtime)
// Database Drivers
implementation(enforcedPlatform(libs.database.r2dbc.bom.get().toString()))
runtimeOnly(libs.database.r2dbc.pool)
runtimeOnly(libs.database.r2dbc.h2)
// (or) runtimeOnly(libs.database.r2dbc.postgresql)
// (or) runtimeOnly(libs.database.r2dbc.mssql)
implementation(libs.flyway.core)
// (and) implementation(libs.flyway.sqlserver)
implementation(libs.jakarta.persistence)
implementation(libs.arrow.core)
implementation(libs.uuid)
// DevTools
annotationProcessor(libs.spring.boot.configuration.processor)
annotationProcessor(libs.spring.boot.autoconfigure.processor)
developmentOnly(libs.spring.boot.devtools)
// TODO: add openTelemetry
// micrometer for openTelemetry
// Test
testImplementation(testFixtures(projects.libs.test))
testImplementation(libs.spring.boot.starter.test) {
exclude(module = "mockito-core")
}
testImplementation(libs.spring.boot.reactor.test)
testImplementation(libs.spring.boot.mockk.test)
testImplementation(libs.kotest.assertions.json.jvm)
testImplementation(libs.kotest.extensions.spring)
testImplementation(libs.spring.boot.graphql.test)
testImplementation(libs.spring.boot.security.test)
testImplementation(libs.spring.boot.flyway.test)
implementation(libs.kotlinx.benchmark.test)
}
affectedTestConfiguration { jvmTestTask = "check" }
flyway {
cleanDisabled = false
url = env.DB_FLYWAY_URL.orElse("jdbc:h2:./build/database/testdb;AUTO_SERVER=TRUE")
user = env.DB_USER.orElse("sa")
password = env.DB_PASSWORD.orElse("Passw@rd")
schemas = arrayOf("PUBLIC")
defaultSchema = "PUBLIC"
placeholders = mapOf("type_serial" to "SERIAL")
locations = arrayOf(
"classpath:db/migration/common",
"classpath:/db/migration/${env.DB_FLYWAY_VENDOR.orElse("h2")}",
"classpath:/db/testdata"
)
}
noArg {
invokeInitializers = true
annotation("micro.apps.model.NoArg")
annotation("com.redis.om.spring.annotations.Document")
annotation("org.springframework.data.redis.core.RedisHash")
annotation("org.springframework.data.relational.core.mapping.Table")
}
// TODO: enable when 2.x is released.
// Let's configure the GraphQL Gradle Plugin, for the code generation, for both the client and the server pojo
// (the plugin will automatically add it as a dependency to compileJava and processResources)
// The line below adds the generated sources as a java source folder
// sourceSets.main.java.srcDirs += "$projectDir/build/generated/sources/graphqlGradlePlugin"
// sourceSets.main.resources.srcDirs += "$projectDir/build/generated/resources/graphqlGradlePlugin"
// generatePojoConf {
// isAddRelayConnections = true
// javaTypeForIDType = "java.lang.String"
// mode = PluginMode.server
// packageName = "$group.graphql"
// setSchemaFileFolder("$projectDir/src/main/resources/graphql")
// schemaFilePattern = "**/*.graphqls"
// isSeparateUtilityClasses = true
// setCustomScalars(
// arrayOf(
// CustomScalarDefinition(
// "Duration", "java.time.Duration", "", "com.hedera.mirror.graphql.config.GraphQlDuration.INSTANCE", ""
// ),
// CustomScalarDefinition("Long", "java.lang.Long", "", "graphql.scalars.GraphQLLong", ""),
// CustomScalarDefinition("Object", "java.lang.Object", "", "graphql.scalars.Object", ""),
// CustomScalarDefinition(
// "Timestamp",
// "java.time.Instant",
// "",
// "com.hedera.mirror.graphql.config.GraphQlTimestamp.INSTANCE",
// ""
// ),
// )
// )
// }
/***
* Benchmarks
* gradle :services:spring-graphql-r2dbc:benchmarksBenchmark
*/
allOpen {
annotation("org.openjdk.jmh.annotations.State")
annotation("org.openjdk.jmh.annotations.BenchmarkMode")
}
// Create a separate source set for benchmarks.
sourceSets.create("benchmarks")
kotlin.sourceSets.getByName("benchmarks") {
dependencies {
implementation(libs.kotlinx.benchmark.test)
implementation(sourceSets.main.get().output)
implementation(sourceSets.main.get().runtimeClasspath)
}
}
benchmark {
targets {
register("benchmarks") {
this as JvmBenchmarkTarget
}
}
}