-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
109 lines (95 loc) · 3.48 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.detekt.gradle)
}
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven(url = "https://www.jitpack.io")
}
dependencies {
classpath(libs.android.gradle.plugin)
classpath(libs.kotlin.gradle.plugin)
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven(url = "https://www.jitpack.io")
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
kotlinOptions.jvmTarget = JavaVersion.VERSION_11.majorVersion
}
}
subprojects {
// Detekt
apply(plugin = "io.gitlab.arturbosch.detekt")
/**
* Start - Detekt Configuration for All sub projects
*/
detekt {
config.setFrom("$rootDir/config/detekt/detekt.yml")
buildUponDefaultConfig = true
ignoredBuildTypes = listOf("release")
source.setFrom(
io.gitlab.arturbosch.detekt.extensions.DetektExtension.DEFAULT_SRC_DIR_JAVA,
io.gitlab.arturbosch.detekt.extensions.DetektExtension.DEFAULT_TEST_SRC_DIR_JAVA,
io.gitlab.arturbosch.detekt.extensions.DetektExtension.DEFAULT_SRC_DIR_KOTLIN,
io.gitlab.arturbosch.detekt.extensions.DetektExtension.DEFAULT_TEST_SRC_DIR_KOTLIN,
// Kotlin Multiplatform
"src/commonMain/kotlin",
"src/androidMain/kotlin",
"src/iosMain/kotlin",
"src/jvmMain/kotlin",
"src/desktopMain/kotlin",
"src/jsMain/kotlin",
)
}
tasks.withType<Detekt>().configureEach detekt@{
exclude("**/build/**", "**/generated/**", "**/resources/**")
basePath = rootProject.projectDir.absolutePath
autoCorrect = true
reports {
xml.required.set(false)
html.required.set(true)
txt.required.set(false)
sarif.required.set(false)
md.required.set(false)
html {
required.set(true)
outputLocation.set(
[email protected]("reports/detekt.html")
)
}
}
}
tasks.withType<DetektCreateBaselineTask>().configureEach detekt@{
exclude("**/build/**", "**/generated/**", "**/resources/**")
basePath = rootProject.projectDir.absolutePath
}
beforeEvaluate {
dependencies {
detektPlugins(libs.detekt.formatting)
detektPlugins(libs.detekt.rule.twitter.compose)
}
// Filter out Detekt from check task
if (tasks.names.contains("check")) {
tasks.named("check").configure {
this.setDependsOn(this.dependsOn.filterNot {
it is TaskProvider<*> && it.name == "detekt"
})
}
}
}
}