-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
87 lines (68 loc) · 2.34 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
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
kotlin("jvm") version "1.9.22"
kotlin("plugin.spring") version "1.9.22"
id("org.springframework.boot") version "3.2.1"
id("io.spring.dependency-management") version "1.1.0"
application
}
group = "org.ivcode"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
// Kotlin
implementation(kotlin("stdlib"))
implementation(kotlin("reflect"))
// Spring Boot
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server")
// MyBatis
implementation("org.mybatis:mybatis:3.5.14")
implementation("org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3")
// SpringDoc
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0")
// Liquibase
implementation("org.liquibase:liquibase-core:4.25.1")
// Freemarker
implementation("org.freemarker:freemarker")
// DB Drivers
implementation("com.mysql:mysql-connector-j:8.2.0")
implementation("com.h2database:h2:2.2.224")
testImplementation("org.jetbrains.kotlin:kotlin-test")
}
fun String.runCommand(workingDirectory: File = layout.projectDirectory.asFile, env: List<Pair<String, Any>> = emptyList()): Int {
println("> $this")
return project.exec {
environment(*env.toTypedArray())
workingDir = workingDirectory
commandLine = [email protected]("\\s".toRegex())
}.exitValue
}
tasks.register("docker-build") {
val scripts = File(layout.projectDirectory.asFile, "scripts${File.separator}docker")
doLast {
val os = DefaultNativePlatform.getCurrentOperatingSystem()
if(os.isLinux) {
"./build.sh".runCommand(scripts, listOf(
"PROJECT_NAME" to rootProject.name,
"PROJECT_VERSION" to rootProject.version
))
} else {
throw IllegalStateException("Unsupported Operating System: ${os.name}")
}
}
}
tasks.test {
useJUnitPlatform()
}
kotlin {
explicitApi()
jvmToolchain(21)
}
application {
mainClass.set("org.ivcode.mvn.MainKt")
}