-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
68 lines (57 loc) · 1.7 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import com.github.benmanes.gradle.versions.updates.gradle.GradleReleaseChannel.CURRENT
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.5.10"
id("org.jetbrains.compose") version "0.4.0"
id("com.github.ben-manes.versions") version "0.39.0"
}
group = "org.sdkotlin"
version = "1.0.0"
dependencies {
implementation(compose.desktop.currentOs)
implementation(platform("org.junit:junit-bom:5.7.2"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}
tasks {
test {
useJUnitPlatform()
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
gradleReleaseChannel = CURRENT.id
}
named<Wrapper>("wrapper") {
gradleVersion = "7.1"
distributionType = ALL
}
}
compose.desktop {
application {
mainClass = "org.sdkotlin.compose.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "compose-desktop-demo"
}
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.toUpperCase()
.contains(it)
}
val unstableKeyword =
listOf("""M\d+""").any { version.toUpperCase().contains(it.toRegex()) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = (stableKeyword && !unstableKeyword) || regex.matches(version)
return isStable.not()
}