-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathbuild.gradle.kts
104 lines (87 loc) · 3.21 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.DEPRECATED_API_USAGES
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.INVALID_PLUGIN
project.group = "io.gitlab.arturbosch.detekt"
project.version = libs.versions.detektIJ.get()
repositories {
mavenCentral()
}
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.intellij)
alias(libs.plugins.versions)
alias(libs.plugins.github.release)
}
dependencies {
constraints {
runtimeOnly(libs.slf4j.api) {
because("transitive ktlint logging dependency (2.0.3) does not use the module classloader in ServiceLoader")
}
}
implementation(libs.detekt.api)
implementation(libs.detekt.tooling)
runtimeOnly(libs.detekt.core)
runtimeOnly(libs.detekt.rules)
runtimeOnly(libs.detekt.formatting)
testRuntimeOnly(libs.junit.platform)
testImplementation(libs.detekt.testUtils)
testImplementation(libs.assertj.core)
testImplementation(libs.junit.jupiter)
}
kotlin {
jvmToolchain(17)
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
showStandardStreams = true
showExceptions = true
showCauses = true
exceptionFormat = TestExceptionFormat.FULL
}
}
tasks.publishPlugin {
// This property can be configured via environment variable ORG_GRADLE_PROJECT_intellijPublishToken
// See: https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties
token.set((findProperty("intellijPublishToken") as? String).orEmpty())
// https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel
// "-beta" is used for pre-releases and https://plugins.jetbrains.com/plugins/beta/list as plugin repository.
channels.set(listOf(project.version.toString().split('-').getOrElse(1) { "default" }.split('.').first()))
}
intellij {
pluginName.set("Detekt IntelliJ Plugin")
version.set("2022.2.5")
updateSinceUntilBuild.set(false)
plugins.set(listOf("org.intellij.intelliLang", "Kotlin"))
}
tasks.runPluginVerifier {
ideVersions.set(listOf("2022.2.5", "2022.3.3", "2023.1.5", "2023.2.5", "2023.3.3", "241-EAP-SNAPSHOT"))
failureLevel.set(listOf(DEPRECATED_API_USAGES, INVALID_PLUGIN))
}
tasks.buildSearchableOptions {
enabled = false
}
tasks.jarSearchableOptions {
enabled = false
}
githubRelease {
token((project.findProperty("github.token") as? String).orEmpty())
owner.set("detekt")
repo.set("detekt-intellij-plugin")
targetCommitish.set("main")
overwrite.set(true)
dryRun.set(false)
body {
var changelog = project.file("changelog.md").readText()
val sectionStart = "#### ${project.version}"
changelog = changelog.substring(changelog.indexOf(sectionStart) + sectionStart.length)
changelog = changelog.substring(0, changelog.indexOf("#### 1"))
changelog.trim()
}
val distribution = project.layout.buildDirectory
.file("distributions/Detekt IntelliJ Plugin-${project.version}.zip")
releaseAssets.setFrom(distribution)
}
tasks.githubRelease.configure {
dependsOn(tasks.buildPlugin)
}