Skip to content

Commit 46278a4

Browse files
authored
Support Kotlin 2.2, fix writeAction in SDK, various bumps.. large commit. (#3712)
1 parent 6fbfa00 commit 46278a4

File tree

30 files changed

+304
-160
lines changed

30 files changed

+304
-160
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: Setup JBR 21
15-
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
15+
uses: actions/setup-java@v5
1616
with:
1717
distribution: 'jetbrains'
1818
java-version: 21
@@ -41,7 +41,7 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v2
4343
- name: Setup JBR 21
44-
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
44+
uses: actions/setup-java@v5
4545
with:
4646
distribution: 'jetbrains'
4747
java-version: 21
@@ -56,7 +56,7 @@ jobs:
5656
steps:
5757
- uses: actions/checkout@v2
5858
- name: Setup JBR 21
59-
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
59+
uses: actions/setup-java@v5
6060
with:
6161
distribution: 'jetbrains'
6262
java-version: 21

.github/workflows/test.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
ideaVersion: [ "2024.2.0.1" ]
15+
ideaVersion: [ "2024.2.6", "2024.3.6", "2025.2.1" ]
1616

1717
steps:
1818
- uses: actions/checkout@v2
1919
- name: Setup JBR 21
20-
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
20+
uses: actions/setup-java@v5
2121
with:
2222
distribution: 'jetbrains'
2323
java-version: 21
24+
cache: 'gradle'
25+
package-type: 'jdk+jcef'
2426
- name: Set up Elixir
2527
uses: erlef/setup-beam@v1
2628
with:
@@ -48,10 +50,12 @@ jobs:
4850
steps:
4951
- uses: actions/checkout@v2
5052
- name: Setup JBR 21
51-
uses: gmitch215/setup-java@6d2c5e1f82f180ae79f799f0ed6e3e5efb4e664d
53+
uses: actions/setup-java@v5
5254
with:
5355
distribution: 'jetbrains'
5456
java-version: 21
57+
cache: 'gradle'
58+
package-type: 'jdk+jcef'
5559
- name: Grant execute permission for gradlew
5660
run: chmod +x gradlew
5761
- name: Run Plugin Verifier

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ jps-shared/build
2929
jps-shared/out
3030
libs/
3131
.intellijPlatform
32+
/.kotlin

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v22.0.0 (Unreleased)
4+
### Enhancements
5+
* [#3712](https://github.com/KronicDeth/intellij-elixir/pull/3712) - [@joshuataylor](https://github.com/joshuataylor)
6+
* Upgrade Kotlin to 2.2.10, as it's deprecated in IntelliJ 2025.1+, various deprecations are also fixed.
7+
* Fixed adding Erlang/Elixir SDKs in 2025.1+ IDEs.
8+
39
## v21.0.0
410
### Enhancements
511
* [#3651](https://github.com/KronicDeth/intellij-elixir/pull/3681) - [@joshuataylor](https://github.com/joshuataylor)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
6. In "Import Project from Gradle"
3232
1. Check "Use auto-import"
3333
2. Check "Create separate module per source set"
34-
3. Ensure Gradle JVM is **AT LEAST** Java 1.7 / 7. (Java 1.8 / 8 is recommended.)
34+
3. Ensure Gradle JVM is **AT LEAST** Java 21+.
3535
Your import settings should look something like this:<br/>
3636
![Gradle settings](/screenshots/contributing/gradle_settings.png?raw=true "Gradle settings")
3737
4. Click Finish

build.gradle

Lines changed: 67 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
22
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
33
import 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

58
plugins {
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

3942
allprojects {
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
}
4552
subprojects {
@@ -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
}
9096
intellijPlatform {
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
}
129139
apply 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

147167
kotlin {
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+
179200
intellijPlatformTesting {
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

239237
repositories {
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

315311
task 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

Comments
 (0)