-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
180 lines (154 loc) · 5.42 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
@file:Suppress("SpellCheckingInspection")
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*
val coroutinesVersion = "1.4.1"
val jupiterVersion = "5.6.2"
val logbackVersion = "1.2.3"
val kotlinLoginVersion = "1.8.3"
val slf4jApiVersoion = "1.7.30"
val gsonVersion = "2.8.6"
val httpClientVersion = "5.0.1"
plugins {
kotlin("jvm") version "1.4.20"
id("org.jetbrains.dokka") version "1.4.10"
application
id("com.adarshr.test-logger") version "2.1.0"
`maven-publish`
id("com.jfrog.bintray") version "1.8.4"
}
group = "com.github.barakb"
version = "0.9.3"
repositories {
gradlePluginPortal()
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
testImplementation(kotlin("test-junit5"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.apache.httpcomponents.client5:httpclient5:$httpClientVersion")
implementation("com.google.code.gson:gson:$gsonVersion")
implementation("org.slf4j:slf4j-api:$slf4jApiVersoion")
implementation("io.github.microutils:kotlin-logging:$kotlinLoginVersion")
implementation("com.github.barakb:mini-rest-client:1.0.5")
dokkaJavadocPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.4.10")
testImplementation("org.junit.jupiter:junit-jupiter-api:$jupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion")
testRuntimeOnly("ch.qos.logback:logback-classic:$logbackVersion")
implementation(kotlin("stdlib-jdk8"))
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
@Suppress("SpellCheckingInspection")
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" + "-Xjsr305=strict"
}
}
tasks.test {
useJUnitPlatform()
}
testlogger {
showStandardStreams = true
}
application {
applicationDefaultJvmArgs = listOf("-Dkotlinx.coroutines.debug")
mainClassName = "com.github.barakb.consul.ConsulClientKt"
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "1.8"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "1.8"
}
val artifactName = project.name
val artifactGroup = project.group.toString()
val artifactVersion = project.version.toString()
val pomUrl = "https://github.com/barakb/consul-client"
val pomScmUrl = "https://github.com/barakb/consul-client"
val pomIssueUrl = "https://github.com/barakb/consul-client/issues"
val pomDesc = "A Kotlin Consul client"
val githubRepo = "barakb/consul-client"
val githubReadme = "Readme.md"
val pomLicenseName = "The Apache Software License, Version 2.0"
val pomLicenseUrl = "http://www.apache.org/licenses/LICENSE-2.0.txt"
val pomLicenseDist = "repo"
val pomDeveloperId = "barakb"
val pomDeveloperName = "Barak Bar Orion"
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
val dokkaJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
from(tasks.dokkaJavadoc)
}
publishing {
publications {
create<MavenPublication>("consul-client") {
groupId = artifactGroup
artifactId = artifactName
version = artifactVersion
from(components["java"])
artifact(sourcesJar)
artifact(dokkaJar)
pom.withXml {
asNode().apply {
appendNode("description", pomDesc)
appendNode("name", rootProject.name)
appendNode("url", pomUrl)
appendNode("licenses").appendNode("license").apply {
appendNode("name", pomLicenseName)
appendNode("url", pomLicenseUrl)
appendNode("distribution", pomLicenseDist)
}
appendNode("developers").appendNode("developer").apply {
appendNode("id", pomDeveloperId)
appendNode("name", pomDeveloperName)
}
appendNode("scm").apply {
appendNode("url", pomScmUrl)
}
}
}
}
}
}
bintray {
user = project.findProperty("bintrayUser").toString()
key = project.findProperty("bintrayKey").toString()
publish = true
setPublications("consul-client")
pkg.apply {
repo = "maven"
name = artifactName
userOrg = "barakb"
githubRepo = "barakb/consul-client"
vcsUrl = pomScmUrl
description = "A Kotlin Consul client"
setLabels("Kotlin", "Consul", "REST")
setLicenses("Apache-2.0")
desc = description
websiteUrl = pomUrl
vcsUrl = "https://github.com/barakb/consul-client"
issueTrackerUrl = pomIssueUrl
githubReleaseNotesFile = githubReadme
version.apply {
name = artifactVersion
desc = pomDesc
released = Date().toString()
vcsTag = artifactVersion
gpg.sign = true
// mavenCentralSync.apply {
// sync = false
// user = project.findProperty("sonatypeUser").toString()
// password = project.findProperty("sonatypePassword").toString()
// }
}
}
}