-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathbuild.gradle.kts
159 lines (144 loc) · 4.15 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
plugins {
java
kotlin("multiplatform") version "1.7.21"
id("org.jetbrains.dokka").version("1.7.20")
`maven-publish`
signing
jacoco
}
group = "com.jsoizo"
version = "1.10.0"
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.20")
}
}
repositories {
mavenCentral()
}
val dokkaJar = task<Jar>("dokkaJar") {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveClassifier.set("javadoc")
}
kotlin {
jvm {
compilations.forEach {
it.kotlinOptions.jvmTarget = "1.8"
}
//https://docs.gradle.org/current/userguide/publishing_maven.html
mavenPublication {
artifact(dokkaJar)
}
}
js(BOTH) {
browser {
}
nodejs {
}
}
sourceSets {
commonMain {}
commonTest {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
jvm().compilations["main"].defaultSourceSet {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
}
}
jvm().compilations["test"].defaultSourceSet {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
implementation("io.kotest:kotest-runner-junit5:4.6.3")
implementation("io.kotest:kotest-assertions-core:4.6.3")
}
}
js().compilations["main"].defaultSourceSet {
dependencies {
}
}
js().compilations["test"].defaultSourceSet {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
tasks.withType<Test>() {
useJUnitPlatform()
}
publishing {
publications.all {
(this as MavenPublication).pom {
name.set("kotlin-csv")
description.set("Kotlin CSV Reader/Writer")
url.set("https://github.com/jsoizo/kotlin-csv")
organization {
name.set("com.jsoizo")
url.set("https://github.com/jsoizo")
}
licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/jsoizo/kotlin-csv/blob/master/LICENSE")
}
}
scm {
url.set("https://github.com/jsoizo/kotlin-csv")
connection.set("scm:git:git://github.com/jsoizo/kotlin-csv.git")
developerConnection.set("https://github.com/jsoizo/kotlin-csv")
}
developers {
developer {
name.set("jsoizo")
}
}
}
}
repositories {
maven {
credentials {
val nexusUsername: String? by project
val nexusPassword: String? by project
username = nexusUsername
password = nexusPassword
}
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
}
}
}
signing {
sign(publishing.publications)
}
/////////////////////////////////////////
// Jacoco setting //
/////////////////////////////////////////
jacoco {
toolVersion = "0.8.8"
}
tasks.jacocoTestReport {
val coverageSourceDirs = arrayOf(
"commonMain/src",
"jvmMain/src"
)
val classFiles = File("${buildDir}/classes/kotlin/jvm/")
.walkBottomUp()
.toSet()
classDirectories.setFrom(classFiles)
sourceDirectories.setFrom(files(coverageSourceDirs))
additionalSourceDirs.setFrom(files(coverageSourceDirs))
executionData
.setFrom(files("${buildDir}/jacoco/jvmTest.exec"))
reports {
xml.required.set(true)
html.required.set(false)
}
}