11import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
22import org.jetbrains.intellij.platform.gradle.TestFrameworkType
33import org.jetbrains.intellij.platform.gradle.tasks.RunIdeTask
4+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
5+ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
6+ import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
47
58plugins {
6- id " org.jetbrains.intellij.platform" version " 2.1.0 "
7- id " org.jetbrains.kotlin.jvm" version " 1.9.25 "
8- id " de.undercouch.download" version " 4.1.2 "
9+ id " org.jetbrains.intellij.platform" version " 2.7.2 "
10+ id " org.jetbrains.kotlin.jvm" version " 2.2.10 "
11+ id " de.undercouch.download" version " 5.6.0 "
912 id ' com.adarshr.test-logger' version ' 4.0.0'
1013}
1114
@@ -33,13 +36,17 @@ ext {
3336 channel = " canary"
3437 }
3538
36- version " $pluginVersion $versionSuffix "
39+ version = " $pluginVersion $versionSuffix "
3740}
3841
3942allprojects {
4043 apply plugin : ' java'
4144 sourceCompatibility = javaVersion
4245 targetCompatibility = javaVersion
46+ java {
47+ sourceCompatibility = JavaVersion . VERSION_21
48+ targetCompatibility = JavaVersion . VERSION_21
49+ }
4350 tasks. withType(JavaCompile ) { options. encoding = ' UTF-8' }
4451}
4552subprojects {
@@ -58,7 +65,6 @@ subprojects {
5865 create(providers. gradleProperty(" platformType" ), providers. gradleProperty(" platformVersion" ))
5966
6067 bundledPlugins providers. gradleProperty(" platformBundledPlugins" ). map { it. split(' ,' ). toList() }
61- plugins providers. gradleProperty(" platformPlugins" ). map { it. split(' ,' ). toList() }
6268
6369 instrumentationTools()
6470 pluginVerifier()
@@ -88,10 +94,11 @@ sourceSets {
8894 }
8995}
9096intellijPlatform {
97+ // buildSearchableOptions = false
98+ // instrumentCode = false
9199 pluginConfiguration {
92100 def stripTag = { text , tag -> text. replace(" <${ tag} >" , " " ). replace(" </${ tag} >" , " " ) }
93- def bodyInnerHTML = { path ->
94- stripTag(stripTag(file(path). text, " html" ), " body" )
101+ def bodyInnerHTML = { path -> stripTag(stripTag(file(path). text, " html" ), " body" )
95102 }
96103
97104 id = providers. gradleProperty(" pluginGroup" )
@@ -122,13 +129,17 @@ intellijPlatform {
122129 }
123130 pluginVerification {
124131 ides {
125- ide(IntelliJPlatformType.IntellijIdeaCommunity , " 243.12818.47" )
132+ // https://www.jetbrains.com/idea/download/other.html
133+ // ide(IntelliJPlatformType.IntellijIdeaCommunity, "2024.2.6")
134+ // ide(IntelliJPlatformType.IntellijIdeaCommunity, "2024.3.6")
135+ ide IntelliJPlatformType.IntellijIdeaCommunity , " 2025.2.1"
126136 }
127137 }
128138}
129139apply plugin : " kotlin"
130140
131- tasks. withType(RunIdeTask ) {
141+ // Configure all RunIdeTask instances (including the new platform-specific ones)
142+ tasks. withType(RunIdeTask ). configureEach {
132143 // Set JVM arguments
133144 jvmArguments. addAll([" -Didea.debug.mode=true" , " -Didea.is.internal=true" , " -Dlog4j2.debug=true" , " -Dlogger.org=TRACE" , " -XX:+AllowEnhancedClassRedefinition" ])
134145
@@ -142,19 +153,26 @@ tasks.withType(RunIdeTask) {
142153 if (project. hasProperty(" runIdeWorkingDirectory" ) && ! project. property(" runIdeWorkingDirectory" ). isEmpty()) {
143154 workingDir = file(project. property(" runIdeWorkingDirectory" ))
144155 }
156+
157+ def compatiblePluginsList = providers. gradleProperty(" runIdeCompatiblePlugins" ). get(). with { it. isEmpty() ? [] : it. split(" ," ) }
158+ if (compatiblePluginsList. size() > 0 ) {
159+ dependencies {
160+ intellijPlatform {
161+ compatiblePlugins(compatiblePluginsList)
162+ }
163+ }
164+ }
145165}
146166
147167kotlin {
148168 jvmToolchain(21 )
149169}
150170
151- // noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
152- tasks. withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile ). configureEach {
153- // noinspection GrUnresolvedAccess
154- kotlinOptions {
155- apiVersion = " 1.7"
156- jvmTarget = " 21"
157- freeCompilerArgs = [" -Xjvm-default=all" ]
171+ tasks. withType(KotlinJvmCompile ). configureEach {
172+ compilerOptions {
173+ jvmTarget. set(JvmTarget . JVM_21 )
174+ freeCompilerArgs. add(" -Xjvm-default=all" )
175+ apiVersion. set(KotlinVersion . KOTLIN_2_2 )
158176 }
159177}
160178
@@ -176,50 +194,30 @@ test {
176194 }
177195}
178196
197+ // Get the list of platforms from gradle.properties
198+ def runIdePlatformsList = providers. gradleProperty(" runIdePlatforms" ). get(). split(" ," )
199+
179200intellijPlatformTesting {
180- // Get the list of platforms from gradle.properties
181- def platformsList = providers. gradleProperty(" platformsList" ). get(). split(" ," )
182-
183- // Use providers.gradleProperty to get the 'runIdePlugins' property
184- def runIdePluginsProperty = providers. gradleProperty(" runIdePlugins" ). getOrElse(" " )
185- def runIdePluginsList = runIdePluginsProperty. split(" ," )
186-
187- platformsList. each { platform ->
188- runIde. create(" run${ platform} " ) {
189- type = IntelliJPlatformType . " ${ platform} "
190- version = providers. gradleProperty(" platformVersion${ platform} " ). get()
191- prepareSandboxTask {
192- sandboxDirectory = project. layout. buildDirectory. dir(" ${ platform.toLowerCase()} -sandbox" )
193- }
201+ runIde {
202+ runIdePlatformsList. each { platform ->
203+ " run${ platform} " {
204+ type = IntelliJPlatformType . " ${ platform} "
205+ version = providers. gradleProperty(" platformVersion${ platform} " ). get()
194206
195- // if runIdePluginsList is not empty, set the plugins
196- if (runIdePluginsList. size() > 0 ) {
197- plugins {
198- // Apply each plugin from the 'runIdePluginsList'
199- runIdePluginsList. each { plugin ->
200- plugins(plugin. trim())
201- }
207+ prepareSandboxTask {
208+ sandboxDirectory = project. layout. buildDirectory. dir(" ${ platform.toLowerCase()} -sandbox" )
202209 }
203210 }
204- }
205211
206- // if enableEAPIDEs is true, create an EAP instance
207- if (providers. gradleProperty(" enableEAPIDEs" ). get(). toLowerCase() == " true" ) {
208- runIde. create(" run${ platform} EAP" ) {
209- type = IntelliJPlatformType . " ${ platform} "
210- version = providers. gradleProperty(" platformVersion${ platform} EAP" ). get()
211- prepareSandboxTask {
212- sandboxDirectory = project. layout. buildDirectory. dir(" ${ platform.toLowerCase()} _eap-sandbox" )
213- }
214- useInstaller = false
215-
216- // if runIdePluginsList is not empty, set the plugins
217- if (runIdePluginsList. size() > 0 ) {
218- plugins {
219- // Apply each plugin from the 'runIdePluginsList'
220- runIdePluginsList. each { plugin ->
221- plugins(plugin. trim())
222- }
212+ // if enableEAPIDEs is true, create an EAP instance
213+ if (providers. gradleProperty(" enableEAPIDEs" ). get(). toLowerCase() == " true" ) {
214+ " run${ platform} EAP" {
215+ type = IntelliJPlatformType . " ${ platform} "
216+ version = providers. gradleProperty(" platformVersion${ platform} EAP" ). get()
217+ useInstaller = false
218+
219+ prepareSandboxTask {
220+ sandboxDirectory = project. layout. buildDirectory. dir(" ${ platform.toLowerCase()} _eap-sandbox" )
223221 }
224222 }
225223 }
@@ -237,7 +235,7 @@ task testCompilation(type: Test, group: 'Verification', dependsOn: [classes, tes
237235}
238236
239237repositories {
240- maven { url ' https://maven-central.storage.googleapis.com' }
238+ maven { url = ' https://maven-central.storage.googleapis.com' }
241239 mavenCentral()
242240 intellijPlatform {
243241 defaultRepositories()
@@ -248,9 +246,7 @@ dependencies {
248246 intellijPlatform {
249247 create(providers. gradleProperty(" platformType" ), providers. gradleProperty(" platformVersion" ))
250248
251- bundledPlugins providers. gradleProperty(" platformBundledPlugins" ). map { it. split(' ,' ). toList() }
252- plugins providers. gradleProperty(" platformPlugins" ). map { it. split(' ,' ). toList() }
253-
249+ bundledPlugins(providers. gradleProperty(" platformBundledPlugins" ). map { it. split(' ,' ). toList() })
254250 instrumentationTools()
255251 pluginVerifier()
256252 zipSigner()
@@ -285,12 +281,12 @@ idea {
285281 }
286282}
287283
288- task getElixir {
284+ tasks . register( ' getElixir' ) {
289285 doLast {
290- def folder = new File (elixirPath)
286+ def folder = new File (elixirPath as String )
291287
292288 if (! folder. isDirectory() || folder. list(). size() == 0 ) {
293- download {
289+ download. run {
294290 src " https://github.com/elixir-lang/elixir/archive/v${ elixirVersion} .zip"
295291 dest " ${ rootDir} /cache/Elixir.${ elixirVersion} .zip"
296292 overwrite false
@@ -314,7 +310,7 @@ task getElixir {
314310
315311task getQuoter {
316312 doLast {
317- download {
313+ download. run {
318314 src " https://github.com/KronicDeth/intellij_elixir/archive/v${ quoterVersion} .zip"
319315 dest quoterZipPath
320316 overwrite false
@@ -423,3 +419,11 @@ idea {
423419 generatedSourceDirs + = file(' gen' )
424420 }
425421}
422+
423+ // Uncomment to allow using build-scan.
424+ // if (hasProperty('buildScan')) {
425+ // buildScan {
426+ // termsOfServiceUrl = 'https://gradle.com/terms-of-service'
427+ // termsOfServiceAgree = 'yes'
428+ // }
429+ // }
0 commit comments