-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
151 lines (127 loc) · 4.08 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
plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.micronaut.application") version "4.4.4"
id("jacoco")
id("org.sonarqube") version "6.0.1.5171"
id("pl.allegro.tech.build.axion-release") version "1.18.16"
id("checkstyle")
}
version = scmVersion.version
group = "com.michelin.kafkactl"
repositories {
mavenCentral()
}
dependencies {
annotationProcessor("org.projectlombok:lombok")
annotationProcessor("info.picocli:picocli-codegen")
annotationProcessor("io.micronaut.validation:micronaut-validation-processor")
implementation("info.picocli:picocli")
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-jackson-databind")
implementation("io.micronaut.picocli:micronaut-picocli")
implementation("io.micronaut.validation:micronaut-validation")
implementation("jakarta.annotation:jakarta.annotation-api")
implementation("jakarta.validation:jakarta.validation-api")
implementation("org.ocpsoft.prettytime:prettytime:5.0.9.Final")
implementation("io.github.java-diff-utils:java-diff-utils:4.15")
implementation("io.micronaut:micronaut-retry")
implementation("org.yaml:snakeyaml")
compileOnly("org.graalvm.nativeimage:svm")
compileOnly("org.projectlombok:lombok")
runtimeOnly("ch.qos.logback:logback-classic")
testImplementation("io.micronaut:micronaut-http-client")
testImplementation("org.mockito:mockito-junit-jupiter:5.14.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.3")
testImplementation("org.mockito:mockito-core")
testAnnotationProcessor("org.projectlombok:lombok")
testCompileOnly("org.projectlombok:lombok")
}
application {
mainClass.set("com.michelin.kafkactl.Kafkactl")
}
java {
sourceCompatibility = JavaVersion.toVersion('21')
targetCompatibility = JavaVersion.toVersion('21')
}
micronaut {
testRuntime("junit5")
processing {
incremental(true)
annotations("com.michelin.kafkactl.*")
}
}
shadowJar {
archiveClassifier.set('')
dependsOn(distTar, distZip)
}
graalvmNative {
binaries {
main {
imageName.set("kafkactl-" + version)
buildArgs.add("-H:Class=com.michelin.kafkactl.KafkactlCommand")
buildArgs.add("-H:IncludeResourceBundles=org.ocpsoft.prettytime.i18n.Resources")
buildArgs.add("-H:+ReportUnsupportedElementsAtRuntime")
buildArgs.add("-H:+ReportExceptionStackTraces")
buildArgs.add("-H:+TraceNativeToolUsage")
buildArgs.add("-H:Log=*ShimDLL:3,link:3,copy:3")
}
}
}
dockerfile {
baseImage = "eclipse-temurin:21-jre-alpine"
}
dockerfileNative {
baseImage("ubuntu:22.04")
editDockerfile {
after('COPY --link --from=graalvm /home/app/application /app/application') {
insert('RUN ln -s /app/application /usr/bin/kafkactl && chmod 777 /usr/bin/kafkactl')
}
}
}
if (project.hasProperty("releaseLatest")) {
dockerBuild {
images.set(["michelin/kafkactl:" + version, "michelin/kafkactl:latest"])
}
dockerBuildNative {
images.set(["michelin/kafkactl:" + version + "-native", "michelin/kafkactl:latest-native"])
}
} else {
dockerBuild {
images.set(["michelin/kafkactl:" + version])
}
dockerBuildNative {
images.set(["michelin/kafkactl:" + version + "-native"])
}
}
sonarqube {
properties {
property "sonar.projectKey", "michelin_kafkactl"
property "sonar.organization", "michelin"
property "sonar.host.url", "https://sonarcloud.io"
}
}
jacocoTestReport {
dependsOn test
reports {
html.required = true
xml.required = true
}
}
test {
reports {
html.required = false
}
}
checkstyle {
toolVersion = '10.12.3'
configFile = file(".checkstyle/checkstyle.xml")
ignoreFailures = false
maxErrors = 0
maxWarnings = 0
}
import org.apache.tools.ant.filters.ReplaceTokens
processResources {
filesMatching("application.yml") {
filter(ReplaceTokens, tokens: [version: project.version])
}
}