-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbuild.gradle
More file actions
191 lines (165 loc) · 5.71 KB
/
build.gradle
File metadata and controls
191 lines (165 loc) · 5.71 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
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
187
188
189
190
191
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
plugins {
id 'java-library'
// to unleash the lombok magic
id "io.freefair.lombok" version "8.13.1"
// to make our tests output more fancy
id 'com.adarshr.test-logger' version '4.0.0'
// code linting
id "com.diffplug.spotless" version "7.0.3"
// test coverage
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.12.2'
// maven central publishing
id "com.vanniktech.maven.publish" version "0.34.0"
}
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
spotless {
java {
palantirJavaFormat()
}
}
tasks.register('createProperties') {
dependsOn processResources
doLast {
file("${layout.buildDirectory.get()}/resources/main/truelayer-java.version.properties").withWriter { w ->
Properties p = new Properties()
p['name'] = archivesBaseName
p['version'] = project.version != "unspecified" ? project.version : "DEVELOPMENT"
p.store w, null
}
}
}
classes {
dependsOn createProperties
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
test {
useJUnitPlatform{
excludeTags "acceptance" // exclude acceptance tests from the default test task
}
}
testlogger {
theme 'mocha'
}
tasks.register('unit-tests', Test) {
outputs.upToDateWhen { false }
useJUnitPlatform{
excludeTags "integration"
excludeTags "acceptance"
}
}
tasks.register('integration-tests', Test) {
outputs.upToDateWhen { false }
useJUnitPlatform{
includeTags "integration"
}
}
tasks.register('acceptance-tests', Test) {
outputs.upToDateWhen { false }
useJUnitPlatform{
includeTags "acceptance"
}
// toggle this to see raw logs during acceptance tests
testLogging.showStandardStreams = false
}
dependencies {
// Utilities
implementation group: 'org.apache.commons', name: 'commons-configuration2', version: '2.11.0'
// HTTP client
def retrofitVersion = '2.9.0'
implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: retrofitVersion
implementation group: 'com.squareup.retrofit2', name: 'converter-jackson', version: retrofitVersion
// TL signing library
implementation group: 'com.truelayer', name: 'truelayer-signing', version: '0.2.6'
// Serialization
def jacksonVersion = '2.14.1'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
// Logging
def tinyLogVersion = '2.5.0'
implementation group: 'org.tinylog', name: 'tinylog-api', version: tinyLogVersion
implementation group: 'org.tinylog', name: 'tinylog-impl', version: tinyLogVersion
// JUnit test framework.
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.12.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// Mocking libraries
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.17.0'
testImplementation group: 'org.wiremock', name: 'wiremock', version: '3.12.1'
// Wait test utility
testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.3.0'
// Transitive dependencies constraints
constraints {
implementation('com.squareup.okhttp3:okhttp:4.12.0') {
because 'version 3.14.9 used by com.squareup.retrofit2:retrofit:2.9.0 has known vulnerabilities'
}
}
}
jacocoTestReport {
dependsOn "unit-tests"
reports {
xml.required = true
html.required = true
}
getExecutionData().setFrom(fileTree(buildDir).include("/jacoco/unit-tests.exec"))
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'com/truelayer/java/**/entities/**',
'com/truelayer/java/common/Constants.*',
'com/truelayer/java/common/Constants$*.*',
'com/truelayer/java/http/TrueLayerApiAdapterFactory.*',
'com/truelayer/java/http/TrueLayerResponseCallAdapter.*',
'com/truelayer/java/http/TrueLayerResponseCallAdapter$*.*'
])
}))
}
}
tasks.register('sourcesJar', Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
tasks.register('javadocJar', Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
mavenPublishing {
publishToMavenCentral(true)
signAllPublications()
// Use the sources and javadoc jars
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
pom {
name = project_name
packaging = 'jar'
description = project_description
url = project_url
scm {
connection = project_scm
url = project_url
}
licenses {
license {
name = project_license_name
url = project_license_url
distribution = project_license_url
}
}
developers {
developer {
id = developer_name
name = developer_name
url = developer_url
}
}
}
}