-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
112 lines (95 loc) · 2.75 KB
/
build.gradle.kts
File metadata and controls
112 lines (95 loc) · 2.75 KB
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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("multiplatform") version "1.6.21"
`maven-publish`
id("com.github.ben-manes.versions") version "0.42.0"
id("se.patrikerdes.use-latest-versions") version "0.2.18"
}
group = "com.martmists"
version = "1.3.0"
repositories {
mavenCentral()
}
kotlin {
jvm()
js {
browser()
nodejs()
}
mingwX64()
linuxX64()
linuxArm64()
macosX64()
macosArm64()
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
}
}
all {
languageSettings.apply {
optIn("kotlin.RequiresOptIn")
optIn("kotlin.ExperimentalStdlibApi")
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
}
}
}
}
tasks {
named("publish") {
dependsOn("allTests")
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
withType<DependencyUpdatesTask> {
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
}
if (project.ext.has("mavenToken")) {
publishing {
repositories {
maven {
name = "Host"
url = uri("https://maven.martmists.com/releases")
credentials {
username = "admin"
password = project.ext["mavenToken"]!! as String
}
}
}
publications.withType<MavenPublication> {
}
}
} else if (System.getenv("CI") == "true") {
publishing {
repositories {
maven {
name = "Host"
url = uri(System.getenv("GITHUB_TARGET_REPO")!!)
credentials {
username = "github-actions"
password = System.getenv("DEPLOY_KEY")!!
}
}
}
publications.withType<MavenPublication> {
if (System.getenv("DEPLOY_TYPE") == "snapshot") {
version = System.getenv("GITHUB_SHA")!!
}
}
}
}