This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
182 lines (159 loc) · 5.12 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
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
// shodow jarによるbuild
classpath "gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0"
}
}
plugins {
id 'org.springframework.boot' version '2.4.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'groovy'
id 'com.github.spotbugs' version '4.6.0'
id 'jacoco'
}
apply plugin: 'com.github.johnrengelman.shadow'
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
group = 'covid.fukui.rss'
version = '1.1.0'
sourceCompatibility = '11'
targetCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
configurations {
invoker
}
dependencies {
implementation(
// webflux
'org.springframework.boot:spring-boot-starter-webflux',
// google cloud function for spring boot
'org.springframework.cloud:spring-cloud-function-adapter-gcp:3.1.2',
// commons-lang3
'org.apache.commons:commons-lang3:3.11',
// collections4
'org.apache.commons:commons-collections4:4.4',
// com.squareup.okhttp3
"com.squareup.okhttp3:okhttp:4.9.0",
// google cloud function for test
'com.google.cloud.functions:functions-framework-api:1.0.1',
// spring-cloud-gcp-starter-logging
'org.springframework.cloud:spring-cloud-gcp-starter-logging:+',
// firestore
'org.springframework.cloud:spring-cloud-gcp-starter-data-firestore:+',
// xml
'javax.xml.bind:jaxb-api:2.3.1'
)
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:2.3.1'
annotationProcessor 'org.projectlombok:lombok'
// google cloud function for test
invoker 'com.google.cloud.functions.invoker:java-function-invoker:1.0.0-alpha-2-rc5'
testImplementation(
// spring boot test framework
'org.springframework.boot:spring-boot-starter-test',
// test library for webflux
'io.projectreactor:reactor-test',
// spock
'org.spockframework:spock-core:1.3-groovy-2.5',
// spock for spring boot
'org.spockframework:spock-spring:1.3-groovy-2.5',
// library for spock
'cglib:cglib-nodep:3.3.0',
// mock for webflux
'com.squareup.okhttp3:mockwebserver:4.9.0'
)
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.1'
}
test {
testLogging {
// テスト時の標準出力と標準エラー出力を表示する
showStandardStreams true
// イベントを出力する (TestLogEvent)
events 'started', 'skipped', 'passed', 'failed'
}
}
// functionのローカル実行
tasks.register("function", JavaExec) {
main = 'com.google.cloud.functions.invoker.runner.Invoker'
classpath(configurations.invoker)
inputs.files(configurations.runtimeClasspath, sourceSets.main.output)
args(
'--target', 'org.springframework.cloud.function.adapter.gcp.GcfJarLauncher',
'--port', project.findProperty('function.port') ?: 8080
)
doFirst {
args(
'--classpath', files(configurations.runtimeClasspath, sourceSets.main.output).asPath
)
}
}
spotbugsMain {
reports {
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
}
excludeFilter = file('./config/spotbugs_filter.xml')
}
spotbugsTest {
reports {
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/spotbugsTest.html")
stylesheet = 'fancy-hist.xsl'
}
}
excludeFilter = file('./config/spotbugs_filter.xml')
}
test.finalizedBy jacocoTestReport
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(
dir: it,
exclude: [
'**/*Application.class',
'**/*Exception.class',
'**/config/**',
'**/*Sandbox*.class',
'**/function/**'
]
)
}))
}
}
import com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer
// fat jarを作成する
// https://github.com/spring-projects/spring-boot/issues/1828
shadowJar {
mergeServiceFiles()
manifest {
attributes 'Main-Class': 'covid.fukui.rss.articlefeeder.ArticleFeederApplication'
}
append 'META-INF/spring.handlers'
append 'META-INF/spring.schemas'
append 'META-INF/spring.tooling'
transform(PropertiesFileTransformer) {
paths = ['META-INF/spring.factories']
mergeStrategy = "append"
}
}