-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
168 lines (137 loc) · 5.22 KB
/
build.gradle.kts
File metadata and controls
168 lines (137 loc) · 5.22 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.date
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
plugins {
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.intellij.platform")
id("org.jetbrains.changelog")
id("io.gitlab.arturbosch.detekt") version "1.23.8"
}
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/version_catalogs.html
dependencies {
implementation("com.vladsch.flexmark:flexmark-all:0.50.42")
implementation("org.freemarker:freemarker:2.3.30")
testImplementation("junit:junit:4.13.2")
testImplementation("io.kotest:kotest-runner-junit5-jvm:4.3.1")
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
// Android Studio Panda 3 Patch 1
// https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
androidStudio("2025.3.3.7")
bundledPlugins(
"org.jetbrains.android",
"org.intellij.groovy",
"com.intellij.java",
"org.jetbrains.kotlin",
)
testFramework(TestFrameworkType.Platform)
}
}
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
pluginConfiguration {
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"
with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}
val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = version.map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}
}
}
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
header = provider { "[$version] - ${date()}" }
versionPrefix = ""
itemPrefix = "-"
keepUnreleasedSection = true
unreleasedTerm = "[Unreleased]"
groups = listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security")
}
tasks {
publishPlugin {
dependsOn(patchChangelog)
}
runIde {
// Android Studio 2025.3.x expects nio-fs classes to be visible to the
// application classloader when launched via plain `java`.
classpath += project.files(provider {
platformPath.resolve("lib/nio-fs.jar").toFile()
})
jvmArgumentProviders += CommandLineArgumentProvider {
listOf("-Didea.kotlin.plugin.use.k2=true")
}
maxHeapSize = "8g"
minHeapSize = "4g"
}
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
failFast = false
testLogging {
events("passed", "skipped", "failed")
}
}
// region Static analysis
tasks.named<Detekt>("detekt").configure {
setupCommonDetektSettings()
}
val detektFormat by tasks.registering(Detekt::class) {
setupCommonDetektSettings()
autoCorrect = true
}
val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) {
description = "Overrides current baseline."
source(projectDir)
config.setFrom(detektConfigPath)
baseline.set(file(detektBaselinePath))
buildUponDefaultConfig.set(true)
ignoreFailures.set(true)
parallel.set(true)
include("**/*.kt")
include("**/*.kts")
}
private fun Detekt.setupCommonDetektSettings() {
// Common properties
parallel = true
autoCorrect = false
disableDefaultRuleSets = false
buildUponDefaultConfig = false
// Setup sources for run
source(projectDir)
config.setFrom(detektConfigPath)
baseline.set(file(detektBaselinePath))
include("**/*.kt")
include("**/*.kts")
exclude("**/build/**")
// reports configuration
reports {
xml.required.set(true)
html.required.set(true)
txt.required.set(true)
sarif.required.set(false)
}
}
private val detektConfigPath = "tools/static-analysis/detekt/detekt-config.yaml"
private val detektBaselinePath = "tools/static-analysis/detekt/detekt-baseline.xml"
// endregion