-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathbuild.gradle.kts
145 lines (126 loc) · 4.63 KB
/
build.gradle.kts
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
import com.github.gradle.node.npm.task.NpmTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
val kotlinVersion = "1.9.20"
id("org.springframework.boot") version "3.1.5"
id("io.spring.dependency-management") version "1.1.3"
id("com.github.node-gradle.node") version "3.1.1"
id("org.jmailen.kotlinter") version "3.7.0"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
}
version = "2024.0.0-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_21
repositories {
mavenCentral()
}
node {
version.set("18.12.0")
download.set(true)
}
dependencies {
val commonmarkVersion = "0.11.0"
val gmailApiVersion = "1.24.2"
val googleApiVersion = "v1-rev101-1.24.1"
val googleOwaspVersion = "20211018.1"
implementation("org.springframework.boot:spring-boot-starter-webflux") {
exclude(module = "hibernate-validator")
}
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("io.projectreactor.addons:reactor-extra")
implementation("org.springframework:spring-context-indexer")
implementation("org.springframework.boot:spring-boot-starter-mail")
implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.samskivert:jmustache")
implementation("com.atlassian.commonmark:commonmark:$commonmarkVersion")
implementation("com.atlassian.commonmark:commonmark-ext-autolink:$commonmarkVersion")
implementation("com.github.ben-manes.caffeine:caffeine")
implementation("com.google.api-client:google-api-client:$gmailApiVersion")
implementation("com.google.apis:google-api-services-gmail:$googleApiVersion")
implementation("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:$googleOwaspVersion")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("com.ninja-squad:springmockk:3.1.1")
testImplementation("io.mockk:mockk:1.13.2")
testImplementation("io.projectreactor:reactor-test")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "21"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
/**
* All images are copied in jar resources. Image optimization was made before with a Gulp plugin. Now we use a bot
* on Github
*/
tasks.register<Copy>("copyImages") {
from("src/main/images")
include("**/*.svg", "**/*.png", "**/*.jpg")
into(layout.buildDirectory.dir("resources/main/static/images"))
}
/**
* Sass file are compiled by node libs, and autoprefixed, and minified
*/
tasks.register<NpmTask>("compileSass") {
dependsOn(tasks.npmInstall)
npmCommand.set(listOf("run", "scss"))
args.set(listOf("--", "--out-dir", "${layout.buildDirectory}/npm-output"))
inputs.dir("src/main/sass")
outputs.dir("${layout.buildDirectory}/resources/main/static/css")
}
tasks.register<Copy>("copyJsVendors") {
dependsOn(tasks.npmInstall)
from("node_modules/bootstrap/dist/js/bootstrap.bundle.js","node_modules/qrcode-svg/dist/qrcode.min.js")
into(layout.buildDirectory.dir("resources/main/static/js"))
}
/**
* Javascript files are genrated from Typescript
*/
tasks.register<NpmTask>("compileTypescript") {
dependsOn(tasks.npmInstall)
npmCommand.set(listOf("run", "typescript"))
//args.set(listOf("--", "--out-dir", "${layout.buildDirectory}/npm-output"))
inputs.dir("src/main/ts")
outputs.dir("${layout.buildDirectory}/resources/main/static/js")
}
/**
* In dev mode tou can launch this task to
* > automatically update css on sass file update,
* > automatically update template on template change,
* > automatically update messages on i18n property update,
*/
tasks.register<NpmTask>("watch") {
dependsOn(tasks.npmInstall)
npmCommand.set(listOf("run", "watch"))
args.set(listOf("--", "--out-dir", "${layout.buildDirectory}/npm-output"))
}
tasks.getByName("processResources").dependsOn(
"copyImages",
"copyJsVendors",
"compileSass",
"compileTypescript"
)
tasks.named("assemble") {
dependsOn(
"copyImages",
"copyJsVendors",
"compileSass",
"compileTypescript"
)
}
tasks.named("bootRun") {
dependsOn(
"assemble"
)
}
kotlinter {
disabledRules = arrayOf("import-ordering")
}