-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
186 lines (167 loc) · 5.23 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
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
import io.wisetime.version.model.LegebuildConst
/*
* Copyright (c) 2018 Practice Insight Pty Ltd. All Rights Reserved.
*/
buildscript {
repositories {
mavenCentral()
maven {
// WT published releases
setUrl("https://s3.eu-central-1.amazonaws.com/artifacts.wisetime.com/mvn2/plugins")
content {
includeGroup("io.wisetime")
}
}
}
dependencies {
// https://github.com/GoogleContainerTools/jib/issues/1018
classpath("org.apache.httpcomponents:httpclient:4.5.12") {
setForce(true)
}
}
}
plugins {
java
idea
id("application")
id("maven-publish")
id("io.freefair.lombok") version "6.4.1"
id("fr.brouillard.oss.gradle.jgitver") version "0.9.1"
id("com.google.cloud.tools.jib") version "3.2.1"
id("com.github.ben-manes.versions") version "0.39.0"
id("io.wisetime.versionChecker")
}
apply(from = "$rootDir/gradle/conf/checkstyle.gradle")
apply(from = "$rootDir/gradle/conf/jacoco.gradle")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
vendor.set(JvmVendorSpec.ADOPTOPENJDK)
implementation.set(JvmImplementation.J9)
}
consistentResolution {
useCompileClasspathVersions()
}
}
application {
mainClass.set("io.wisetime.connector.jira.ConnectorLauncher")
}
group = "io.wisetime"
jib {
val targetArch = project.properties["targetArch"] ?: ""
if (targetArch == "arm64v8") {
from {
image = "arm64v8/openjdk:11.0.8-jdk-buster"
}
to {
project.afterEvaluate { // <-- so we evaluate version after it has been set
image = "wisetime/wisetime-jira-connector-arm64v8:${project.version}"
}
}
} else {
from {
image = "gcr.io/wise-pub/connect-java-11-j9@sha256:98ec5f00539bdffeb678c3b4a34c07c77e4431395286ecc6a083298089b3d0ec"
}
to {
project.afterEvaluate { // <-- so we evaluate version after it has been set
image = "wisetime/wisetime-jira-connector:${project.version}"
}
}
}
}
repositories {
mavenCentral()
maven {
// WiseTime artifacts
setUrl("https://s3.eu-central-1.amazonaws.com/artifacts.wisetime.com/mvn2/releases")
content {
includeGroup("io.wisetime")
}
}
}
tasks.withType(com.google.cloud.tools.jib.gradle.JibTask::class.java) {
dependsOn(tasks.compileJava)
}
val taskRequestString = gradle.startParameter.taskRequests.toString()
if (taskRequestString.contains("dependencyUpdates")) {
// add exclusions for reporting on updates and vulnerabilities
apply(from = "$rootDir/gradle/versionPluginConfig.gradle")
}
dependencies {
implementation("io.wisetime:wisetime-connector:5.0.23")
implementation("com.google.inject:guice:${LegebuildConst.GUICE_GOOGLE}") {
exclude(group = "com.google.guava", module = "guava")
}
implementation("com.google.guava:guava:${LegebuildConst.GUAVA_VERSION}")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("commons-codec:commons-codec:1.15")
implementation("com.fasterxml.jackson.core:jackson-core:${LegebuildConst.JACKSON_FASTER}")
implementation("com.fasterxml.jackson.core:jackson-databind:${LegebuildConst.JACKSON_FASTER}")
implementation("com.vdurmont:emoji-java:5.1.1")
implementation("org.codejargon:fluentjdbc:1.8.6")
implementation("com.zaxxer:HikariCP:4.0.3")
implementation("mysql:mysql-connector-java:5.1.44")
implementation("org.postgresql:postgresql:42.2.13")
implementation("joda-time:joda-time:${LegebuildConst.JODA_TIME}")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
testImplementation("org.mockito:mockito-core:4.3.1")
testImplementation("org.assertj:assertj-core:3.22.0")
testImplementation("com.github.javafaker:javafaker:1.0.2") {
exclude(group = "org.apache.commons", module = "commons-lang3")
}
testImplementation("org.flywaydb:flyway-core:8.5.4")
testRuntimeOnly("com.h2database:h2:2.1.210")
}
configurations.all {
resolutionStrategy {
eachDependency {
if (requested.group == "com.fasterxml.jackson.core") {
useVersion(LegebuildConst.JACKSON_FASTER)
because("use consistent version for all transitive dependencies")
}
if (requested.name == "commons-lang3") {
useVersion("3.12.0")
because("use consistent version for all transitive dependencies")
}
force("joda-time:joda-time:${LegebuildConst.JODA_TIME}")
}
}
}
tasks.test {
useJUnitPlatform()
testLogging {
// "passed", "skipped", "failed"
events("skipped", "failed")
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
tasks.clean {
delete("${projectDir}/out")
}
jgitver {
autoIncrementPatch(false)
strategy(fr.brouillard.oss.jgitver.Strategies.PATTERN)
versionPattern("\${meta.CURRENT_VERSION_MAJOR}.\${meta.CURRENT_VERSION_MINOR}.\${meta.COMMIT_DISTANCE}")
regexVersionTag("v(\\d+\\.\\d+(\\.0)?)")
}
publishing {
repositories {
maven {
setUrl("s3://artifacts.wisetime.com/mvn2/releases")
authentication {
val awsIm by registering(AwsImAuthentication::class)
}
}
}
publications {
register("mavenJava", MavenPublication::class) {
artifactId = "wisetime-jira-connector"
from(components["java"])
}
}
}
tasks.register<DefaultTask>("printVersionStr") {
doLast {
println("${project.version}")
}
}