-
-
Notifications
You must be signed in to change notification settings - Fork 366
Expand file tree
/
Copy pathbuild.gradle
More file actions
363 lines (311 loc) · 10.2 KB
/
Copy pathbuild.gradle
File metadata and controls
363 lines (311 loc) · 10.2 KB
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
/*
* Copyright (c) 2020. Tolgee
*/
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'io.spring.dependency-management'
id 'org.springframework.boot'
id 'java'
id 'org.jetbrains.kotlin.jvm'
id "kotlin-jpa"
id "kotlin-allopen"
id "io.sentry.jvm.gradle"
id "org.gradle.test-retry"
}
group = 'io.tolgee'
if (System.getenv().containsKey("VERSION")) {
project.version = System.getenv().get("VERSION")
} else {
project.version = 'local'
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
compileOnly {
extendsFrom annotationProcessor
}
/**
* OpenTelemetry Java Agent configuration.
* The agent is downloaded as a dependency and attached to the JVM via -javaagent flag.
* See: docs/observability/
*/
otelAgent
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "org.jetbrains.kotlin.plugin.jpa"
apply plugin: "kotlin-allopen"
apply plugin: "org.jetbrains.kotlin.plugin.spring"
apply plugin: "org.gradle.test-retry"
repositories {
mavenCentral()
}
dependencyManagement {
applyMavenExclusions = false
}
allOpen {
annotation("jakarta.persistence.Entity")
annotation("jakarta.persistence.MappedSuperclass")
annotation("jakarta.persistence.Embeddable")
annotation("org.springframework.stereotype.Service")
annotation("org.springframework.stereotype.Component")
annotation("org.springframework.stereotype.Service")
annotation("org.springframework.transaction.annotation.Transactional")
annotation("org.springframework.beans.factory.annotation.Configurable")
annotation("org.springframework.boot.test.context.SpringBootTest")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
}
}
dependencies {
/**
* SPRING
*/
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation('org.springframework.boot:spring-boot-starter-mail') {
exclude group: 'org.eclipse.angus', module: 'jakarta.mail'
}
implementation libs.jakartaMail
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation("org.springframework.boot:spring-boot-starter-security")
implementation "org.springframework.boot:spring-boot-starter-validation"
implementation "org.springframework.boot:spring-boot-starter-hateoas"
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation "org.springframework.boot:spring-boot-starter-batch"
implementation "org.springframework.boot:spring-boot-starter-actuator"
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
/**
* TESTING
*/
testImplementation libs.assertJCore
testImplementation("org.springframework.security:spring-security-test")
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation("io.findify:s3mock_2.13:0.2.6")
implementation libs.springmockk
implementation libs.jsonUnitAssert
testImplementation libs.mockito
testImplementation group: 'org.springframework.batch', name: 'spring-batch-test', version: '4.3.5'
testImplementation "org.springframework.boot:spring-boot-starter-websocket"
testImplementation(libs.azureBlob)
testImplementation('io.netty:netty-codec-http:4.2.5.Final')
testImplementation('io.netty:netty-codec-http2:4.2.5.Final')
testImplementation('io.netty:netty-handler:4.2.5.Final')
ktlint(project(":ktlint"))
/**
* MISC
*/
implementation libs.commonsCodec
implementation libs.commonsLang
implementation libs.amazonS3
implementation libs.amazonSTS
implementation libs.icu4j
implementation libs.jacksonKotlin
implementation libs.jacksonModuleKotlin
implementation libs.jacksonDataFormatXml
implementation 'org.apache.httpcomponents.client5:httpclient5:5.4.4'
implementation "org.springframework.boot:spring-boot-properties-migrator"
implementation libs.springDocOpenApiCommon
implementation libs.redissonSpringBootStarter
/**
* OPENTELEMETRY
*/
otelAgent libs.opentelemetryJavaagent
// OTEL API for context propagation in TaskDecorators
implementation libs.opentelemetryApi
implementation libs.opentelemetryContext
/**
* KOTLIN
*/
implementation libs.kotlinReflect
implementation libs.kotlinCoroutines
/**
* Google translation API
*/
implementation platform(libs.googleCloud)
implementation 'com.google.cloud:google-cloud-translate'
/**
* Aws translate
*/
implementation libs.amazonTranslate
/**
* Conditional billing module
*/
if (gradle.ext.billingAppDirectory.exists()) {
implementation(project(':billing-app'))
}
/**
* DATA MODULE
*/
implementation(project(':data'))
/**
* TESTING MODULE
*/
testImplementation(project(':testing'))
/**
* MISC MODULE
*/
implementation(project(':misc'))
/**
* EE MODULE
*/
if (gradle.ext.eeAppDirectoryExists) {
implementation(project(':ee-app'))
}
/**
* Dev module
*/
implementation(project(':development'))
/**
* API module
*/
implementation(project(':api'))
/**
* Security module
*/
implementation(project(':security'))
/**
* MCP SDK
*/
implementation platform(libs.mcpBom)
implementation libs.mcp
implementation libs.mcpSpringWebmvc
}
test {
useJUnitPlatform()
maxHeapSize = "4096m"
testLogging {
events = ["passed", "failed", "skipped"]
}
rootProject.setTestRetry(it)
}
tasks.register('runContextRecreatingTests', Test) {
outputs.upToDateWhen { false }
useJUnitPlatform {
includeTags "contextRecreating"
}
systemProperties['spring.test.context.cache.maxSize'] = 1
maxHeapSize = "4096m"
rootProject.setTestRetry(it)
}
tasks.register('runStandardTests', Test) {
outputs.upToDateWhen { false }
useJUnitPlatform {
excludeTags "contextRecreating", "websocket"
}
maxHeapSize = "4096m"
rootProject.setTestRetry(it)
}
tasks.register('runWebsocketTests', Test) {
outputs.upToDateWhen { false }
useJUnitPlatform {
includeTags "websocket"
}
maxHeapSize = "4096m"
rootProject.setTestRetry(it)
}
tasks.register('runWithoutEeTests', Test) {
outputs.upToDateWhen { false }
useJUnitPlatform {
includeTags "withoutEe"
}
maxHeapSize = "4096m"
rootProject.setTestRetry(it)
}
springBoot {
buildInfo {
properties {
version = project.version
}
}
}
bootJar {
archiveFileName = "tolgee-${project.version}.jar"
manifest {
attributes('Implementation-Version': project.version)
}
}
sourceSets {
main.kotlin.srcDirs = ['src/main/kotlin', 'src/main/java']
test.kotlin.srcDirs = ['src/test/kotlin', 'src/test/java']
}
jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
bootJar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
normalization {
runtimeClasspath {
ignore '**/build-info.properties'
}
}
bootRun {
// OpenTelemetry Java Agent - disabled by default, enable via OTEL_JAVAAGENT_ENABLED=true
// See: docs/observability/
if (System.getenv("OTEL_JAVAAGENT_ENABLED") == "true") {
jvmArgs "-javaagent:${configurations.otelAgent.singleFile.absolutePath}"
}
}
// Copy OTEL agent JAR to a predictable location for manual IntelliJ run configuration.
// Not used by bootRun or bootRunWithObservability (they resolve the agent from Gradle's dependency cache).
// Usage: ./gradlew server-app:copyOtelAgent → build/otel/opentelemetry-javaagent.jar
// Then add -javaagent:backend/app/build/otel/opentelemetry-javaagent.jar to your IntelliJ VM options.
// See: docs/observability/
tasks.register('copyOtelAgent', Copy) {
from configurations.otelAgent
into "${buildDir}/otel"
rename { 'opentelemetry-javaagent.jar' }
}
// Run with local observability stack (docker-compose.local-observability-stack-dev.yaml)
// Drop-in replacement for bootRun: supports --args and all other BootRun options.
// See: docs/observability/
tasks.register('bootRunWithObservability', org.springframework.boot.gradle.tasks.run.BootRun) {
group = 'application'
description = 'Runs Tolgee with OpenTelemetry tracing, using the local Docker observability stack'
// Inherit classpath and main class from bootRun (configured by Spring Boot plugin)
classpath = bootRun.classpath
mainClass.set(bootRun.mainClass)
// OTEL configuration
environment 'OTEL_JAVAAGENT_ENABLED', 'true'
environment 'OTEL_SERVICE_NAME', 'tolgee-platform'
environment 'OTEL_EXPORTER_OTLP_ENDPOINT', 'http://localhost:4318'
environment 'OTEL_RESOURCE_ATTRIBUTES', 'deployment.environment=local-dev'
environment 'OTEL_LOGS_EXPORTER', 'none'
environment 'OTEL_METRICS_EXPORTER', 'none'
environment 'OTEL_INSTRUMENTATION_LOGBACK_MDC_ENABLED', 'true'
environment 'OTEL_SEMCONV_STABILITY_OPT_IN', 'http'
// Database configuration (use Docker stack's PostgreSQL/Redis)
environment 'spring.datasource.url', 'jdbc:postgresql://localhost:5432/tolgee'
environment 'spring.datasource.username', 'tolgee'
environment 'spring.datasource.password', 'tolgee'
environment 'spring.redis.host', 'localhost'
environment 'spring.redis.port', '6379'
environment 'spring.redis.password', 'tolgee'
environment 'tolgee.postgres-autostart.enabled', 'false'
doFirst {
// Resolve agent JAR at execution time (not configuration time)
jvmArgs "-javaagent:${configurations.otelAgent.singleFile.absolutePath}"
}
}
// ===== Apply custom tasks, if exist, from gitignored .local directory =====
def customTasksFile = rootProject.file('.local/gradle/backend-app.gradle')
if (customTasksFile.exists()) {
logger.lifecycle("Applying custom local Gradle script: ${customTasksFile}")
apply from: customTasksFile
}