forked from Dominaezzz/matrix-kt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
100 lines (89 loc) · 3.39 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
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.konan.target.HostManager
import java.io.ByteArrayOutputStream
plugins {
kotlin("multiplatform") version "1.5.20" apply false
kotlin("plugin.serialization") version "1.5.20" apply false
id("de.undercouch.download") version "4.0.4" apply false
}
val ktorVersion: String by extra("1.6.1")
val serialVersion: String by extra("1.2.2")
val coroutineVersion: String by extra("1.5.1-native-mt")
val jnaVersion: String by extra("5.8.0")
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "describe", "--tags")
standardOutput = stdout
}
version = stdout.toString().trim()
subprojects {
repositories {
mavenCentral()
}
group = "io.github.matrixkt"
version = rootProject.version
plugins.withId("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
sourceSets.all {
languageSettings.apply {
useExperimentalAnnotation("kotlin.RequiresOptIn")
}
}
}
}
plugins.withId("maven-publish") {
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")
}
}
}
publications.withType<MavenPublication> {
pom {
name.set(project.name)
description.set(project.description)
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)
}
}
}