-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
79 lines (63 loc) · 1.84 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.8.21"
application
}
group = "pt.isel.pc"
version = "1.0-SNAPSHOT"
application {
mainClass.set("pt.isel.pc.problemsets.set3.base.MainKt")
}
repositories {
mavenCentral()
}
val ktlint: Configuration by configurations.creating
dependencies {
// Logging
implementation("org.slf4j:slf4j-api:1.7.36")
implementation("org.slf4j:slf4j-simple:2.0.0-alpha7")
// Kotlin coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
// Test framework
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
// Ktlint
ktlint("com.pinterest:ktlint:0.48.2") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
val ktlintFormat by tasks.register("ktlintFormat", JavaExec::class) {
group = "formatting"
description = "Fix Kotlin code style deviations."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
args("-F", "src/**/*.kt", "**.kts", "!**/build/**")
}
val outputDir = "${project.buildDir}/reports/ktlint/"
val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))
val ktlintCheck by tasks.creating(JavaExec::class) {
inputs.files(inputFiles)
outputs.dir(outputDir)
description = "Check Kotlin code style."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("src/**/*.kt")
}
tasks.named("check") {
dependsOn("ktlintCheck")
}
tasks.named("build") {
dependsOn("installDist")
}
tasks.named("test") {
dependsOn("installDist")
}