Skip to content

Commit aeaff82

Browse files
committed
chore: upgrade to IntelliJ Gradle Plugin 2.0
1 parent 608b85a commit aeaff82

File tree

7 files changed

+84
-94
lines changed

7 files changed

+84
-94
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
- name: Test
2222
run: gradle clean test --info
2323
- name: Plugin verification
24-
run: gradle clean runPluginVerifier
24+
run: gradle clean verifyPlugin

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ build/
44
.gradle/
55
/gradle/
66
*.bak
7+
.intellijPlatform
File renamed without changes.

bin/gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.gradle-7.6.1.pkg
1+
.gradle-8.2.pkg

build.gradle.kts

Lines changed: 69 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import org.jetbrains.intellij.tasks.RunPluginVerifierTask
2-
import java.util.EnumSet
1+
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
2+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
33

44
group = "com.squareup.cash.hermit"
55
version = project.properties["version"] ?: "1.0-SNAPSHOT"
66

77
plugins {
8-
id("idea")
98
id("java")
109
kotlin("kapt") version "1.9.25"
11-
id("org.jetbrains.intellij") version "1.17.4"
10+
id("org.jetbrains.intellij.platform") version "2.0.0"
11+
1212
id("org.jetbrains.kotlin.jvm") version "1.9.25"
1313
id("org.jetbrains.kotlin.plugin.serialization") version "1.4.32"
1414
}
@@ -17,40 +17,15 @@ plugins {
1717

1818
java {
1919
sourceCompatibility = JavaVersion.VERSION_17
20-
targetCompatibility = JavaVersion.VERSION_11
20+
targetCompatibility = JavaVersion.VERSION_17
2121
}
2222

2323
repositories {
2424
mavenCentral()
25-
}
26-
27-
val kotlinVersion = "1.9.25"
28-
val arrowVersion = "0.11.0"
29-
30-
dependencies {
31-
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
32-
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
33-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
34-
implementation("io.arrow-kt:arrow-core:$arrowVersion")
35-
implementation("io.arrow-kt:arrow-syntax:$arrowVersion")
36-
kapt("io.arrow-kt:arrow-meta:$arrowVersion")
37-
38-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
39-
}
40-
41-
tasks {
42-
compileKotlin {
43-
kotlinOptions.jvmTarget = "11"
44-
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
45-
}
46-
47-
test {
48-
systemProperty("idea.force.use.core.classloader", "true")
25+
intellijPlatform {
26+
defaultRepositories()
4927
}
5028
}
51-
// endregion
52-
53-
// region IJ Plugin setup
5429

5530
data class Product(
5631
val releaseType: String, // identifier for this product
@@ -79,73 +54,83 @@ val products = listOf(
7954
)
8055
val product = products.first { it.releaseType == (System.getenv("RELEASE_TYPE") ?: "release") }
8156

82-
intellij {
83-
version.set(product.sdkVersion)
84-
type.set("IU")
85-
plugins.set(
86-
listOf(
87-
"gradle",
88-
"java",
89-
"terminal",
57+
val kotlinVersion = "1.9.25"
58+
val arrowVersion = "0.11.0"
59+
60+
dependencies {
61+
intellijPlatform {
62+
intellijIdeaUltimate(properties["IIC.release.version"] as String)
63+
pluginVerifier("1.371")
64+
plugins(
65+
"org.jetbrains.plugins.go:${product.goPluginVersion}"
66+
)
67+
bundledPlugins(
68+
"com.intellij.gradle",
69+
"com.intellij.java",
70+
//"com.intellij.terminal",
9071
"com.intellij.properties",
91-
"org.jetbrains.plugins.go:${product.goPluginVersion}",
9272
// Needed by Go plugin. See https://github.com/JetBrains/gradle-intellij-plugin/issues/1056
9373
"org.intellij.intelliLang"
9474
)
95-
)
75+
testFramework(TestFrameworkType.Bundled, properties["IIC.release.version"] as String)
76+
}
77+
78+
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
79+
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
80+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
81+
implementation("io.arrow-kt:arrow-core:$arrowVersion")
82+
implementation("io.arrow-kt:arrow-syntax:$arrowVersion")
83+
kapt("io.arrow-kt:arrow-meta:$arrowVersion")
84+
85+
testImplementation("junit:junit:4.13.2")
86+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
9687
}
88+
9789
tasks {
98-
runIde {
99-
// Uncomment this, and set your path accordingly, if you want to debug on GoLand
100-
// ideDirectory "/Users/juho/Library/Application Support/JetBrains/Toolbox/apps/Goland/ch-0/203.6682.164/GoLand.app/Contents"
90+
compileKotlin {
91+
kotlinOptions.jvmTarget = "17"
92+
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
93+
}
94+
95+
test {
96+
systemProperty("idea.force.use.core.classloader", "true")
97+
}
98+
}
99+
100+
intellijPlatform {
101+
version = version
102+
projectName = project.name
103+
104+
instrumentCode = false // We don't need to scan codebase for jetbrains annotations
105+
106+
//type.set("IU")
107+
108+
pluginVerification {
109+
// These need to match the versions from
110+
// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIC,IIE,GO
111+
ides {
112+
ide(IntelliJPlatformType.IntellijIdeaUltimate, project.properties["IIC.from.version"] as String)
113+
ide(IntelliJPlatformType.IntellijIdeaUltimate, product.intellijVersion)
114+
ide(IntelliJPlatformType.IntellijIdeaCommunity, project.properties["IIC.from.version"] as String)
115+
ide(IntelliJPlatformType.IntellijIdeaCommunity, product.intellijVersion)
116+
ide(IntelliJPlatformType.GoLand, project.properties["GO.from.version"] as String)
117+
ide(IntelliJPlatformType.GoLand, product.golandVersion)
118+
recommended()
119+
}
101120
}
121+
}
102122

123+
tasks {
103124
patchPluginXml {
104-
sinceBuild.set(project.properties["IIC.from.version"] as String)
125+
sinceBuild.set(project.properties["IIC.from.build"] as String)
105126
val versionSuffix = when(product.releaseType) {
106127
"release" -> ""
107128
else -> "-${product.releaseType}"
108129
}
109-
version.set("${System.getenv("IJ_PLUGIN_VERSION")}${versionSuffix}") // IJ_PLUGIN_VERSION env var available in CI
110-
}
111-
112-
runPluginVerifier {
113-
// These need to match the versions from
114-
// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIC,IIE,GO
115-
ideVersions.set(
116-
listOf(
117-
"IIC-${project.properties["IIC.from.version"] as String}",
118-
"GO-${project.properties["GO.from.version"] as String}",
119-
"IIC-${product.intellijVersion}",
120-
"GO-${product.golandVersion}"
121-
)
122-
)
123-
failureLevel.set(
124-
EnumSet.complementOf(
125-
EnumSet.of(
126-
// skipping missing dependencies as com.intellij.java provided by IJ raises a false warning
127-
RunPluginVerifierTask.FailureLevel.MISSING_DEPENDENCIES,
128-
// skipping experimental API usage, as delaying Gradle execution relies on experimental GradleExecutionAware.
129-
// if the API changes, we should be able to detect that in our tests when a new version comes out.
130-
RunPluginVerifierTask.FailureLevel.EXPERIMENTAL_API_USAGES,
131-
// we do not fail on deprecated API usages, as we want to support older versions where the API has
132-
// not been deprecate yet, and the newer API not available
133-
RunPluginVerifierTask.FailureLevel.DEPRECATED_API_USAGES,
134-
// TODO: fix these
135-
RunPluginVerifierTask.FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES,
136-
)
137-
)
138-
)
130+
version = "${System.getenv("IJ_PLUGIN_VERSION")}${versionSuffix}" // IJ_PLUGIN_VERSION env var available in CI
139131
}
140132

141133
publishPlugin {
142134
token.set(System.getenv("JETBRAINS_TOKEN")) // JETBRAINS_TOKEN env var available in CI
143135
}
144-
145-
// See https://youtrack.jetbrains.com/issue/KTIJ-782
146-
buildSearchableOptions {
147-
enabled = false
148-
}
149-
}
150-
151-
// endregion
136+
}

gradle.properties

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
kotlin.code.style=official
22

33
# The latest supported versions. Note, these are updated automatically from update-major-versions.sh
4-
IIC.release.version=241.14494.240
5-
IIC.eap.version=242.20224.91
4+
IIC.release.version=2024.1
5+
IIC.eap.version=2024.2
66

77
IIC.release.go_plugin.version=241.14494.240
8-
IIC.eap.go_plugin.version=242.20224.159
9-
GO.release.version=241.14494.238
10-
GO.eap.version=242.20224.106
8+
IIC.eap.go_plugin.version=241.14494.17
9+
10+
GO.release.version=2024.1
11+
GO.eap.version=2024.2
12+
1113
# The oldest supported versions.
12-
IIC.from.version=222.4554.10
13-
GO.from.version=222.4554.12
14+
IIC.from.version=2022.2.5
15+
IIC.from.build=222.4554.10
16+
17+
GO.from.version=2022.2.5

upgrade-major-versions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ latestRelease() {
88
typeCode=$1
99
releaseType=$2
1010
url="https://data.services.jetbrains.com/products?fields=code,releases.build,releases.type&code=${typeCode}"
11-
curl -s "${url}" | jq "[.[0]|.releases|.[]|select(.type==\"${releaseType}\")|.build][0]" | tr -d '"'
11+
curl -s "${url}" | jq "[.[0]|.releases|.[]|select(.type==\"${releaseType}\")|.version][0]" | tr -d '"'
1212
}
1313

1414
# Returns the latest go plugin version from https://plugins.jetbrains.com/api/plugins/9568.

0 commit comments

Comments
 (0)