This repository has been archived by the owner on May 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
169 lines (146 loc) · 5.04 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
buildscript {
ext {
springBootVersion = '2.1.3.RELEASE'
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.openapitools:openapi-generator-gradle-plugin:3.3.4")
classpath("net.ltgt.gradle:gradle-apt-plugin:0.20")
classpath("com.moowork.gradle:gradle-node-plugin:1.2.0")
}
}
plugins {
id 'org.hidetake.ssh' version '2.9.0'
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.openapi.generator'
apply plugin: 'net.ltgt.apt-idea'
apply plugin: 'com.moowork.node'
group = 'at.jugger'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'io.springfox:springfox-swagger2:2.8.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly 'org.springframework.boot:spring-boot-devtools'
compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
// Database
implementation 'org.liquibase:liquibase-core'
testRuntimeOnly 'com.h2database:h2'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
// MapStruct
compileOnly 'org.mapstruct:mapstruct-jdk8:1.3.0.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.3.0.Final'
// Lombok
compileOnly 'org.projectlombok:lombok:1.18.6'
annotationProcessor 'org.projectlombok:lombok:1.18.6'
compile 'com.github.spullara.mustache.java:compiler:0.9.6'
}
remotes {
derletztedodo {
host = 'derletztedodo.at'
user = 'jugger'
identity = file("${System.properties['user.home']}/.ssh/jugger2019")
}
}
test {
testLogging {
exceptionFormat = 'full'
}
}
ext {
parcelOutputDir = "${buildDir}/generated/frontend/vue"
serverOutputDir = "$buildDir/generated/openApi/spring"
tsOutputDir = "$buildDir/generated/openApi/ts"
}
task cleanSpringServerApi(type: Delete) {
delete serverOutputDir
}
task buildSpringServerApi(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask, dependsOn: cleanSpringServerApi) {
generatorName = "spring"
validateSpec = true
inputSpec = "$rootDir/src/main/openapi/tracker.yaml".toString()
ignoreFileOverride = "$rootDir/src/main/openapi/.openapi-generator-ignore".toString()
outputDir = serverOutputDir.toString()
configOptions = [
apiPackage : "at.jugger.tracker.api",
invokerPackage : "at.jugger.tracker.invoker",
modelPackage : "at.jugger.tracker.dto",
dateLibrary : "java8-localdatetime",
configPackage : "at.jugger.tracker.config",
delegatePattern : true,
useBeanValidation: true,
useTags : true
]
}
task cleanTsClientApi(type: Delete) {
delete tsOutputDir
}
task buildTsClientApi(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask, dependsOn: cleanTsClientApi) {
generatorName = "typescript-fetch"
validateSpec = true
inputSpec = "$rootDir/src/main/openapi/tracker.yaml".toString()
ignoreFileOverride = "$rootDir/src/main/openapi/.openapi-generator-ignore".toString()
outputDir = tsOutputDir.toString()
}
sourceSets {
main {
java {
srcDirs "${serverOutputDir}/src/main/java"
}
resources {
srcDirs "${serverOutputDir}/src/main/resources"
srcDirs "${parcelOutputDir}"
}
}
}
node {
download = true
version = '10.15.1'
yarnVersion = '1.13.0'
}
task yarnBuild(type: YarnTask, dependsOn: ['yarn'], group: 'node') {
args = ['build']
inputs.file("${projectDir}/package.json")
inputs.dir("${projectDir}/src/main/frontend")
inputs.dir("${tsOutputDir}")
outputs.dir(parcelOutputDir)
}
compileJava.dependsOn buildSpringServerApi
yarnBuild.dependsOn buildTsClientApi
processResources.dependsOn yarnBuild
bootJar {
launchScript()
}
task deploy {
doLast {
ssh.run {
session(remotes.derletztedodo) {
execute 'rm -f deploy/tracker-0.0.1-SNAPSHOT.jar'
execute 'rm -f deploy/turniere.jar'
put from: 'build/libs/tracker-0.0.1-SNAPSHOT.jar', into: 'deploy'
execute 'mv deploy/tracker-0.0.1-SNAPSHOT.jar deploy/turniere.jar'
execute 'chmod 500 deploy/turniere.jar'
execute 'sudo systemctl restart turniere.service'
}
}
}
}
deploy.dependsOn build