-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
75 lines (66 loc) · 2.36 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
75 lines (66 loc) · 2.36 KB
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
plugins {
kotlin("jvm") version "1.9.25"
kotlin("plugin.spring") version "1.9.25" apply false
kotlin("plugin.jpa") version "1.9.25" apply false
kotlin("plugin.allopen") version "1.9.25" apply false
kotlin("plugin.noarg") version "1.9.25" apply false
kotlin("kapt") version "1.9.25" apply false
id("org.springframework.boot") version "3.3.1" apply false
id("io.spring.dependency-management") version "1.1.7" apply false
id("com.diffplug.spotless") version "6.19.0" apply false
}
allprojects {
group = "cv"
version = "0.0.1-SNAPSHOT"
repositories {
maven("https://plugins.gradle.org/m2/")
maven("https://jitpack.io")
mavenCentral()
}
project.tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "org.jetbrains.kotlin.plugin.jpa")
apply(plugin = "org.jetbrains.kotlin.plugin.allopen")
apply(plugin = "org.jetbrains.kotlin.plugin.noarg")
apply(plugin = "org.jetbrains.kotlin.kapt")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "com.diffplug.spotless")
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint()
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}
tasks.register<Copy>("updateGitHooks") {
from(File(rootProject.rootDir, ".script/pre-commit"))
into(File(rootProject.rootDir, ".git/hooks"))
doLast {
val osName = System.getProperty("os.name").lowercase()
val command = if (osName.contains("windows")) {
arrayOf("cmd", "/c", "chmod -R +x .git/hooks/")
} else {
arrayOf("chmod", "-R", "+x", ".git/hooks/")
}
Runtime.getRuntime().exec(command)
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
dependsOn("spotlessApply")
dependsOn("updateGitHooks")
}
}