forked from avro-kotlin/avro4k
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
159 lines (139 loc) · 4.33 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
buildscript {
repositories {
mavenCentral()
mavenLocal()
google()
gradlePluginPortal()
}
}
plugins {
java
id("java-library")
kotlin("jvm") version Libs.kotlinVersion
kotlin("plugin.serialization") version Libs.kotlinVersion
id("maven-publish")
signing
// id("org.jetbrains.dokka") version Libs.dokkaVersion
id("io.kotest") version Libs.kotestGradlePlugin
id("com.github.ben-manes.versions") version Libs.versionsPlugin
}
repositories {
mavenCentral()
google()
}
tasks {
javadoc {
}
}
group = "com.github.avro-kotlin.avro4k"
version = Ci.publishVersion
dependencies {
api(Libs.Avro.avro)
api(Libs.Kotlinx.serializationCore)
implementation(Libs.Kotlinx.serializationJson)
implementation(kotlin("reflect"))
implementation(Libs.Xerial.snappy)
testImplementation(Libs.Kotest.junit5)
testImplementation(Libs.Kotest.assertionsCore)
testImplementation(Libs.Kotest.assertionsJson)
testImplementation(Libs.Kotest.proptest)
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.apiVersion = "1.5"
kotlinOptions.languageVersion = "1.5"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
val signingKey: String? by project
val signingPassword: String? by project
fun Project.publishing(action: PublishingExtension.() -> Unit) =
configure(action)
fun Project.signing(configure: SigningExtension.() -> Unit): Unit =
configure(configure)
//val dokka = tasks.named("dokka")
val javadoc = tasks.named("javadoc")
val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications
signing {
useGpgCmd()
if (signingKey != null && signingPassword != null) {
@Suppress("UnstableApiUsage")
useInMemoryPgpKeys(signingKey, signingPassword)
}
if (Ci.isRelease) {
sign(publications)
}
}
// Create dokka Jar task from dokka task output
//val dokkaJar by tasks.creating(Jar::class) {
// group = JavaBasePlugin.DOCUMENTATION_GROUP
// description = "Assembles Kotlin docs with Dokka"
// archiveClassifier.set("javadoc")
// from(dokka)
//}
tasks.named<Test>("test") {
useJUnitPlatform()
filter {
isFailOnNoMatchingTests = false
}
testLogging {
showExceptions = true
showStandardStreams = true
events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED
)
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
java {
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
publishing {
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
name = "deploy"
url = if (Ci.isRelease) releasesRepoUrl else snapshotsRepoUrl
credentials {
username = System.getenv("OSSRH_USERNAME") ?: ""
password = System.getenv("OSSRH_PASSWORD") ?: ""
}
}
}
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
pom {
name.set("avro4k-core")
description.set("Avro format support for kotlinx.serialization")
url.set("http://www.github.com/avro-kotlin/avro4k")
scm {
connection.set("scm:git:http://www.github.com/avro-kotlin/avro4k")
developerConnection.set("scm:git:http://github.com/avro-kotlin/avro4k")
url.set("http://www.github.com/avro-kotlin/avro4k")
}
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
developers {
developer {
id.set("sksamuel")
name.set("Stephen Samuel")
email.set("sam@sksamuel.com")
}
developer {
id.set("thake")
name.set("Thorsten Hake")
email.set("mail@thorsten-hake.com")
}
}
}
}
}
}