-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
150 lines (123 loc) · 3.78 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
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
plugins {
kotlin("multiplatform") version "1.7.10"
id("maven-publish")
id("signing")
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
plugins.withType<NodeJsRootPlugin> {
configure<NodeJsRootExtension> {
nodeVersion = "16.13.1"
}
}
repositories {
mavenCentral()
}
kotlin {
explicitApi()
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
browser {
testTask {
useKarma {
useChrome()
useFirefox()
}
}
}
nodejs {
testTask {
useMocha {
// Disable test case timeout, bringing parity with other platforms.
timeout = "0"
}
}
}
}
ios()
watchos()
tvos()
macosX64()
macosArm64()
linuxX64()
linuxArm64()
mingwX64()
sourceSets {
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jsTest by getting {
dependencies {
implementation(npm("karma-detect-browsers", "^2.0"))
}
}
}
}
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
publishing {
// Configure all publications.
publications.withType<MavenPublication> {
// Publish docs with each artifact.
artifact(javadocJar)
// Provide information requited by Maven Central.
pom {
name.set(rootProject.name)
description.set(findProperty("pomDescription") as String)
url.set(findProperty("pomUrl") as String)
licenses {
license {
name.set(findProperty("pomLicenseName") as String)
url.set(findProperty("pomLicenseUrl") as String)
}
}
scm {
url.set(findProperty("pomScmUrl") as String)
connection.set(findProperty("pomScmConnection") as String)
developerConnection.set(findProperty("pomScmDeveloperConnection") as String)
}
developers {
developer {
id.set(findProperty("pomDeveloperId") as String)
name.set(findProperty("pomDeveloperName") as String)
}
}
}
}
}
signing {
val signFileContents = File("${rootProject.projectDir}/secret/sign").readLines()
val signingKeyId = signFileContents.getOrNull(0)
val signingPassword = signFileContents.getOrNull(1)
val signingKeyBase64 = signFileContents.getOrNull(2)
if (signingKeyId != null && signingPassword != null) {
useInMemoryPgpKeys(signingKeyId, signingKeyBase64, signingPassword)
}
sign(publishing.publications)
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
val ossrhContents = File("${rootProject.projectDir}/secret/ossrh").readLines()
val ossrhUsername = ossrhContents.getOrNull(0)
val ossrhPassword = ossrhContents.getOrNull(1)
val ossrhStagingProfileId = ossrhContents.getOrNull(2)
username.set(ossrhUsername)
password.set(ossrhPassword)
stagingProfileId.set(ossrhStagingProfileId)
}
}
}