-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
130 lines (110 loc) · 3.79 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
plugins {
kotlin("multiplatform") version "1.7.20"
`maven-publish`
id("org.jetbrains.dokka") version "1.7.10"
id("co.uzzu.dotenv.gradle") version "2.0.0"
}
group = "net.notjustanna"
version = "0.4.0"
run {
fun String.takeIfValid() = takeIf { it.isNotBlank() && it != "auto" }
fun String.maybeAddSuffix(suffix: String) = if (endsWith(suffix)) this else this + suffix
val v = env.fetchOrNull("VERSION")?.takeIfValid()
?: System.getenv("VERSION")?.takeIfValid()
?: project.version.toString()
val snapshot = (env.fetchOrNull("SNAPSHOT") ?: System.getenv("SNAPSHOT") ?: "false").toBoolean()
project.version = if (snapshot) v.maybeAddSuffix("-SNAPSHOT") else v
}
repositories {
mavenCentral()
maven { url = uri("https://maven.cafeteria.dev/releases") }
maven { url = uri("https://maven.notjustanna.net/releases") }
}
kotlin {
explicitApi()
jvm {
compilations.all {
kotlinOptions.jvmTarget = "13"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
browser()
nodejs()
}
/*
* The targets linuxArm64 and macosArm64 are disabled due to Okio.
* See: https://github.com/square/okio/issues/1006
* https://github.com/Kotlin/kotlinx-datetime/issues/75
* https://youtrack.jetbrains.com/issue/KT-43996
*
* JetBrains pls fix your CI >.>
*/
linuxX64()
// linuxArm64()
macosX64()
// macosArm64()
mingwX64()
sourceSets {
all { languageSettings.optIn("kotlin.RequiresOptIn") }
// common -> js & lowLevel -> jvm & native -> linux, mingw, macos
val commonMain by getting {
dependencies {
api("com.squareup.okio:okio:3.2.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("net.notjustanna:kotlin-unified-platform:1.3")
}
}
val jsMain by getting
val jsTest by getting
val jvmMain by getting
val jvmTest by getting
// val nativeMain by creating { dependsOn(commonMain) }
// val nativeTest by creating { dependsOn(commonTest) }
val linuxX64Main by getting // { dependsOn(nativeMain) }
val linuxX64Test by getting // { dependsOn(nativeTest) }
// val linuxArm64Main by getting // { dependsOn(nativeMain) }
// val linuxArm64Test by getting // { dependsOn(nativeTest) }
val mingwX64Main by getting // { dependsOn(nativeMain) }
val mingwX64Test by getting // { dependsOn(nativeTest) }
val macosX64Main by getting // { dependsOn(nativeMain) }
val macosX64Test by getting // { dependsOn(nativeTest) }
// val macosArm64Main by getting // { dependsOn(nativeMain) }
// val macosArm64Test by getting // { dependsOn(nativeTest) }
}
}
tasks {
register<Jar>("dokkaJar") {
from(dokkaHtml)
dependsOn(dokkaHtml)
archiveClassifier.set("javadoc")
}
}
publishing {
publications.withType<MavenPublication> {
artifact(tasks["dokkaJar"])
}
repositories {
maven {
url = if (project.version.toString().endsWith("-SNAPSHOT")) {
uri("https://maven.notjustanna.net/snapshots")
} else {
uri("https://maven.notjustanna.net/releases")
}
credentials {
username = env.fetchOrNull("MAVEN_USERNAME") ?: System.getenv("MAVEN_USERNAME")
password = env.fetchOrNull("MAVEN_PASSWORD") ?: System.getenv("MAVEN_PASSWORD")
}
authentication {
create("basic", BasicAuthentication::class.java)
}
}
mavenLocal()
}
}