-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
189 lines (158 loc) · 5.23 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.gradle.ext.packagePrefix
import org.jetbrains.gradle.ext.settings
import java.nio.file.Files
fun properties(key: String): String = providers.gradleProperty(key).get()
val channel: String = properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.9.25"
id("org.jetbrains.intellij") version "1.17.2"
id("org.jetbrains.changelog") version "2.2.1"
id("org.jetbrains.qodana") version "2024.1.9"
id("org.jetbrains.kotlinx.kover") version "0.7.6"
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.23"
id("idea")
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.8"
}
idea {
module {
generatedSourceDirs.add(file("src/gen"))
settings {
packagePrefix["src/src"] = "org.jetbrains.plugins.d2"
packagePrefix["src/testSrc"] = "org.jetbrains.plugins.d2"
}
}
}
group = "org.jetbrains.plugins.d2"
version = properties("pluginVersion")
repositories {
mavenCentral()
maven(url = "https://cache-redirector.jetbrains.com/intellij-repository/snapshots")
}
dependencies {
@Suppress("SpellCheckingInspection")
testImplementation("org.opentest4j:opentest4j:1.3.0")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
sourceSets {
main {
kotlin {
setSrcDirs(listOf("src/src", "src/gen"))
}
resources.setSrcDirs(listOf("src/resources"))
}
test {
kotlin {
setSrcDirs(listOf("src/testSrc"))
}
resources.setSrcDirs(listOf("src/testResources"))
}
}
}
sourceSets["main"].java.setSrcDirs(listOf("src/gen"))
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
}
changelog {
groups.set(emptyList())
repositoryUrl.set(properties("pluginRepositoryUrl"))
}
qodana {
cachePath.set(file(".qodana").canonicalPath)
resultsPath.set(file("build/reports/inspections").canonicalPath)
// saveReport.set(true)
// showReport.set(System.getenv("QODANA_SHOW_REPORT")?.toBoolean() ?: false)
}
koverReport {
defaults {
xml {
onCheck = true
}
}
}
tasks {
wrapper {
gradleVersion = "8.10"
}
test {
testLogging {
// set options for log level LIFECYCLE
events = setOf(
TestLogEvent.FAILED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
// set options for log level DEBUG and INFO
debug {
events = setOf(
TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
}
// *** gradle *** html is not required - failures must be correctly printed to console
reports.html.required = false
useJUnitPlatform()
val overwriteData = providers.gradleProperty("idea.tests.overwrite.data").getOrNull() == "true"
systemProperty("idea.tests.overwrite.data", overwriteData)
}
patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
val lines = Files.readString(file("README.md").toPath()).lines()
val start = lines.indexOf("<!-- Plugin description -->")
val end = lines.indexOf("<!-- Plugin description end -->")
if (start < 0 || end < 0) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
pluginDescription.set(lines.subList(start + 1, end).joinToString("\n").let { markdownToHTML(it) })
changeNotes.set(provider {
changelog.renderItem(item = changelog.getOrNull(properties("pluginVersion")) ?: changelog.getLatest(), outputType = Changelog.OutputType.HTML)
})
}
buildSearchableOptions {
enabled = false
}
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
}
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(channel))
}
}