forked from thesaurus-linguae-aegyptiae/tla-web
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
223 lines (193 loc) · 6.64 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
plugins {
id 'war'
id 'java'
id 'jacoco'
id 'application'
id 'maven-publish'
id 'co.uzzu.dotenv.gradle' version '1.1.0'
id 'de.undercouch.download' version '4.0.4'
id 'org.springframework.boot' version '2.3.0.RELEASE'
id 'com.github.ben-manes.versions' version '0.28.0'
id 'com.github.dawnwords.jacoco.badge' version '0.2.0'
}
group = 'org.bbaw.aaew.tla'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
ext {
fontawesomeVersion = env.FONTAWESOME_VERSION.orElse('5.12.1')
bootstrapVersion = env.BOOTSTRAP_VERSION.orElse('4.4.1')
jqueryVersion = env.JQUERY_VERSION.orElse('3.5.0')
cookieJsVersion = env.COOKIEJS_VERSION.orElse('2.2.1')
fontawesomeSrc = "https://use.fontawesome.com/releases/v${fontawesomeVersion}/fontawesome-free-${fontawesomeVersion}-web.zip"
bootstrapSrc = "https://github.com/twbs/bootstrap/releases/download/v${bootstrapVersion}/bootstrap-${bootstrapVersion}-dist.zip"
jquerySrc = "https://code.jquery.com/jquery-${jqueryVersion}.min.js"
cookieJsSrc = "https://github.com/js-cookie/js-cookie/releases/download/v${cookieJsVersion}/js.cookie-${cookieJsVersion}.min.js"
staticDir = 'src/main/resources/static'
}
def assets = [
'cookieJs' : [cookieJsSrc, 'js.cookie.min.js'],
'jquery': [jquerySrc, 'jquery.min.js'],
'headroomJs': ['https://unpkg.com/headroom.js/dist/headroom.min.js', 'headroom.min.js']
]
publishing {
publications {
maven(MavenPublication) {
artifactId = 'tla-web'
pom {
name = 'TLA Web Frontend'
description = 'HTML frontend for the Thesaurus Linguae Aegyptiae web component'
}
from components.java
}
}
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://www.qenherkhopeshef.org/maven' }
}
configurations {
// don't embed all the servlet containers
implementation.exclude module: 'spring-boot-starter-jetty'
implementation.exclude module: 'spring-boot-starter-netty'
testImplementation.exclude group: 'org.junit.vintage'
testImplementation.exclude module: 'junit-vintage-engine'
}
dependencies {
implementation 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
implementation 'org.modelmapper:modelmapper:2.3.7'
implementation 'org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.3.0.RELEASE'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.4.1'
implementation 'org.slf4j:slf4j-simple:2.0.0-alpha1'
implementation 'com.github.jkatzwinkel:tla-common:master-SNAPSHOT'
implementation 'com.github.rosmord:jsesh:7.3.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.0.RELEASE'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0-M1'
}
application {
mainClassName = 'tla.web.App'
}
test {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
finalizedBy 'generateJacocoBadge'
}
task installAssets {
description = 'Download and install third-party JS/CSS frameworks and libraries'
dependsOn 'installBootstrap'
dependsOn 'installFontAwesome'
dependsOn 'installFontRoboto'
outputs.files(
file("${staticDir}/vendor/")
)
}
def createDownloadAssetTask(String name, String url, String destFile) {
return tasks.create("download${name.capitalize()}", Download) {
doFirst {
mkdir "${staticDir}/vendor"
}
description = "Download && install ${name}"
src "${url}"
dest file("${staticDir}/vendor/${destFile}")
onlyIfModified true
}
}
assets.each{
entry -> installAssets.dependsOn createDownloadAssetTask(
entry.key,
entry.value[0],
entry.value[1]
)
}
task downloadFontAwesome(type: Download) {
description = 'Downloads fontawesome distribution for local hosting'
src fontawesomeSrc
dest new File(buildDir, 'fontawesome.zip')
onlyIfModified true
}
task downloadBootstrap(type: Download) {
description = 'Downloads bootstrap distribution for local hosting'
src bootstrapSrc
dest new File(buildDir, 'bootstrap.zip')
onlyIfModified true
}
task downloadFontRoboto(type: Download) {
group = 'Init'
description = 'Download Google Roboto font'
src 'https://google-webfonts-helper.herokuapp.com/api/fonts/roboto?download=zip&subsets=latin&variants=300,500,700,300italic,regular,italic,700italic'
dest new File(buildDir, 'roboto.zip')
onlyIfModified true
}
task installFontAwesome(dependsOn: downloadFontAwesome, type: Copy) {
group = 'Init'
description = 'Installs fontawesome distribution into assets directory'
from zipTree(downloadFontAwesome.dest)
into file("${staticDir}/vendor")
doLast {
file("${staticDir}/vendor/fontawesome-free-${fontawesomeVersion}-web").renameTo(
file("${staticDir}/vendor/fontawesome")
)
}
}
task installBootstrap(dependsOn: downloadBootstrap, type: Copy) {
group = 'Init'
description = 'Installs bootstrap distribution into assets directory'
from zipTree(downloadBootstrap.dest)
into file("${staticDir}/vendor")
doLast {
file("${staticDir}/vendor/bootstrap-${bootstrapVersion}-dist").renameTo(
file("${staticDir}/vendor/bootstrap")
)
}
}
task installFontRoboto(dependsOn: downloadFontRoboto, type: Copy) {
group = 'Init'
description = 'Installs Google Roboto font'
from zipTree(downloadFontRoboto.dest)
into file("${staticDir}/font")
}
task install {
inputs.files(
file('.env')
)
group = 'Init'
description = 'Installs additional resources required for running the app'
dependsOn 'installAssets'
outputs.files(
file("${staticDir}/vendor/")
)
}
task cleanAssets(type: Delete) {
group = 'Init'
description = 'Delete files added with :installAssets'
delete "${staticDir}/vendor/"
}
clean {
dependsOn 'cleanInstall'
}
bootJar {
dependsOn 'install'
}
bootRun {
systemProperty 'spring.profiles.active', 'dev'
doFirst {
if ( !file("${staticDir}/vendor/").exists() ) {
println ' ======================================'
println ' !!! Must run task :install first: !!!'
println ' !!! !!!'
println ' !!! ./gradlew.bat install !!!'
println ' ======================================'
throw new StopExecutionException()
}
}
}