forked from smithy-lang/smithy-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
75 lines (65 loc) · 2.04 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
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
buildscript {
repositories {
mavenCentral()
google()
}
val kotlinVersion: String by project
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
plugins { }
allprojects {
repositories {
mavenLocal()
mavenCentral()
google()
}
}
allprojects.forEach {
it.apply(plugin = "jacoco")
it.the<JacocoPluginExtension>().apply {
toolVersion = "0.8.8"
reportsDirectory.set(file("$buildDir/jacoco-reports"))
}
}
val ktlint by configurations.creating {
// https://github.com/pinterest/ktlint/issues/1114#issuecomment-805793163
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}
val ktlintVersion: String by project
dependencies {
ktlint("com.pinterest:ktlint:$ktlintVersion")
ktlint("com.pinterest.ktlint:ktlint-ruleset-standard:$ktlintVersion")
}
val lintPaths = listOf(
"**/*.kt",
// Exclude build output directories
"!**/build/**",
"!**/node_modules/**",
"!**/target/**",
)
tasks.register<JavaExec>("ktlint") {
description = "Check Kotlin code style."
group = "Verification"
classpath = configurations.getByName("ktlint")
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("--log-level=info", "--relative", "--") + lintPaths
// https://github.com/pinterest/ktlint/issues/1195#issuecomment-1009027802
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}
tasks.register<JavaExec>("ktlintFormat") {
description = "Auto fix Kotlin code style violations"
group = "formatting"
classpath = configurations.getByName("ktlint")
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("--log-level=info", "--relative", "--format", "--") + lintPaths
// https://github.com/pinterest/ktlint/issues/1195#issuecomment-1009027802
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}