-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
185 lines (155 loc) · 5.94 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
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
java
kotlin("jvm") version "1.4.30"
`maven-publish`
signing
id("org.jetbrains.dokka") version "0.9.17" apply false
}
val groupId = "com.netki"
val artifactId = "transactid-core"
val versionRelease = "2.0.0-beta1"
val protoVersion = "3.10.0"
val ktorVersion = "1.3.2"
val jacksonVersion = "2.11.3"
val bouncyCastleVersion = "1.67"
val kotlinReflectVersion = "1.4.30"
val junitVersion = "5.3.1"
val mockitoVersion = "3.4.6"
group = groupId
version = versionRelease
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinReflectVersion")
implementation("com.google.protobuf:protobuf-java:$protoVersion")
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
implementation("io.ktor:ktor-client-gson:$ktorVersion")
implementation("io.ktor:ktor-client-logging-jvm:$ktorVersion")
implementation("com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion")
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
implementation("org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion")
implementation("org.bouncycastle:bcpkix-jdk15on:$bouncyCastleVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.mockito:mockito-core:$mockitoVersion")
testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
testImplementation("io.ktor:ktor-client-mock-jvm:$ktorVersion")
testImplementation("io.ktor:ktor-client-mock-js:$ktorVersion")
testImplementation("io.ktor:ktor-client-mock-native:$ktorVersion")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.named<KotlinCompile>("compileKotlin") {
kotlinOptions.jvmTarget = "1.8"
}
tasks.named<KotlinCompile>("compileTestKotlin") {
kotlinOptions.jvmTarget = "1.8"
}
val dokka = tasks.withType<DokkaTask> {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
}
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
val javadocJar by tasks.registering(Jar::class) {
dependsOn(dokka)
archiveClassifier.set("javadoc")
from(buildDir.resolve("javadoc"))
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = groupId
artifactId = artifactId
version = versionRelease
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
pom {
description.set("Core components for TransactId")
name.set("Transactid-Core Java Library")
url.set("https://github.com/netkicorp/transactid-core")
withXml {
asNode().appendNode("packaging", "jar")
}
organization {
name.set("com.netki")
url.set("https://netki.com")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/netkicorp/transactid-core/issues")
}
licenses {
license {
name.set("BSD 3-Clause")
url.set("https://github.com/netkicorp/transactid-core/blob/master/LICENSE")
distribution.set("repo")
}
}
developers {
developer {
name.set("Netki Development")
}
}
scm {
url.set("https://github.com/netkicorp/transactid-core")
connection.set("scm:git:git://github.com/netkicorp/transactid-core.git")
developerConnection.set("scm:git:ssh://[email protected]:/netkicorp/transactid-core.git")
}
}
}
}
repositories {
maven {
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.property("sonatypeUsername") as String
password = project.property("sonatypePassword") as String
}
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
tasks {
test {
useJUnitPlatform()
testLogging {
events("skipped", "passed", "failed")
showStandardStreams = false
showExceptions = false
addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) {}
override fun beforeTest(testDescriptor: TestDescriptor) {}
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {}
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
if (suite.parent != null) {
val output =
"Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
val startItem = "| "
val endItem = " |"
val repeatLength = startItem.length + output.length + endItem.length
println("\n${"-".repeat(repeatLength)}\n$startItem$output$endItem\n${"-".repeat(repeatLength)}")
}
}
})
}
}
}