-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
140 lines (123 loc) · 4.35 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
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
plugins {
kotlin("jvm") version "2.1.0" apply false
kotlin("multiplatform") version "2.1.0"
kotlin("plugin.serialization") version "2.1.0"
id("com.google.devtools.ksp") version "2.1.0-1.0.29" apply false
id("org.jetbrains.dokka") version "2.0.0"
signing
`maven-publish`
}
group = "io.github.devngho"
version = "1.1.4"
repositories {
mavenCentral()
}
val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)
val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
dependsOn(dokkaHtml)
archiveClassifier.set("javadoc")
from(dokkaHtml.outputDirectory)
}
fun PublishingExtension.kirok() {
signing {
sign(publishing.publications)
}
repositories {
mavenLocal()
val id: String =
if (project.hasProperty("repoUsername")) project.property("repoUsername") as String
else System.getenv("repoUsername")
val pw: String =
if (project.hasProperty("repoPassword")) project.property("repoPassword") as String
else System.getenv("repoPassword")
if (!version.toString().endsWith("SNAPSHOT")) {
maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
name = "sonatypeReleaseRepository"
credentials {
username = id
password = pw
}
}
}
}
fun MavenPublication.kirok() {
pom {
name.set(artifactId)
description.set("Frontend Logic Library for Kotlin/Wasm")
url.set("https://github.com/devngho/kirok")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/devngho/kirok/blob/master/LICENSE")
}
}
developers {
developer {
id.set("devngho")
name.set("devngho")
email.set("yjh135908@gmail.com")
}
}
scm {
connection.set("https://github.com/devngho/kirok.git")
developerConnection.set("https://github.com/devngho/kirok.git")
url.set("https://github.com/devngho/kirok")
}
}
}
publications.withType(MavenPublication::class) {
groupId = project.group as String?
artifactId = "kirok"
version = project.version as String?
artifact(tasks["javadocJar"])
kirok()
}
}
kotlin {
publishing {
kirok()
}
jvm()
wasmJs {
browser { binaries.executable() }
}
sourceSets {
commonMain {
dependencies {
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
}
}
applyDefaultHierarchyTemplate()
}
}
tasks {
val taskList = this.toList().map { it.name }
getByName("signKotlinMultiplatformPublication") {
if (taskList.contains("publishJvmPublicationToSonatypeReleaseRepositoryRepository"))
dependsOn(
"publishJvmPublicationToSonatypeReleaseRepositoryRepository",
"publishJvmPublicationToMavenLocalRepository",
"publishJvmPublicationToMavenLocal"
)
else dependsOn("publishJvmPublicationToMavenLocalRepository", "publishJvmPublicationToMavenLocal")
}
getByName("signWasmJsPublication") {
if (taskList.contains("publishJvmPublicationToSonatypeReleaseRepositoryRepository"))
dependsOn(
"publishJvmPublicationToSonatypeReleaseRepositoryRepository",
"publishKotlinMultiplatformPublicationToSonatypeReleaseRepositoryRepository",
"publishJvmPublicationToMavenLocal",
"publishJvmPublicationToMavenLocalRepository",
"publishKotlinMultiplatformPublicationToMavenLocal",
"publishKotlinMultiplatformPublicationToMavenLocalRepository"
)
else
dependsOn(
"publishJvmPublicationToMavenLocal",
"publishKotlinMultiplatformPublicationToMavenLocal",
"publishKotlinMultiplatformPublicationToMavenLocalRepository"
)
}
}