-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle.kts
163 lines (135 loc) · 4.63 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
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
import com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.date
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun properties(key: String) = project.findProperty(key).toString()
plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "2.0.21"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij.platform") version "2.1.0"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "2.2.1"
// Code Quality
// ktfmt
id("com.ncorti.ktfmt.gradle") version "0.21.0"
//detekt
id("io.gitlab.arturbosch.detekt").version("1.23.7")
}
group = properties("pluginGroup")
version = properties("pluginVersion")
repositories {
mavenCentral()
intellijPlatform { defaultRepositories() }
}
dependencies {
intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
bundledPlugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
instrumentationTools()
pluginVerifier()
testFramework(TestFrameworkType.Platform)
testFramework(TestFrameworkType.Plugin.Java)
}
testImplementation(platform("org.junit:junit-bom:5.11.3"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
}
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
}
intellijPlatform {
pluginConfiguration {
id.set(properties("pluginGroup"))
name.set(properties("pluginName"))
version.set(properties("pluginVersion"))
changelog {
version.set(properties("pluginVersion"))
path.set(file("CHANGELOG.md").canonicalPath)
header.set(provider { "${version.get()} - ${date()}" })
headerParserRegex.set("""(\d\.\d+\.\d+)""".toRegex())
itemPrefix.set("-")
keepUnreleasedSection.set(true)
unreleasedTerm.set("[Unreleased]")
groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
}
}
pluginVerification { ides { recommended() } }
}
tasks {
// Set the JVM compatibility versions
properties("javaVersion").let {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it
}
withType<KotlinCompile> {
compilerOptions {
apiVersion = KotlinVersion.KOTLIN_1_8
jvmTarget = JvmTarget.fromTarget(properties("javaVersion"))
}
}
}
wrapper { gradleVersion = "8.11.1" }
patchPluginXml {
pluginVersion.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
// Get the latest available change notes from the changelog file
changeNotes.set(
provider { changelog.renderItem(changelog.getLatest(), Changelog.OutputType.HTML) }
)
}
test {
useJUnitPlatform()
testLogging { events("passed", "skipped", "failed") }
}
buildPlugin { dependsOn(test) }
signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}
publishPlugin {
dependsOn("patchChangelog")
token.set(System.getenv("PUBLISH_TOKEN"))
channels.set(listOf("default"))
}
}
tasks.buildSearchableOptions { enabled = false }
// Code quality settings
// Formatting settings
ktfmt { googleStyle() }
// This is used over the "ktfmtCheck" task to exclude the autogenerated file Icons.kt.
tasks.register<KtfmtCheckTask>("checkFormatting") {
source = project.fileTree(rootDir)
include("**/*.kt")
exclude("src/main/kotlin/com/github/catppuccin/jetbrains_icons/Icons.kt")
}
// Static Analysis config
detekt {
parallel = true
config.setFrom("detekt.yaml")
buildUponDefaultConfig = true
}
// This is used over the "detekt" task to exclude the autogenerated file Icons.kt.
tasks.withType<Detekt>().configureEach {
source = project.fileTree(rootDir)
include("**/*.kt")
exclude("src/main/kotlin/com/github/catppuccin/jetbrains_icons/Icons.kt")
}
tasks.register<Detekt>("runStaticAnalysis") {
parallel = true
config.setFrom("detekt.yaml")
buildUponDefaultConfig = true
source = project.fileTree(rootDir)
include("**/*.kt")
exclude("src/main/kotlin/com/github/catppuccin/jetbrains_icons/Icons.kt")
}