-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
172 lines (148 loc) · 4.87 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
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.kotlinter)
alias(libs.plugins.publishOnCentral)
alias(libs.plugins.binaryCompatibilityValidator)
alias(libs.plugins.kover)
alias(libs.plugins.detekt)
}
group = "me.devnatan"
version = "0.7.0-SNAPSHOT"
repositories {
mavenCentral()
}
kotlin {
explicitApi()
jvm {
tasks.named<Test>("jvmTest") {
useJUnitPlatform()
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
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += listOf("-Xjvm-default=all")
}
}
}
linuxX64()
macosX64()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation(libs.ktx.coroutines.core)
implementation(libs.ktx.datetime)
implementation(libs.bundles.ktor)
implementation(libs.bundles.ktx)
implementation(libs.kotlinx.io.core)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(libs.ktx.coroutines.test)
}
}
val jvmMain by getting {
dependsOn(commonMain)
dependencies {
runtimeOnly(libs.junixsocket.native)
implementation(libs.junixsocket.common)
implementation(libs.ktor.client.engine.okhttp)
implementation(libs.slf4j.api)
api(libs.apache.compress)
}
}
val jvmTest by getting {
dependsOn(commonTest)
dependencies {
implementation(kotlin("test-junit5"))
}
}
val nativeMain by creating {
dependsOn(commonMain)
dependencies {
implementation(libs.ktor.client.engine.cio)
}
}
val nativeTest by creating {
dependsOn(commonTest)
}
val linuxX64Main by getting { dependsOn(nativeMain) }
val linuxX64Test by getting { dependsOn(nativeTest) }
val macosX64Main by getting { dependsOn(nativeMain) }
val macosX64Test by getting { dependsOn(nativeTest) }
}
}
val isReleaseVersion = !version.toString().endsWith("SNAPSHOT")
publishOnCentral {
projectDescription.set("Multiplatform Docker API client")
projectLongName.set(project.name)
licenseName.set("MIT")
licenseUrl.set("https://github.com/DevNatan/docker-kotlin/blob/main/LICENSE")
projectUrl.set("https://github.com/DevNatan/docker-kotlin")
scmConnection.set("git:[email protected]:DevNatan/docker-kotlin")
mavenCentral.user.set(System.getenv("OSSRH_USERNAME"))
mavenCentral.password.set(provider { System.getenv("OSSRH_PASSWORD") })
if (!isReleaseVersion)
mavenCentralSnapshotsRepository()
}
signing {
isRequired = isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives")
useInMemoryPgpKeys(
System.getenv("OSSRH_SIGNING_KEY"),
System.getenv("OSSRH_SIGNING_PASSWORD")
)
}
publishing {
publications {
withType<MavenPublication> {
if ("OSSRH" !in name) {
artifact(tasks.javadocJar)
}
pom {
developers {
developer {
name.set("Natan Vieira")
email.set("[email protected]")
url.set("http://www.devnatan.me/")
}
}
}
}
}
}
tasks {
check {
dependsOn("installKotlinterPrePushHook")
}
withType<Detekt>().configureEach {
jvmTarget = "11"
reports {
xml.required.set(true)
}
}
// https://youtrack.jetbrains.com/issue/KT-46466/Kotlin-MPP-publishing-Gradle-7-disables-optimizations-because-of-task-dependencies
val signingTasks = withType<Sign>()
withType<AbstractPublishToMaven>().configureEach {
dependsOn(signingTasks)
}
}
detekt {
buildUponDefaultConfig = true
allRules = false
config.setFrom(files("$projectDir/config/detekt.yml"))
baseline = file("$projectDir/config/baseline.xml")
}