-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathbuild.gradle.kts
148 lines (132 loc) · 4.49 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
import com.jfrog.bintray.gradle.BintrayExtension.MavenCentralSyncConfig
import com.jfrog.bintray.gradle.BintrayExtension.PackageConfig
import com.jfrog.bintray.gradle.BintrayExtension.VersionConfig
import org.gradle.jvm.tasks.Jar
import org.jetbrains.dokka.DokkaConfiguration
import java.net.URL
plugins {
jacoco
`maven-publish`
id("org.jetbrains.kotlin.jvm") version "1.3.21"
id("com.jfrog.bintray") version "1.8.4"
id("org.jetbrains.dokka") version "0.9.17"
}
group = "ru.gildor.coroutines"
version = "1.1.0"
description = "Provides Kotlin Coroutines suspendable await() extensions for Retrofit Call"
repositories {
jcenter()
}
java {
targetCompatibility = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_6
}
dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib")
compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1")
compile("com.squareup.retrofit2:retrofit:2.5.0")
testCompile("junit:junit:4.12")
}
/* Code coverage */
tasks {
jacocoTestReport {
reports.xml.isEnabled = true
}
test {
finalizedBy(jacocoTestReport)
}
dokka {
outputFormat = "javadoc"
outputDirectory = "$buildDir/javadoc"
externalDocumentationLink(delegateClosureOf<DokkaConfiguration.ExternalDocumentationLink.Builder> {
url = URL("https://square.github.io/okhttp/3.x/okhttp/")
})
externalDocumentationLink(delegateClosureOf<DokkaConfiguration.ExternalDocumentationLink.Builder> {
url = URL("https://square.github.io/retrofit/2.x/retrofit/")
})
}
}
/* Publishing */
val githubId = "gildor/kotlin-coroutines-retrofit"
val repoWeb = "https://github.com/$githubId"
val repoVcs = "$repoWeb.git"
val tags = listOf("retrofit", "kotlin", "coroutines")
val licenseId = "Apache-2.0"
val licenseName = "The Apache Software License, Version 2.0"
val licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0.txt"
val releaseTag = "v${project.version}"
val sources = tasks.register<Jar>("sourcesJar") {
dependsOn("classes")
classifier = "sources"
from(sourceSets["main"].allSource)
}
val javadoc = tasks.register<Jar>("javadocJar") {
dependsOn(tasks.dokka)
classifier = "javadoc"
from("$buildDir/javadoc")
}
publishing {
publications {
register<MavenPublication>("MavenJava") {
from(components["java"])
artifact(sources.get())
artifact(javadoc.get())
pom {
name.set(project.name)
description.set(project.description)
url.set(repoWeb)
developers {
developer {
name.set("Andrey Mischenko")
email.set("git@gildor.ru")
organizationUrl.set("https://github.com/gildor")
}
}
issueManagement {
system.set("GitHub Issues")
url.set("$repoWeb/issues")
}
scm {
url.set(repoWeb)
connection.set("scm:git:$repoVcs")
developerConnection.set("scm:git:$repoVcs")
tag.set(releaseTag)
}
licenses {
license {
name.set(licenseName)
url.set(licenseUrl)
}
}
}
}
}
}
bintray {
user = project.properties["bintray.user"]?.toString()
key = project.properties["bintray.key"]?.toString()
setPublications("MavenJava")
publish = true
pkg(delegateClosureOf<PackageConfig> {
repo = project.properties["bintray.repo"]?.toString() ?: "maven"
name = project.name
desc = description
githubRepo = githubId
githubReleaseNotesFile = "CHANGELOG.md"
websiteUrl = repoWeb
issueTrackerUrl = "$repoWeb/issues"
vcsUrl = repoVcs
setLicenses(licenseId)
setLabels(*tags.toTypedArray())
version(delegateClosureOf<VersionConfig> {
name = project.version.toString()
vcsTag = releaseTag
mavenCentralSync(delegateClosureOf<MavenCentralSyncConfig> {
sync = project.properties["sonatype.user"] != null
user = project.properties["sonatype.user"]?.toString()
password = project.properties["sonatype.password"]?.toString()
close = "true"
})
})
})
}