-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
168 lines (143 loc) · 4.87 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
plugins {
id 'java'
// Quality
id 'jacoco'
id 'jvm-test-suite'
id 'com.diffplug.spotless' version '6.25.0'
// IDE
id 'idea'
id 'eclipse'
// Publishing
id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}
apply from: 'publish.gradle'
group = 'dev.openfga'
version = '0.7.2'
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}
javadoc {
// Ignore warnings.
options.addStringOption('Xdoclint:none', '-quiet')
}
test {
// JaCoCo coverage report is always generated after tests run.
finalizedBy jacocoTestReport
}
jacocoTestReport {
// tests are required to run before generating a JaCoCo coverage report.
dependsOn test
reports {
xml.required = true
html.required = true
csv.required = true
}
}
ext {
jackson_version = "2.18.2"
junit_version = "5.11.3"
}
dependencies {
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "org.openapitools:jackson-databind-nullable:0.2.6"
implementation platform("io.opentelemetry:opentelemetry-bom:1.44.1")
implementation "io.opentelemetry:opentelemetry-api"
}
testing {
suites {
test {
useJUnitJupiter()
dependencies {
implementation project()
implementation "org.junit.jupiter:junit-jupiter:$junit_version"
implementation "org.mockito:mockito-core:5.14.2"
runtimeOnly "org.junit.platform:junit-platform-launcher"
implementation "org.wiremock:wiremock:3.10.0"
// This test-only dependency is convenient but not widely used.
// Review project activity before updating the version here.
// See also: https://github.com/PGSSoft/HttpClientMock/issues/3
implementation "com.pgs-soft:HttpClientMock:1.0.0"
}
targets {
all {
testTask.configure {
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showStandardStreams = true
}
}
}
}
}
integration(JvmTestSuite) {
testType = TestSuiteType.INTEGRATION_TEST
useJUnitJupiter()
dependencies {
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "org.testcontainers:junit-jupiter:1.20.4"
implementation "org.testcontainers:openfga:1.20.4"
implementation project()
}
sources {
java {
srcDirs = ['src/test-integration/java']
}
}
targets {
all {
testTask.configure {
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showStandardStreams = true
}
}
}
}
}
}
}
// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
// comment out below to run spotless as part of the `check` task
enforceCheck false
format 'misc', {
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
target '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // Takes an integer argument if you don't like 4
endWithNewline()
}
java {
palantirJavaFormat()
removeUnusedImports()
importOrder()
}
}
// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
tasks.register('fmt') {
dependsOn 'spotlessApply'
}
tasks.register('test-integration') {
dependsOn testing.suites.integration
}
tasks.named('check').configure {
dependsOn 'spotlessCheck'
}