-
-
Notifications
You must be signed in to change notification settings - Fork 717
/
Copy pathbuild.gradle.kts
61 lines (50 loc) · 1.82 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
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
plugins {
alias(libs.plugins.ktlint)
alias(libs.plugins.android.application).apply(false)
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.kotlin.android).apply(false)
alias(libs.plugins.google.services).apply(false)
alias(libs.plugins.firebase.appdistribution).apply(false)
alias(libs.plugins.hilt).apply(false)
alias(libs.plugins.kotlin.parcelize).apply(false)
alias(libs.plugins.ksp).apply(false)
alias(libs.plugins.compose.compiler).apply(false)
}
allprojects {
apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId)
ktlint {
android.set(true)
reporters {
reporter(ReporterType.SARIF)
reporter(ReporterType.PLAIN)
}
}
dependencyLocking {
lockAllConfigurations()
}
}
tasks.register("clean") {
delete("build")
}
tasks.register("alldependencies") {
setDependsOn(
project.allprojects.flatMap {
it.tasks.withType<DependencyReportTask>()
}
)
}
tasks.register("versionFile") {
group = "publishing"
description = "Writes the project.version to a file version.txt at the root of the project"
notCompatibleWithConfigurationCache("The version of the project depends on the timestamp of the build and cannot be cached.")
// Use a provider to avoid capturing script object references
outputs.file("$projectDir/version.txt")
// Retrieve the project version here since querying `project` at execution time is unsupported when configuration cache is enabled
val projectVersion = project.version.toString()
doLast {
val versionFile = outputs.files.singleFile
versionFile.writeText(projectVersion)
println("Version written to ${versionFile.absolutePath}")
}
}