This repository has been archived by the owner on Sep 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle.kts
118 lines (94 loc) · 3.07 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
plugins {
kotlin("js") version "1.6.10"
id("maven-publish")
signing
}
group = "io.github.mysticfall"
version = "1.3.0-SNAPSHOT"
val isReleasedVersion = !project.version.toString().endsWith("-SNAPSHOT")
repositories {
mavenCentral()
}
fun versionOf(name: String, isWrapper: Boolean = true): String {
val artifact = project.property("version.$name") as String
return if (isWrapper) {
val wrapper = project.property("version.wrappers") as String
"$artifact-$wrapper"
} else {
artifact
}
}
dependencies {
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:${versionOf("react")}")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:${versionOf("react")}")
implementation(npm("react-test-renderer", versionOf("react", isWrapper = false)))
testImplementation(kotlin("test-js"))
}
kotlin {
js(BOTH) {
nodejs {
testTask {
useMocha()
}
}
}
}
publishing {
publications {
create<MavenPublication>("main") {
from(components["kotlin"])
if (tasks.names.contains("jsSourcesJar")) {
artifact(tasks.getByName<Zip>("jsSourcesJar"))
}
if (tasks.names.contains("jsIrSourcesJar")) {
artifact(tasks.getByName<Zip>("jsIrSourcesJar"))
}
pom {
name.set("Kotlin API for React Test Renderer")
description.set(
"Kotlin wrapper for React Test Renderer, which can be used " +
"to unit test React components in a Kotlin/JS project."
)
url.set("https://github.com/mysticfall/kotlin-react-test")
licenses {
license {
name.set("The MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("mysticfall")
name.set("Xavier Cho")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/mysticfall/kotlin-react-test.git")
developerConnection.set("scm:git:[email protected]:mysticfall/kotlin-react-test.git")
url.set("https://github.com/mysticfall/kotlin-react-test")
}
}
}
}
repositories {
maven {
name = "ossrh"
url = uri(
if (isReleasedVersion) {
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
} else {
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
)
credentials(PasswordCredentials::class)
}
}
}
signing {
setRequired({
gradle.taskGraph.hasTask("publish")
})
useGpgCmd()
sign(publishing.publications)
}