-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
90 lines (80 loc) · 2.39 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.dokka)
alias(libs.plugins.gradle.dependency.update)
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kover)
alias(libs.plugins.nexus.publish)
alias(libs.plugins.spotless)
alias(libs.plugins.version.catalog.update)
}
group = "ai.basemind"
version = "1.0.0"
ext {
set("sdkArtifactId", "client")
}
versionCatalogUpdate {
sortByKey.set(true)
pin {}
keep {
keepUnusedVersions.set(false)
keepUnusedLibraries.set(false)
keepUnusedPlugins.set(false)
}
}
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
checkForGradleUpdate = true
checkConstraints = true
checkBuildEnvironmentConstraints = true
gradleReleaseChannel = "current"
reportfileName = "report"
}
/**
* isNonStable checks if a given version is not stable
*/
fun isStableVersion(version: String): Boolean {
val containsNonStableVersionKeyword = listOf("alpha", "beta", "rc").any { version.lowercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
return !containsNonStableVersionKeyword && regex.matches(version)
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isStableVersion(currentVersion) && !isStableVersion(candidate.version)
}
}
spotless {
java {
target("**/*.java")
importOrder()
removeUnusedImports()
googleJavaFormat()
}
kotlin {
target("**/*.kt")
ktfmt()
ktlint().editorConfigOverride(
mapOf(
"ktlint_standard_function-naming" to "disabled",
"ktlint_standard_no-wildcard-imports" to "disabled",
),
)
}
kotlinGradle {
target("**/*.gradle.kts")
ktfmt()
ktlint()
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
password.set(System.getenv("SONATYPE_PASSWORD"))
username.set(System.getenv("SONATYPE_USER"))
}
}
repositoryDescription = "$group:${project.ext.get("sdkArtifactId")}:$version"
}