-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.gradle.kts
132 lines (107 loc) · 4.06 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.4.20"
jacoco
id("org.jetbrains.dokka") version "0.9.16"
`maven-publish`
signing
}
allprojects {
apply(plugin = "jacoco")
group = "io.github.rybalkinsd"
version = "0.12.0"
repositories {
mavenCentral()
}
}
val notToPublish = listOf("kohttp-test")
subprojects {
apply(plugin = "kotlin")
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
val sourceSets = the<SourceSetContainer>()
if (project.name !in notToPublish) {
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "maven-publish")
apply(plugin = "signing")
val sourcesJar = task<Jar>("sourcesJar") {
from(sourceSets["main"].allSource)
archiveClassifier.set("sources")
}
val dokkaJar = task<Jar>("dokkaJar") {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveClassifier.set("javadoc")
}
publishing {
publications {
create<MavenPublication>(project.name) {
from(components["java"])
artifacts {
artifact(sourcesJar)
artifact(dokkaJar)
}
pom {
name.set("Kotlin DSL http client")
description.set("Kotlin DSL http client")
url.set("https://github.com/rybalkinsd/kohttp")
organization {
name.set("io.github.rybalkinsd")
url.set("https://github.com/rybalkinsd")
}
licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/rybalkinsd/kohttp/blob/master/LICENSE")
}
}
scm {
url.set("https://github.com/rybalkinsd/kohttp")
connection.set("scm:git:git://github.com/rybalkinsd/kohttp.git")
developerConnection.set("scm:git:ssh://[email protected]:rybalkinsd/kohttp.git")
}
developers {
developer {
name.set("Sergey")
}
}
}
}
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[project.name])
}
}
}
tasks.withType<JacocoReport> {
val containers = subprojects.map { it.the<SourceSetContainer>()["main"] }
val output = containers.flatMap { it.output }
val sources = containers.flatMap { it.allSource.srcDirs }
val exec = subprojects.flatMap { it.tasks }
.filterIsInstance<Test>()
.flatMap { files(it) }
.filter { it.exists() && it.name.endsWith(".exec") }
additionalSourceDirs.setFrom(sources)
sourceDirectories.setFrom(sources)
classDirectories.setFrom(output)
executionData.setFrom(exec)
reports {
xml.isEnabled = true
xml.destination = File("$buildDir/reports/jacoco/report.xml")
html.isEnabled = false
}
}