diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 973b9628a44..c815daee49a 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -105,7 +105,7 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
- # Setup Java 11 environment for the next steps
+ # Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1
with:
@@ -124,7 +124,7 @@ jobs:
echo "::set-output name=version::$VERSION"
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"
- ./gradlew :intellij-plugin:listProductsReleases # prepare list of IDEs for Plugin Verifier
+ ./gradlew :intellij-plugin:printProductsReleases # prepare list of IDEs for Plugin Verifier
# Trigger code generation in test project, as the plugin's tests depend on it
- name: Test project codegen
@@ -151,7 +151,7 @@ jobs:
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
- run: ./gradlew :intellij-plugin:runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
+ run: ./gradlew :intellij-plugin:verifyPlugin -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
diff --git a/.gitignore b/.gitignore
index 12daf509a52..a83e69917ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,3 +49,4 @@ package-lock.json
# IntelliJ plugin
intellij-plugin/mockJDK
+.intellijPlatform
diff --git a/.idea/runConfigurations/Run_IntelliJ_plugin.xml b/.idea/runConfigurations/Run_IntelliJ_plugin.xml
index afdce5b4984..c3b81888a79 100644
--- a/.idea/runConfigurations/Run_IntelliJ_plugin.xml
+++ b/.idea/runConfigurations/Run_IntelliJ_plugin.xml
@@ -16,7 +16,7 @@
@@ -24,6 +24,7 @@
true
true
false
+ false
-
+
\ No newline at end of file
diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts
index 7d44a1e0bb1..a200d2ca5cd 100644
--- a/build-logic/build.gradle.kts
+++ b/build-logic/build.gradle.kts
@@ -32,7 +32,7 @@ dependencies {
implementation(libs.kotlinx.serialization.json)
implementation(libs.poet.java)
implementation(libs.poet.kotlin)
- implementation(libs.intellij.plugin)
+ implementation(libs.intellij.platform.plugin)
implementation(libs.intellij.changelog)
implementation(libs.androidx.lint.gradle.plugin)
implementation(libs.kotlin.plugin.compose)
diff --git a/gradle/libraries.toml b/gradle/libraries.toml
index 10eac25b6c5..81c9e265948 100644
--- a/gradle/libraries.toml
+++ b/gradle/libraries.toml
@@ -116,7 +116,7 @@ http4k-bom = "org.http4k:http4k-bom:5.8.0.0"
http4k-core = { module = "org.http4k:http4k-core" }
http4k-server-undertow = { module = "org.http4k:http4k-server-undertow" }
http4k-server-jetty = { module = "org.http4k:http4k-server-jetty" }
-intellij-plugin = "org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.17.0"
+intellij-platform-plugin = "org.jetbrains.intellij.platform:intellij-platform-gradle-plugin:2.0.0-rc1"
intellij-changelog = "org.jetbrains.intellij.plugins:gradle-changelog-plugin:2.0.0"
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
diff --git a/gradle/repositories.gradle.kts b/gradle/repositories.gradle.kts
index 2db2bb618d9..a9d4b3630f5 100644
--- a/gradle/repositories.gradle.kts
+++ b/gradle/repositories.gradle.kts
@@ -24,14 +24,15 @@ listOf(pluginManagement.repositories, dependencyResolutionManagement.repositorie
includeModule("com.github.ben-manes", "gradle-versions-plugin")
includeModule("com.gradle", "develocity-gradle-plugin")
- // For org.jetbrains.intellij
- includeModule("org.jetbrains.intellij", "org.jetbrains.intellij.gradle.plugin")
- includeModule("org.jetbrains.intellij.plugins", "gradle-intellij-plugin")
+ // For org.jetbrains.intellij.platform
includeModule("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext", "gradle-idea-ext")
// For org.jetbrains.changelog
includeModule("org.jetbrains.changelog", "org.jetbrains.changelog.gradle.plugin")
includeModule("org.jetbrains.intellij.plugins", "gradle-changelog-plugin")
+
+ // For org.jetbrains.intellij.platform
+ includeModule("org.jetbrains.intellij.platform", "intellij-platform-gradle-plugin")
}
}
}
diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts
index dad6917b327..f3098f22a7b 100644
--- a/intellij-plugin/build.gradle.kts
+++ b/intellij-plugin/build.gradle.kts
@@ -1,16 +1,20 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.changelog.markdownToHTML
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+import org.jetbrains.intellij.platform.gradle.TestFrameworkType
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import java.net.URL
import java.text.SimpleDateFormat
import java.util.Date
fun properties(key: String) = project.findProperty(key).toString()
+fun isSnapshotBuild() = System.getenv("IJ_PLUGIN_SNAPSHOT").toBoolean()
+
+
plugins {
id("org.jetbrains.kotlin.jvm")
- id("org.jetbrains.intellij")
+ id("org.jetbrains.intellij.platform")
alias(libs.plugins.apollo.published)
}
@@ -21,6 +25,10 @@ repositories {
// Uncomment this one to use the Kotlin "dev" repository
// maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/") }
mavenCentral()
+
+ intellijPlatform {
+ defaultRepositories()
+ }
}
group = properties("pluginGroup")
@@ -36,27 +44,10 @@ fun getSnapshotVersionSuffix(): String {
// Set the JVM language level used to build project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain {
- (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(properties("javaVersion").toInt()))
+ languageVersion = JavaLanguageVersion.of(17)
}
}
-// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
-intellij {
- pluginName.set(properties("pluginName"))
- version.set(properties("platformVersion"))
- type.set(properties("platformType"))
-
- // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
- plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
-
- // Uncomment to use a local repository e.g. for testing not yet published versions of the GraphQL plugin
- // pluginsRepositories {
- // maven("file://${System.getProperty("user.home")}/.m2/repository")
- // // Note: using 2 repositories doesn't work currently - see https://github.com/JetBrains/gradle-intellij-plugin/issues/1292
- // // marketplace()
- // }
-}
-
val apolloDependencies = configurations.create("apolloDependencies").apply {
listOf(":apollo-annotations", ":apollo-api", ":apollo-runtime").forEach {
dependencies.add(project.dependencies.project(it, "jvmApiElements"))
@@ -64,81 +55,29 @@ val apolloDependencies = configurations.create("apolloDependencies").apply {
}
tasks {
- withType {
- kotlinOptions {
+ withType> {
+ compilerOptions {
freeCompilerArgs = listOf("-Xcontext-receivers")
}
}
- patchPluginXml {
- pluginId.set(properties("pluginId"))
- version.set(project.version.toString())
- sinceBuild.set(properties("pluginSinceBuild"))
- untilBuild.set(properties("pluginUntilBuild"))
-
- // Extract the section from README.md and provide for the plugin's manifest
- pluginDescription.set(
- projectDir.resolve("README.md").readText().lines().run {
- val start = ""
- val end = ""
-
- if (!containsAll(listOf(start, end))) {
- throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
- }
- subList(indexOf(start) + 1, indexOf(end))
- }.joinToString("\n").run { markdownToHTML(this) }
- )
-
- changeNotes.set(
- if (isSnapshotBuild()) {
- "Weekly snapshot builds contain the latest changes from the main
branch."
- } else {
- "See the release notes."
- }
- )
- }
-
- // Configure UI tests plugin
- // Read more: https://github.com/JetBrains/intellij-ui-test-robot
- runIdeForUiTests {
- systemProperty("robot-server.port", "8082")
- systemProperty("ide.mac.message.dialogs.as.sheets", "false")
- systemProperty("jb.privacy.policy.text", "")
- systemProperty("jb.consents.confirmation.enabled", "false")
-
- // Enables debug logging for the plugin
- systemProperty("idea.log.debug.categories", "Apollo")
- }
-
- runIde {
- // Enables debug logging for the plugin
- systemProperty("idea.log.debug.categories", "Apollo")
-
- // Disable hiding frequent exceptions in logs (annoying for debugging). See com.intellij.idea.IdeaLogger.
- systemProperty("idea.logger.exception.expiration.minutes", "0")
-
- // Use a custom IntelliJ installation. Set this property in your local ~/.gradle/gradle.properties file.
+ val runLocalIde by intellijPlatformTesting.runIde.registering {
+ // Use a custom IJ/AS installation. Set this property in your local ~/.gradle/gradle.properties file.
// (for AS, it should be something like '/Applications/Android Studio.app/Contents')
// See https://plugins.jetbrains.com/docs/intellij/android-studio.html#configuring-the-plugin-gradle-build-script
- if (project.hasProperty("apolloIntellijPlugin.ideDir")) {
- ideDir.set(file(project.property("apolloIntellijPlugin.ideDir")!!))
+ providers.gradleProperty("apolloIntellijPlugin.ideDir").orNull?.let {
+ localPath = file(it)
}
- // Uncomment to disable internal mode - see https://plugins.jetbrains.com/docs/intellij/enabling-internal.html
- // systemProperty("idea.is.internal", "false")
- }
+ task {
+ // Enables debug logging for the plugin
+ systemProperty("idea.log.debug.categories", "Apollo")
- signPlugin {
- certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
- privateKey.set(System.getenv("PRIVATE_KEY"))
- password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
- }
+ // Disable hiding frequent exceptions in logs (annoying for debugging). See com.intellij.idea.IdeaLogger.
+ systemProperty("idea.logger.exception.expiration.minutes", "0")
- publishPlugin {
- token.set(System.getenv("PUBLISH_TOKEN"))
- if (isSnapshotBuild()) {
- // Read more: https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel
- channels.set(listOf("snapshots"))
+ // Uncomment to disable internal mode - see https://plugins.jetbrains.com/docs/intellij/enabling-internal.html
+ // systemProperty("idea.is.internal", "false")
}
}
@@ -164,7 +103,9 @@ tasks.register("downloadMockJdk") {
val rtJar = mockJdkRoot.resolve("java/mockJDK-1.7/jre/lib/rt.jar")
if (!rtJar.exists()) {
rtJar.parentFile.mkdirs()
- rtJar.writeBytes(URL("https://github.com/JetBrains/intellij-community/raw/master/java/mockJDK-1.7/jre/lib/rt.jar").openStream().readBytes())
+ rtJar.writeBytes(URL("https://github.com/JetBrains/intellij-community/raw/master/java/mockJDK-1.7/jre/lib/rt.jar").openStream()
+ .readBytes()
+ )
}
}
}
@@ -177,19 +118,6 @@ tasks.test.configure {
systemProperty("idea.home.path", mockJdkRoot.relativeTo(project.projectDir).path)
}
-dependencies {
- implementation(project(":apollo-gradle-plugin-external"))
- implementation(project(":apollo-ast"))
- implementation(project(":apollo-tooling"))
- implementation(project(":apollo-normalized-cache-sqlite"))
- implementation(libs.sqlite.jdbc)
- implementation(libs.apollo.runtime.published)
- runtimeOnly(libs.slf4j.simple)
- testImplementation(libs.google.testparameterinjector)
-}
-
-fun isSnapshotBuild() = System.getenv("IJ_PLUGIN_SNAPSHOT").toBoolean()
-
apollo {
service("apolloDebugServer") {
packageName.set("com.apollographql.ijplugin.apollodebugserver")
@@ -207,3 +135,82 @@ tasks.configureEach {
enabled = false
}
}
+
+// IntelliJ Platform Gradle Plugin configuration
+// See https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginConfiguration
+intellijPlatform {
+ pluginConfiguration {
+ id.set(properties("pluginId"))
+ name.set(properties("pluginName"))
+ version.set(project.version.toString())
+ ideaVersion {
+ sinceBuild = properties("pluginSinceBuild")
+ untilBuild = properties("pluginUntilBuild")
+ }
+ // Extract the section from README.md and provide it to the plugin's manifest
+ description.set(
+ projectDir.resolve("README.md").readText().lines().run {
+ val start = ""
+ val end = ""
+
+ if (!containsAll(listOf(start, end))) {
+ throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
+ }
+ subList(indexOf(start) + 1, indexOf(end))
+ }.joinToString("\n").run { markdownToHTML(this) }
+ )
+ changeNotes.set(
+ if (isSnapshotBuild()) {
+ "Weekly snapshot builds contain the latest changes from the main
branch."
+ } else {
+ "See the release notes."
+ }
+ )
+ }
+
+ signing {
+ certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
+ privateKey.set(System.getenv("PRIVATE_KEY"))
+ password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
+ }
+
+ publishing {
+ token.set(System.getenv("PUBLISH_TOKEN"))
+ if (isSnapshotBuild()) {
+ // Read more: https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel
+ channels.set(listOf("snapshots"))
+ }
+ }
+
+ verifyPlugin {
+ ides {
+ recommended()
+ }
+ }
+}
+
+dependencies {
+ intellijPlatform {
+ val localIdeDir = providers.gradleProperty("apolloIntellijPlugin.ideDir").orNull
+ if (localIdeDir != null) {
+ local(localIdeDir)
+ } else {
+ create(type = properties("platformType"), version = properties("platformVersion"))
+ }
+
+ bundledPlugins(properties("platformBundledPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
+ plugins(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
+ instrumentationTools()
+ pluginVerifier()
+ testFramework(TestFrameworkType.Plugin.Java)
+ zipSigner()
+ }
+ implementation(project(":apollo-gradle-plugin-external"))
+ implementation(project(":apollo-ast"))
+ implementation(project(":apollo-tooling"))
+ implementation(project(":apollo-normalized-cache-sqlite"))
+ implementation(libs.sqlite.jdbc)
+ implementation(libs.apollo.runtime.published)
+ runtimeOnly(libs.slf4j.simple)
+ testImplementation(libs.google.testparameterinjector)
+}
diff --git a/intellij-plugin/gradle.properties b/intellij-plugin/gradle.properties
index 2e9093cbb2a..c9e15ef984b 100644
--- a/intellij-plugin/gradle.properties
+++ b/intellij-plugin/gradle.properties
@@ -1,7 +1,7 @@
# IntelliJ Platform Artifacts Repositories
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
pluginGroup=com.apollographql
-pluginName=apollo-intellij-plugin
+pluginName=Apollo GraphQL
pluginId=com.apollographql.ijplugin
pluginRepositoryUrl=https://github.com/apollographql/apollo-kotlin
@@ -17,16 +17,14 @@ platformType=IC
# Corresponds to AS Iguana 2023.2.1 -> https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
# and https://developer.android.com/studio/archive (more up to date)
# See also https://plugins.jetbrains.com/docs/intellij/android-studio.html
-platformVersion=232.10227.8
+platformVersion=2023.2.5
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
-# To find the version of a plugin relative to the platoform version, see the plugin's page on the Marketplace,
+# To find the version of a plugin relative to the platform version, see the plugin's page on the Marketplace,
# e.g. for the toml plugin: https://plugins.jetbrains.com/plugin/8195-toml/versions/stable
-platformPlugins=com.intellij.java, org.jetbrains.kotlin, com.intellij.gradle, com.intellij.lang.jsgraphql:4.0.2, org.toml.lang, org.jetbrains.android
-
-# JVM language level used to build project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
-javaVersion=17
+platformBundledPlugins=com.intellij.java, org.jetbrains.kotlin, com.intellij.gradle, org.jetbrains.android, org.toml.lang
+platformPlugins=com.intellij.lang.jsgraphql:4.0.2
# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.