-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
137 lines (119 loc) · 4.09 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
plugins {
kotlin("jvm") version "1.9.21"
`maven-publish`
signing
}
group = "com.wolt.arrow.detekt"
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
val ktlint: Configuration by configurations.creating
dependencies {
compileOnly("io.gitlab.arturbosch.detekt:detekt-api:1.23.4")
testImplementation(platform("io.arrow-kt:arrow-stack:1.2.1"))
testImplementation("io.arrow-kt:arrow-core")
testImplementation("io.gitlab.arturbosch.detekt:detekt-test:1.23.4")
testImplementation("io.kotest:kotest-assertions-core:5.8.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
ktlint("com.pinterest:ktlint:0.50.0")
}
val mavenPublicationName = "library"
publishing {
publications {
create<MavenPublication>(mavenPublicationName) {
version = project.version.toString()
groupId = project.group.toString()
artifactId = "rules"
from(components["kotlin"])
artifact(tasks.kotlinSourcesJar)
artifact(tasks.named("javadocJar"))
pom {
name.set("Arrow Detekt rules")
description.set("Detekt rules that validate usage of Arrow")
url.set("https://github.com/woltapp/arrow-detekt-rules")
licenses {
license {
name.set("The MIT License")
url.set("https://github.com/woltapp/arrow-detekt-rules/blob/main/LICENSE")
}
}
developers {
developer {
id.set("diastremskii")
name.set("Daniil Iastremskii")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:https://github.com/woltapp/arrow-detekt-rules.git")
developerConnection.set("scm:git:https://github.com/woltapp/arrow-detekt-rules.git")
url.set("https://github.com/woltapp/arrow-detekt-rules")
}
}
}
}
repositories {
maven {
name = "sonatype"
credentials(PasswordCredentials::class)
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
}
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications[mavenPublicationName])
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
systemProperty("junit.jupiter.testinstance.lifecycle.default", "per_class")
systemProperty("compile-snippet-tests", project.hasProperty("compile-test-snippets"))
testLogging {
events("failed", "skipped", "passed")
showExceptions = true
showCauses = true
showStackTraces = true
}
}
val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))
val ktlintCheck by tasks.creating(JavaExec::class) {
group = "ktlint"
inputs.files(inputFiles)
description = "Check Kotlin code style."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("src/**/*.kt")
}
val ktlintFormat by tasks.creating(JavaExec::class) {
group = "ktlint"
inputs.files(inputFiles)
description = "Fix Kotlin code style deviations."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("-F", "src/**/*.kt")
jvmArgs = listOf("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}
val ktlintIdeaSettings by tasks.creating(JavaExec::class) {
group = "ktlint"
inputs.files(inputFiles)
description = "IntelliJ IDEA Project settings."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("applyToIDEAProject", "-y")
}