-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
92 lines (79 loc) · 3.15 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
92 lines (79 loc) · 3.15 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
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
val kotlinVersion = libs.versions.kotlin.get()
plugins {
alias(libs.plugins.ktlint)
alias(libs.plugins.aboutlibraries).apply(false)
alias(libs.plugins.android.application).apply(false)
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.android.lint).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.kotlin.serialization).apply(false)
alias(libs.plugins.compose.compiler).apply(false)
alias(libs.plugins.screenshot).apply(false)
}
allprojects {
apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId)
// TODO this has been added until https://youtrack.jetbrains.com/issue/KT-87220/Kotlin-Gradle-plugin-resolves-kotlinAbiValidationCompatClasspath-to-newer-beta-Kotlin-artifacts-during-dependency-locking is addressed
configurations.matching { it.name == "kotlinAbiValidationCompatClasspath" }.configureEach {
resolutionStrategy.eachDependency {
if (
requested.group == "org.jetbrains.kotlin" &&
requested.name in setOf(
"kotlin-build-tools-api",
"kotlin-build-tools-cri-impl",
"kotlin-build-tools-impl",
"kotlin-compiler-embeddable",
"kotlin-compiler-runner",
"kotlin-daemon-client",
"kotlin-daemon-embeddable",
"kotlin-script-runtime",
"kotlin-stdlib",
"kotlin-tooling-core",
)
) {
useVersion(kotlinVersion)
because("Keep Kotlin ABI validation tooling aligned with the configured Kotlin version.")
}
}
}
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}")
}
}