-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
125 lines (102 loc) · 3.94 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
import com.avast.gradle.dockercompose.ComposeExtension
plugins {
`kotlin-dsl`
id("com.codedifferently.studycrm.java-shared")
id("com.avast.gradle.docker-compose") version "0.17.6"
id("jacoco-report-aggregation")
id("test-report-aggregation")
}
repositories {
mavenCentral()
}
dependencies {
// Load bearing deps needed to aggregate coverage reports.
jacocoAggregation("com.codedifferently.studycrm.auth-service.main:auth-main-app")
jacocoAggregation("com.codedifferently.studycrm.entity-service.main:entity-main-app")
jacocoAggregation("com.codedifferently.studycrm.organization-service.main:organization-main-app")
}
val eventuateCommonImageVersion: String by project
val eventuateCdcImageVersion: String by project
val eventuateMessagingKafkaImageVersion: String by project
configure<ComposeExtension> {
includeDependencies.set(true)
environment.put("EVENTUATE_COMMON_VERSION", eventuateCommonImageVersion)
environment.put("EVENTUATE_CDC_VERSION", eventuateCdcImageVersion)
environment.put("EVENTUATE_MESSAGING_KAFKA_IMAGE_VERSION", eventuateMessagingKafkaImageVersion)
environment.put("EVENTUATE_OUTBOX_TABLES", "8")
val barebonesServices = listOf("api-gateway", "zipkin", "zookeeper", "kafka", "auth-service-mysql", "entity-service-mysql", "organization-service-mysql", "cdc-service")
val infrastructureServices = listOf(*barebonesServices.toTypedArray(), "zipkin", "zookeeper", "kafka", "cdc-service")
val allServices = listOf(*infrastructureServices.toTypedArray(), "auth-service", "entity-service", "organization-service")
createNested("barebones").apply {
setProjectName(null)
useComposeFiles.set(listOf("docker-compose.yaml"))
startedServices.set(barebonesServices)
}
createNested("infrastructure").apply {
setProjectName(null)
useComposeFiles.set(listOf("docker-compose.yaml"))
startedServices.set(infrastructureServices)
}
createNested("services").apply {
setProjectName(null)
environment.putAll(mapOf("TAGS" to "feature-test,local"))
useComposeFiles.set(listOf("docker-compose.yaml"))
startedServices.set(allServices)
}
}
tasks.register("startBarebones") {
dependsOn("barebonesComposeUp")
}
tasks.register("startInfrastructure") {
dependsOn("infrastructureComposeUp")
}
tasks.register("start") {
dependsOn("assemble");
dependsOn("servicesComposeUp")
}
tasks.register("teardown") {
dependsOn("servicesComposeDown")
}
// Exclude these projects from the repo build tasks.
var excludeProjects = listOf("build-logic", "platforms")
// Ensure the fix tasks exists for we can include in next loop.
tasks.register("fix") {}
// Setup repo build tasks
listOf("build", "test", "check", "fix", "clean", "assemble").forEach { taskName ->
tasks.named(taskName) {
dependsOn(
gradle.includedBuilds
.filter { !excludeProjects.contains(it.name) }
.map { it.task(":${taskName}All") }
)
}
}
tasks.test {
configure<JacocoTaskExtension> {
isEnabled = true
includes = listOf("**/lombok/**/*.class", "**/lombok/*.class")
}
}
reporting {
reports {
val testFullCodeCoverageReport by creating(JacocoCoverageReport::class) {
testType = TestSuiteType.PERFORMANCE_TEST
}
}
}
tasks.named<JacocoReport>("testFullCodeCoverageReport") {
description = "Build a full test coverage report including test and integrationTest results"
dependsOn( "testCodeCoverageReport", "integrationTestCodeCoverageReport" )
executionData.setFrom(fileTree( project.rootDir.absolutePath ).include( "**/build/jacoco/*.exec" ))
reports {
xml.required = true
html.required = true
}
}
tasks.register("coverage") {
dependsOn(tasks.named("testFullCodeCoverageReport"))
}
// Ensure that we generate the coverage report for the repo.
tasks.check {
dependsOn(tasks.named("coverage"))
}