-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
87 lines (71 loc) · 2.17 KB
/
build.gradle.kts
File metadata and controls
87 lines (71 loc) · 2.17 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
plugins {
id("java")
id("jacoco") // Code coverage
}
group = "org.example"
version = "1.0-SNAPSHOT"
// Version variables for better dependency management
val slf4jVersion = "2.0.9"
val logbackVersion = "1.4.11"
val guavaVersion = "32.1.2-jre"
val kafkaVersion = "3.5.1"
val rabbitmqVersion = "5.18.0"
val junitVersion = "5.10.0"
val mockitoVersion = "5.6.0"
val awaitilityVersion = "4.2.0"
// Enable build cache for better performance
tasks.withType<JavaCompile> {
options.isFork = true
options.isIncremental = true
}
repositories {
mavenCentral()
}
dependencies {
// Core dependencies
compileOnly("org.slf4j:slf4j-api:$slf4jVersion")
compileOnly("ch.qos.logback:logback-classic:$logbackVersion")
implementation("com.google.guava:guava:$guavaVersion")
// Optional messaging dependencies (marked as compileOnly)
compileOnly("org.apache.kafka:kafka-clients:$kafkaVersion")
compileOnly("com.rabbitmq:amqp-client:$rabbitmqVersion")
// Testing dependencies
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.mockito:mockito-core:$mockitoVersion")
testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion")
testImplementation("org.awaitility:awaitility:$awaitilityVersion")
}
// Configure JaCoCo for code coverage
jacoco {
toolVersion = "0.8.11"
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
html.required.set(true)
}
}
// Configure test task
tasks.test {
useJUnitPlatform()
// Parallel test execution for better performance
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
// Memory settings for test execution
maxHeapSize = "1g"
// Generate test reports
reports {
html.required.set(true)
junitXml.required.set(true)
}
// Link with JaCoCo
finalizedBy(tasks.jacocoTestReport)
}
// Configure Java compilation
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
// Generate sources and javadoc JARs
withSourcesJar()
withJavadocJar()
}