-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.gradle.kts
213 lines (181 loc) · 6.2 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import org.jetbrains.changelog.Changelog
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.tasks.RunIdeTask
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.COMPATIBILITY_PROBLEMS
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.INTERNAL_API_USAGES
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.INVALID_PLUGIN
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.NON_EXTENDABLE_API_USAGES
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask.FailureLevel.OVERRIDE_ONLY_API_USAGES
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun properties(key: String) = project.findProperty(key).toString()
plugins {
java
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.intellij.platform)
alias(libs.plugins.changelog)
}
subprojects {
apply(plugin = "org.jetbrains.intellij.platform.module")
}
val platform = properties("platform")
allprojects {
apply(plugin = "java")
apply(plugin = "kotlin")
group = properties("pluginGroup")
version = properties("pluginVersion")
repositories {
mavenLocal()
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
create(platform, properties("platformVersion"), false)
bundledPlugins(properties("platformGlobalBundledPlugins").split(','))
testFramework(TestFrameworkType.Platform)
testFramework(TestFrameworkType.JUnit5)
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks {
withType<KotlinCompile> {
compilerOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget.set(JvmTarget.JVM_21)
}
}
withType<Test> {
useJUnitPlatform()
systemProperty("java.awt.headless", "false")
}
}
}
dependencies {
intellijPlatform {
pluginVerifier()
zipSigner()
pluginModule(project(":common"))
if (platform == "IC") {
pluginModule(project(":java-dependent"))
pluginModule(project(":kotlin-dependent"))
}
}
implementation(libs.bundles.jackson)
implementation(libs.uuid.generator) {
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation(libs.jsonpath) {
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation(libs.json.schema.validator) {
exclude("org.apache.commons", "commons-lang3")
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation(libs.commons.text)
implementation(libs.commons.codec)
implementation(libs.commons.io)
implementation(libs.commons.compress)
implementation(libs.ulid.creator)
implementation(libs.csscolor4j)
implementation(libs.okhttp)
implementation(libs.jfiglet)
implementation(libs.jnanoid)
implementation(libs.jose4j) {
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation(libs.named.regexp)
implementation(libs.sql.formatter)
implementation(libs.bundles.zxing)
implementation(libs.bundles.text.case.converter)
testImplementation(libs.assertj.core)
testImplementation(libs.bundles.junit.implementation)
testRuntimeOnly(libs.bundles.junit.runtime)
// Required for the PSI Kotlin structure in tests. It needs to be compile-only
// as some parts are clashing with the IntelliJ platform dependency and
// causing the tests initialisation to fail.
testCompileOnly(libs.kotlin.compiler)
testImplementation(testFixtures(project(":common")))
}
intellijPlatform {
pluginConfiguration {
version = providers.gradleProperty("pluginVersion")
ideaVersion {
sinceBuild = properties("pluginSinceBuild")
untilBuild = provider { null }
}
changeNotes.set(provider { changelog.renderItem(changelog.get(project.version as String), Changelog.OutputType.HTML) })
}
signing {
val jetbrainsDir = File(System.getProperty("user.home"), ".jetbrains")
certificateChain.set(project.provider { File(jetbrainsDir, "plugin-sign-chain.crt").readText() })
privateKey.set(project.provider { File(jetbrainsDir, "plugin-sign-private-key.pem").readText() })
password.set(project.provider { properties("jetbrains.sign-plugin.password") })
}
publishing {
token.set(project.provider { properties("jetbrains.marketplace.token") })
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
}
pluginVerification {
failureLevel.set(
listOf(
COMPATIBILITY_PROBLEMS, INTERNAL_API_USAGES, NON_EXTENDABLE_API_USAGES,
OVERRIDE_ONLY_API_USAGES, INVALID_PLUGIN,
// Will fail for non-IC IDEs
//MISSING_DEPENDENCIES
)
)
ides {
recommended()
properties("pluginVerificationAdditionalIdes").split(",").forEach { ide ->
ide(ide, properties("platformVersion"))
}
}
}
}
changelog {
val projectVersion = project.version as String
version.set(projectVersion)
header.set("$projectVersion - ${org.jetbrains.changelog.date()}")
groups.set(listOf("Added", "Changed", "Removed", "Fixed"))
}
val writeChangelogToFileTask = tasks.create("writeChangelogToFile") {
val generatedResourcesDir = layout.buildDirectory.dir("generated-resources/changelog").get()
outputs.dir(generatedResourcesDir)
doLast {
val renderResult = changelog.instance.get().releasedItems.joinToString("\n") { changelog.renderItem(it, Changelog.OutputType.HTML) }
val baseDir = generatedResourcesDir.dir("dev/turingcomplete/intellijdevelopertoolsplugin")
file(baseDir).mkdirs()
file(baseDir.file("changelog.html")).writeText(renderResult)
}
}
sourceSets {
main {
resources {
srcDir(writeChangelogToFileTask)
}
}
}
tasks {
named("publishPlugin") {
dependsOn("check")
doFirst {
check(platform == "IC") { "Expected platform 'IC', but was: '$platform'" }
}
}
named("buildSearchableOptions") {
enabled = false
}
named<RunIdeTask>("runIde") {
jvmArgumentProviders += CommandLineArgumentProvider {
// https://kotlin.github.io/analysis-api/testing-in-k2-locally.html
listOf("-Didea.kotlin.plugin.use.k2=true")
}
}
}