-
Notifications
You must be signed in to change notification settings - Fork 90
/
build.gradle.kts
203 lines (168 loc) · 5.44 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import java.nio.file.Files
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kover)
alias(libs.plugins.ktlint)
alias(libs.plugins.nexus.publish)
`java-test-fixtures`
`maven-publish`
signing
}
allprojects {
apply(plugin = "kotlin")
apply(plugin = "org.jetbrains.kotlinx.kover")
apply(plugin = "org.jmailen.kotlinter")
apply(plugin = "java-test-fixtures")
apply(plugin = "maven-publish")
apply(plugin = "signing")
group = "com.linecorp.kotlin-jdsl"
version = "3.5.3"
repositories {
mavenCentral()
}
dependencies {
implementation(rootProject.libs.kotlin)
testImplementation(rootProject.libs.junit)
testImplementation(rootProject.libs.mockk)
testImplementation(rootProject.libs.assertJ)
testFixturesImplementation(rootProject.libs.junit)
testFixturesImplementation(rootProject.libs.mockk)
testFixturesImplementation(rootProject.libs.assertJ)
}
kotlin {
jvmToolchain(8)
compilerOptions {
apiVersion = KotlinVersion.KOTLIN_1_7
languageVersion = KotlinVersion.KOTLIN_1_7
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xallow-kotlin-package",
)
}
jvmTargetValidationMode.set(JvmTargetValidationMode.ERROR)
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
showExceptions = true
exceptionFormat = FULL
showCauses = true
showStackTraces = true
events = setOf(FAILED)
}
}
java {
withSourcesJar()
withJavadocJar()
}
signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications)
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
pom {
name.set(artifactId)
description.set(
"Kotlin library that makes it easy to build and execute queries without generated metamodel.",
)
url.set("https://github.com/line/kotlin-jdsl")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
name.set("LY Corporation")
email.set("[email protected]")
url.set("https://engineering.linecorp.com/en/")
}
developer {
id.set("shouwn")
name.set("jonghyon.s")
email.set("[email protected]")
}
}
scm {
connection.set("scm:[email protected]:line/kotlin-jdsl.git")
developerConnection.set("scm:git:ssh://github.com:line/kotlin-jdsl.git")
url.set("https://github.com/line/kotlin-jdsl")
}
}
}
}
}
}
subprojects {
rootProject.dependencies {
kover(this@subprojects)
}
dependencies {
implementation(rootProject)
}
kover {
excludeSourceSets {
names(sourceSets.testFixtures.name)
}
}
}
koverReport {
filters {
excludes {
packages("com.linecorp.kotlinjdsl.example.*")
packages("com.linecorp.kotlinjdsl.benchmark.*")
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri("https://oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
val sonatypeUsername: String? by project
val sonatypePassword: String? by project
username = sonatypeUsername
password = sonatypePassword
}
}
}
// Git Hooks
File("$projectDir/.githook").let { projectGitHookDir ->
val os = OperatingSystem.current()
val suffix = when {
os.isMacOsX -> "macos"
os.isWindows -> "windows"
else -> "default"
}
val gitHookDir = File("$projectDir/.git/hooks")
gitHookDir
.listFiles()
?.forEach {
it.deleteRecursively()
}
projectGitHookDir
.listFiles()
?.filter {
it.nameWithoutExtension.contains(suffix)
}?.forEach {
val gitHook = File(gitHookDir, it.nameWithoutExtension.removeSuffix("-$suffix"))
Files.copy(it.toPath(), gitHook.toPath())
gitHook.setExecutable(true)
}
}