-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
183 lines (142 loc) · 4.95 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
174
175
176
177
178
179
180
181
182
183
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.2'
id 'io.spring.dependency-management' version '1.1.4'
id 'com.diffplug.spotless' version '6.21.0'
id 'se.solrike.sonarlint' version '2.0.0'
id 'org.openapi.generator' version '7.1.0'
}
group = 'com.midas'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '21'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
sonarlintPlugins 'org.sonarsource.java:sonar-java-plugin:7.30.1.34514'
implementation 'io.swagger.core.v3:swagger-annotations:2.2.20'
implementation 'org.openapitools:jackson-databind-nullable:0.2.1'
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
implementation 'io.temporal:temporal-spring-boot-starter-alpha:1.22.3'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'io.gsonfire:gson-fire:1.9.0'
implementation "com.stripe:stripe-java:24.14.0"
}
tasks.named('test') {
useJUnitPlatform()
}
tasks.register('sonarlintListRules', SonarlintListRules) {
description = 'List sonarlint rules'
group = 'verification'
}
sonarlintMain {
source = fileTree("$layout.buildDirectory/src/main")
reports {
html {
enabled = true
outputLocation = layout.buildDirectory.file("/reports/sonarlint")
}
xml.enabled = true
sarif.enabled = false
}
}
sonarlint {
// excludeRules = ['java:S1186']
// includeRules = ['java:S1176', 'java:S1696', 'java:S4266']
ignoreFailures = false
maxIssues = 0 // default 0
// note that rule parameter names are case sensitive
// ruleParameters = [
// 'java:S1176' : [
// 'forClasses':'**.api.**', // need javadoc for public methods in package matching 'api'
// 'exclusion': '**.private.**'] // do not need javadoc for classes under 'private'. Default is **.internal.**
// ]
showIssues = true // default true
}
// Spotless Formatter Configuration
spotless {
format "misc", {
// define the files to apply `misc` to
target "*.gradle", "*.md", ".gitignore"
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces(2) // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Use the default importOrder configuration
importOrder("java|javax", "", "$group", "\\#$group", "\\#")
// Remove unused imports
removeUnusedImports()
// Cleanthat will refactor your code, but it may break your style: apply it before your formatter
cleanthat()
.version("2.17")
// Coding Style
// Read more at https://google.github.io/styleguide/javaguide.html
googleJavaFormat()
// fixes formatting of type annotations
formatAnnotations()
targetExclude("**/generated/**")
}
}
sourceSets {
main {
java {
srcDir("$buildDir/generated/openapi/src/main/java")
}
}
}
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
import se.solrike.sonarlint.SonarlintListRules
tasks.register('_generateInternalOpenApi', GenerateTask) {
outputs.upToDateWhen {
false
}
cleanupOutput = true
generatorName.set("spring")
inputSpec.set("${rootDir}/src/main/resources/openapi/api.yml")
outputDir.set("${buildDir}/generated/openapi")
apiPackage.set("${rootProject.group}.generated.api")
apiNameSuffix.set("Api")
modelPackage.set("${rootProject.group}.generated.model")
modelNameSuffix.set("Dto")
configOptions.set([
library : 'spring-boot',
interfaceOnly : 'true',
useBeanValidation: 'true',
openApiNullable : 'false',
useSpringBoot3 : 'true',
useJakartaEe : 'true',
])
}
tasks.register('generateOpenApiSpecs') {
dependsOn([
tasks._generateInternalOpenApi,
])
}
tasks {
compileJava {
dependsOn spotlessApply
dependsOn tasks.generateOpenApiSpecs
}
}