-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
173 lines (149 loc) · 5.49 KB
/
build.gradle
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
plugins {
id 'jacoco'
id 'java'
id 'jvm-test-suite'
// git branch/commit info into actuator/info endpoint (via build/resources/main/git.properties)
id "com.gorylenko.gradle-git-properties" version "2.4.2"
id 'io.spring.dependency-management' version '1.1.6'
id 'org.springframework.boot' version '3.3.3'
// Doesn't play friendly with StreamBridge!
//id 'org.graalvm.buildtools.native' version '0.9.28'
}
group = 'com.insilicosoft.portal.svc'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '21'
}
repositories {
mavenCentral()
}
gitProperties {
// Limit git info https://github.com/n0mer/gradle-git-properties
// docker exec -it <container id> cat /workspace/BOOT-INF/classes/git.properties
keys = [ 'git.branch', 'git.build.version', 'git.commit.id.abbrev', 'git.commit.message.short',
'git.commit.time', 'git.commit.user.name', 'git.remote.origin.url' ]
}
ext {
set('springCloudVersion', "2023.0.0")
set('tcKeycloakVersion', "2.3.0")
set('tcPostgresVersion', "1.17.3")
}
configurations {
runtimeOnly {
// Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts
exclude group: 'commons-logging', module: 'commons-logging'
}
}
dependencies {
implementation 'io.micrometer:micrometer-registry-prometheus:1.13.3'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-web'
// Note: Introduces commons-logging conflict with spring-boot-starter-web!
implementation 'org.springframework.cloud:spring-cloud-stream-binder-rabbit'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
mavenBom "org.testcontainers:testcontainers-bom:${tcPostgresVersion}"
}
}
jacoco {
toolVersion = "0.8.12"
}
testing {
suites {
configureEach {
useJUnitJupiter()
dependencies {
implementation project()
implementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
}
}
test_i(JvmTestSuite) {
sources {
java {
srcDirs = ['src/test-i/java']
}
resources {
srcDirs = ['src/test-i/resources']
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-testcontainers'
implementation 'org.springframework.security:spring-security-test'
implementation 'org.testcontainers:junit-jupiter'
implementation "org.testcontainers:postgresql:${tcPostgresVersion}"
}
}
test_e2e(JvmTestSuite) {
sources {
java {
srcDirs = ['src/test-e2e/java']
}
resources {
srcDirs = ['src/test-e2e/resources']
}
}
dependencies {
implementation "com.github.dasniko:testcontainers-keycloak:${tcKeycloakVersion}"
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // JdbcTemplate, @Transactional
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.security:spring-security-test'
implementation 'org.testcontainers:junit-jupiter'
implementation "org.testcontainers:postgresql:${tcPostgresVersion}"
}
targets.configureEach {
testTask.configure {
environment("SPRING_PROFILES_ACTIVE", "e2e")
// For extra debugging, use below with logging.level.root=TRACE in application-e2e.yml
// testLogging.showStandardStreams = true
}
}
}
}
}
// https://github.com/gradle/gradle/issues/19217#
// https://github.com/rkrisztian/search/blob/ec93a56c6d01f5398fcb626a0fbefc8c18bbc267/build.gradle
tasks.named('jacocoTestReport').configure {
enabled = false
}
tasks.register('codeCoverageReport', JacocoReport) {
sourceSets sourceSets.main
tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).forEach { testTask ->
executionData testTask
dependsOn testTask
}
reports {
html.required = true
}
}
tasks.named('check').configure {
dependsOn(test)
dependsOn(testing.suites.test_i)
dependsOn(testing.suites.test_e2e)
dependsOn('codeCoverageReport')
}
// On deploy error of ....
// The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, FMA].
// Please rebuild the executable with an appropriate setting of the -march option.
tasks.named('bootBuildImage') {
environment = [
'BP_NATIVE_IMAGE_BUILD_ARGUMENTS' : '-march=compatibility'
]
}
tasks.named('test') {
useJUnitPlatform()
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}