This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle.kts
131 lines (115 loc) · 4.36 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
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.konan.target.HostManager
import java.io.ByteArrayOutputStream
plugins {
kotlin("multiplatform") version "1.7.20" apply false
kotlin("plugin.serialization") version "1.7.20" apply false
id("de.undercouch.download") version "5.1.0" apply false
}
val ktorVersion: String by extra("2.1.2")
val serialVersion: String by extra("1.4.0")
val coroutineVersion: String by extra("1.6.4")
val jnaVersion: String by extra("5.9.0")
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "describe", "--tags")
standardOutput = stdout
}
group = "io.github.dominaezzz.matrixkt"
version = stdout.toString().trim()
repositories {
mavenCentral()
}
subprojects {
repositories {
mavenCentral()
}
group = rootProject.group
version = rootProject.version
plugins.withId("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
sourceSets.all {
languageSettings.apply {
optIn("kotlin.RequiresOptIn")
}
}
}
}
plugins.withId("maven-publish") {
// Stub javadoc until I look into Dokka
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
configure<PublishingExtension> {
val vcs: String by project
repositories {
// maven("https://maven.pkg.github.com/Dominaezzz/${rootProject.name}") {
// name = "GitHubPackages"
// credentials {
// username = System.getenv("GITHUB_USER")
// password = System.getenv("GITHUB_TOKEN")
// }
// }
maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
name = "sonatype"
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
publications.withType<MavenPublication> {
artifact(javadocJar.get())
pom {
name.set(project.name)
description.set("Kotlin Multiplatform Library for Matrix")
url.set(vcs)
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("Dominaezzz")
name.set("Dominic Fischer")
}
}
scm {
connection.set("$vcs.git")
developerConnection.set("$vcs.git")
url.set(vcs)
}
}
}
}
val publishTasks = tasks.withType<PublishToMavenRepository>()
.matching {
when {
HostManager.hostIsMingw -> it.name.startsWith("publishMingw")
HostManager.hostIsMac -> it.name.startsWith("publishMacos") || it.name.startsWith("publishIos")
HostManager.hostIsLinux -> it.name.startsWith("publishLinux") ||
it.name.startsWith("publishJs") ||
it.name.startsWith("publishJvm") ||
it.name.startsWith("publishMetadata") ||
it.name.startsWith("publishKotlinMultiplatform")
else -> error("Unknown host")
}
}
tasks.register("smartPublish") {
dependsOn(publishTasks)
}
}
plugins.withId("signing") {
configure<SigningExtension> {
useInMemoryPgpKeys(
System.getenv("SIGNING_KEY_ID"),
System.getenv("SIGNING_KEY"),
System.getenv("SIGNING_PASSWORD")
)
sign(extensions.findByType<PublishingExtension>()!!.publications)
}
}
}