-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
57 lines (48 loc) · 1.48 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
base
kotlin("jvm") version "1.9.0" apply false
kotlin("plugin.serialization") version "1.9.0" apply false
id("com.ncorti.ktfmt.gradle") version "0.13.0"
}
ktfmt { kotlinLangStyle() }
subprojects {
group = "io.thoth"
version = "0.0.1"
repositories {
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven("https://jitpack.io")
}
afterEvaluate {
ktfmt {
kotlinLangStyle()
maxWidth.set(120)
removeUnusedImports.set(true)
}
}
plugins.withType<JavaPlugin> {
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
jvmTarget = "17"
apiVersion = "1.8"
languageVersion = "1.8"
}
}
}
tasks.getByName("build").dependsOn("installLocalGitHook")
tasks.register<DefaultTask>("installLocalGitHook") {
val file = File(rootProject.rootDir, ".hooks/pre-commit")
val target = File(rootProject.rootDir, ".git/hooks/pre-commit")
if (!file.exists()) {
throw GradleException("File ${file.absolutePath} does not exist")
}
file.copyTo(target, overwrite = true)
target.setExecutable(true)
}