-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle.kts
101 lines (94 loc) · 4.04 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
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformDependenciesExtension
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
import org.jetbrains.intellij.platform.gradle.plugins.project.IntelliJPlatformBasePlugin
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.jetbrains.compose) apply false
alias(libs.plugins.jetbrains.intellij) apply false
alias(libs.plugins.jetbrains.intellij.module) apply false
alias(libs.plugins.buildConfig) apply false
alias(libs.plugins.shadow) apply false
alias(libs.plugins.spotless) apply false
}
allprojects {
plugins.withType<KotlinBasePlugin>().configureEach {
dependencies {
// https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
"compileOnly"(libs.kotlin.stdlib)
}
}
plugins.withId(rootProject.libs.plugins.kotlin.compose.get().pluginId) {
extensions.configure<ComposeCompilerGradlePluginExtension> {
stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
}
}
plugins.withType<IntelliJPlatformBasePlugin>().configureEach {
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#configuration.repositories
repositories {
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#setting-up-intellij-platform
dependencies {
extensions.configure<IntelliJPlatformDependenciesExtension> {
intellijIdeaCommunity(libs.versions.idea)
instrumentationTools()
// dependency plugin id for https://plugins.jetbrains.com/plugin/6954-kotlin
bundledPlugin(libs.kotlin.stdlib.map(Dependency::getGroup))
}
}
}
plugins.apply(rootProject.libs.plugins.spotless.get().pluginId)
extensions.configure<SpotlessExtension> {
kotlin {
target("src/**/*.kt")
targetExclude("src/test/resources/**")
ktlint(libs.ktlint.get().version)
.editorConfigOverride(
mapOf(
"ktlint_compose_lambda-param-event-trailing" to "disabled",
"compose_treat_as_lambda" to false,
"compose_disallow_material2" to true,
"compose_allowed_from_m2" to "icons",
"compose_preview_naming_enabled" to true,
"compose_preview_naming_strategy" to "suffix",
),
)
.customRuleSets(
listOf(
libs.composeRules.get().toString(),
),
)
}
kotlinGradle {
ktlint(libs.ktlint.get().version)
}
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
// https://docs.gradle.org/8.9/userguide/performance.html#execute_tests_in_parallel
maxParallelForks = Runtime.getRuntime().availableProcessors()
}
configurations.configureEach {
resolutionStrategy.eachDependency {
if (requested.group == libs.kotlin.stdlib.get().group) {
useVersion(libs.versions.kotlin.get())
}
}
}
}