-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
executable file
·196 lines (180 loc) · 5.71 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
plugins {
kotlin("multiplatform")
id("maven-publish")
id("com.github.ben-manes.versions").version("0.42.0")
signing
}
val kotlinCoroutinesVersion: String by project
group = "dev.limebeck"
version = "0.2.5"
repositories {
mavenCentral()
}
kotlin {
metadata {
mavenPublication {
artifactId = "ko-te"
pom {
name.set("Ko-Te template library metadata")
description.set("Kotlin metadata module for Ko-Te template library")
}
}
}
jvm {
mavenPublication {
artifactId = "ko-te-jvm"
pom {
name.set("Ko-Te template library JVM")
description.set("Kotlin JVM module for Ko-Te template library")
}
}
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
mavenPublication {
artifactId = "ko-te-js"
pom {
name.set("Ko-Te template library JS")
description.set("Kotlin JS module for Ko-Te template library")
}
}
binaries.executable()
nodejs {
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native") {
mavenPublication {
artifactId = "ko-te-native-macos"
pom {
name.set("Ko-Te template library native-macos")
description.set("Kotlin native-macos module for Ko-Te template library")
}
}
}
hostOs == "Linux" -> linuxX64("native") {
mavenPublication {
artifactId = "ko-te-native-linux"
pom {
name.set("Ko-Te template library native-linux")
description.set("Kotlin native-linux module for Ko-Te template library")
}
}
}
isMingwX64 -> mingwX64("native") {
mavenPublication {
artifactId = "ko-te-native-win"
pom {
name.set("Ko-Te template library native-win")
description.set("Kotlin native-win module for Ko-Te template library")
}
}
}
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets {
val commonMain by getting {
dependencies {
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${kotlinCoroutinesVersion}") {
version {
strictly(kotlinCoroutinesVersion)
}
}
}
}
val jvmMain by getting
val jvmTest by getting {
dependencies {
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val nativeMain by getting
val nativeTest by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion")
}
}
}
}
val stubJavaDocJar by tasks.registering(Jar::class) {
archiveClassifier.value("javadoc")
}
publishing {
kotlin.targets.forEach { target ->
val targetPublication: Publication? = publications.findByName(target.name)
if (targetPublication is MavenPublication) {
targetPublication.artifact(stubJavaDocJar.get())
}
}
repositories {
maven {
name = "MainRepo"
url = uri(
System.getenv("REPO_URI")
?: project.findProperty("repo.uri") as String
)
credentials {
username = System.getenv("REPO_USERNAME")
?: project.findProperty("repo.username") as String?
password = System.getenv("REPO_PASSWORD")
?: project.findProperty("repo.password") as String?
}
}
}
publications {
withType<MavenPublication> {
val publicationName = this.name
pom {
if (publicationName == "kotlinMultiplatform") {
name.set("Ko-Te")
description.set("Ko-Te template library")
}
groupId = "dev.limebeck"
url.set("https://github.com/LimeBeck/ko-te")
developers {
developer {
id.set("LimeBeck")
name.set("Anatoly Nechay-Gumen")
email.set("[email protected]")
}
}
licenses {
license {
name.set("MIT license")
url.set("https://github.com/LimeBeck/ko-te/blob/master/LICENCE")
distribution.set("repo")
}
}
scm {
connection.set("scm:git:git://github.com/LimeBeck/ko-te.git")
developerConnection.set("scm:git:ssh://github.com/LimeBeck/ko-te.git")
url.set("https://github.com/LimeBeck/ko-te")
}
}
}
}
}
signing {
sign(publishing.publications)
}