-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
154 lines (126 loc) · 4.86 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id 'org.springframework.boot' version '2.5.6'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'com.github.node-gradle.node' version '3.1.1'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.game'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
node {
// Version of node to use.
version = '16.13.0'
npmVersion = '8.1.0'
// Version of Yarn to use
// Any Yarn task first installs Yarn in the yarnWorkDir
// It uses the specified version if defined and the latest version otherwise (by default)
yarnVersion = ''
// Base URL for fetching node distributions (change if you have a mirror).
distBaseUrl = 'https://nodejs.org/dist'
// If true, it will download node using above parameters.
// If false, it will try to use globally installed node.
download = true
// Set the work directory for unpacking node
workDir = file("${project.buildDir}/src/main/frontend/nodejs")
// Set the work directory for NPM
npmWorkDir = file("${project.buildDir}/src/main/frontend/npm")
// Set the work directory where node_modules should be located
nodeModulesDir = file("${project.projectDir}/src/main/frontend")
// The directory where yarn is installed (when a Yarn task is used)
yarnWorkDir = file("${project.projectDir}/.gradle/yarn")
// The Node.js project directory location
// This is where the package.json file and node_modules directory are located
// By default it is at the root of the current project
nodeProjectDir = file("${project.projectDir}/src/main/frontend")
// Whether the plugin automatically should add the proxy configuration to npm and yarn commands
// according the proxy configuration defined for Gradle
// Disable this option if you want to configure the proxy for npm or yarn on your own
// (in the .npmrc file for instance)
nodeProxySettings = ProxySettings.SMART
}
task yarnBuild(type: YarnTask) {
execOverrides {
it.workingDir = 'src/main/frontend'
}
args = ['build']
}
task executeYarn(type: GradleBuild) {
tasks = ['yarnInstallDependencies', 'yarnBuild', 'copyFrontendToBuild']
}
task copyFrontendToBuild(type: Copy) {
from "$projectDir/src/main/frontend/build/"
into "$buildDir/resources/main/static"
}
task npmInstallDependencies(type: NpmTask) {
dependsOn 'nodeSetup'
dependsOn 'npmSetup'
execOverrides {
it.ignoreExitValue = true
it.workingDir = 'src/main/frontend'
}
args = ['install']
}
task yarnInstallDependencies(type: YarnTask) {
execOverrides {
// it.ignoreExitValue = true
it.workingDir = 'src/main/frontend'
}
args = ['install']
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.projectlombok:lombok:1.18.20'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
testImplementation 'org.apache.httpcomponents:httpclient'
}
test {
useJUnitPlatform()
}
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}