-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
143 lines (130 loc) · 4.62 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
143 lines (130 loc) · 4.62 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
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
// build.gradle.kts — root
plugins {
alias(libs.plugins.dokka)
alias(libs.plugins.powerAssert) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidKotlinMultiplatformLibrary) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.sqldelight) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.detekt) apply false
alias(libs.plugins.kover)
// axionRelease applied conditionally below — it fails to apply when this build is
// included as a Gradle composite build because the root project is not yet available.
alias(libs.plugins.axionRelease) apply false
}
// Only configure SCM versioning when running as a standalone build. When included as a
// composite build (gradle.parent != null), version management is unnecessary and the plugin
// errors out trying to reach the root project too early.
if (gradle.parent == null) {
apply(plugin = "pl.allegro.tech.build.axion-release")
configure<pl.allegro.tech.build.axion.release.domain.VersionConfig> {
tag {
prefix.set("v")
}
versionIncrementer("incrementPatch")
}
}
val resolvedVersion: String = if (gradle.parent == null) {
extensions.getByType<pl.allegro.tech.build.axion.release.domain.VersionConfig>().version
} else {
"0.0.0-composite"
}
allprojects {
group = "org.meshtastic"
version = resolvedVersion
}
dependencies {
dokka(project(":core"))
dokka(project(":transport-ble"))
dokka(project(":transport-tcp"))
dokka(project(":transport-serial"))
dokka(project(":storage-sqldelight"))
dokka(project(":testing"))
}
val catalog = extensions
.getByType<org.gradle.api.artifacts.VersionCatalogsExtension>()
.named("libs")
val ktlintVersion = catalog.findVersion("ktlint").get().requiredVersion
val licenseHeader = rootProject.file("config/spotless/license-header.txt").readText()
spotless {
val excludes = arrayOf(
"**/build/**",
"**/.gradle/**",
"**/generated/**",
"**/node_modules/**",
"**/detekt-baseline.xml",
"**/api/*.api",
"gradle/wrapper/**",
"**/*.iml",
".idea/**",
// Local tooling directories, not sources. `.direnv/` holds nix-direnv's
// flake inputs, which are read-only /nix/store paths — spotless copying
// them into build/spotless-clean fails the task outright with
// AccessDeniedException, so `./gradlew check` cannot run at all in a
// Nix/direnv checkout. `.claude/` holds git worktrees, which drag in a
// second copy of the tree (and its own .direnv).
".direnv/**",
".claude/**",
)
kotlin {
target("**/*.kt")
targetExclude(*excludes)
ktlint(ktlintVersion).editorConfigOverride(
mapOf(
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
),
)
licenseHeader(licenseHeader)
}
kotlinGradle {
target("**/*.gradle.kts")
targetExclude(*excludes)
ktlint(ktlintVersion)
}
format("misc") {
target(
"**/*.md",
"**/*.yml",
"**/*.yaml",
"**/*.json",
"**/*.toml",
".gitignore",
".gitattributes",
".editorconfig",
)
targetExclude(*excludes)
trimTrailingWhitespace()
endWithNewline()
}
}
subprojects {
apply(plugin = "dev.detekt")
val subCatalog = rootProject.extensions
.getByType<org.gradle.api.artifacts.VersionCatalogsExtension>()
.named("libs")
val detektVersion = subCatalog.findVersion("detekt").get().requiredVersion
val detektComposeRules = subCatalog.findLibrary("detektComposeRules").get()
extensions.configure<dev.detekt.gradle.extensions.DetektExtension> {
toolVersion = detektVersion
buildUponDefaultConfig = true
config.setFrom(rootProject.files("config/detekt/detekt.yml"))
baseline = file("detekt-baseline.xml")
ignoreFailures = false
}
dependencies.add("detektPlugins", detektComposeRules)
}
val libraryModules =
setOf("core", "transport-ble", "transport-tcp", "transport-serial", "storage-sqldelight", "testing")
subprojects {
if (name in libraryModules) {
apply(plugin = "org.jetbrains.kotlinx.kover")
}
}
dependencies {
libraryModules.forEach { kover(project(":$it")) }
}