From 156c171c398f31e744783cb88b3ac28680d30308 Mon Sep 17 00:00:00 2001 From: BoD Date: Mon, 26 Feb 2024 18:57:57 +0100 Subject: [PATCH 01/24] Migrate to org.jetbrains.intellij.platform v2.0.0 --- build-logic/build.gradle.kts | 2 +- gradle/libraries.toml | 2 +- gradle/repositories.gradle.kts | 16 ++++++++--- intellij-plugin/build.gradle.kts | 45 +++++++++++-------------------- intellij-plugin/gradle.properties | 3 ++- 5 files changed, 33 insertions(+), 35 deletions(-) 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..14bce0f3227 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-SNAPSHOT" 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..3c51d56bbb7 100644 --- a/gradle/repositories.gradle.kts +++ b/gradle/repositories.gradle.kts @@ -24,9 +24,7 @@ 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 @@ -34,5 +32,17 @@ listOf(pluginManagement.repositories, dependencyResolutionManagement.repositorie includeModule("org.jetbrains.intellij.plugins", "gradle-changelog-plugin") } } + + exclusiveContent { + // TODO Currently, org.jetbrains.intellij.platform is only available in the snapshots repository. + // It will be available at the gradlePluginPortal when stable. + forRepository { + maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } + } + filter { + // 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..8e0d5c4e947 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -10,7 +10,7 @@ fun properties(key: String) = project.findProperty(key).toString() plugins { id("org.jetbrains.kotlin.jvm") - id("org.jetbrains.intellij") + id("org.jetbrains.intellij.platform") alias(libs.plugins.apollo.published) } @@ -21,6 +21,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") @@ -41,20 +45,10 @@ kotlin { } // 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() - // } +intellijPlatform { + pluginConfiguration { + name = properties("pluginName") + } } val apolloDependencies = configurations.create("apolloDependencies").apply { @@ -72,7 +66,7 @@ tasks { patchPluginXml { pluginId.set(properties("pluginId")) - version.set(project.version.toString()) + pluginVersion.set(project.version.toString()) sinceBuild.set(properties("pluginSinceBuild")) untilBuild.set(properties("pluginUntilBuild")) @@ -98,18 +92,6 @@ tasks { ) } - // 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") @@ -121,7 +103,7 @@ tasks { // (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")!!)) + localPath.set(file(project.property("apolloIntellijPlugin.ideDir")!!)) } // Uncomment to disable internal mode - see https://plugins.jetbrains.com/docs/intellij/enabling-internal.html @@ -178,6 +160,11 @@ tasks.test.configure { } dependencies { + intellijPlatform { + create(properties("platformType"), properties("platformVersion")) + bundledPlugins(properties("platformBundledPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) + plugins(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) + } implementation(project(":apollo-gradle-plugin-external")) implementation(project(":apollo-ast")) implementation(project(":apollo-tooling")) diff --git a/intellij-plugin/gradle.properties b/intellij-plugin/gradle.properties index 2e9093cbb2a..a3a9b3efc06 100644 --- a/intellij-plugin/gradle.properties +++ b/intellij-plugin/gradle.properties @@ -23,7 +23,8 @@ platformVersion=232.10227.8 # 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, # 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 +platformBundledPlugins=com.intellij.java, org.jetbrains.kotlin, com.intellij.gradle, org.jetbrains.android +platformPlugins=com.intellij.lang.jsgraphql:4.0.2, org.toml.lang # JVM language level used to build project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. javaVersion=17 From 5fc10589e73d832547f00d33cd055128b3ffd886 Mon Sep 17 00:00:00 2001 From: BoD Date: Mon, 26 Feb 2024 19:23:41 +0100 Subject: [PATCH 02/24] Move more configuration to intellijPlatform {} instead of customizing tasks --- intellij-plugin/build.gradle.kts | 81 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index 8e0d5c4e947..73f0dfbdbb9 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -1,3 +1,4 @@ + import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.changelog.markdownToHTML @@ -8,6 +9,9 @@ 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.platform") @@ -47,31 +51,15 @@ kotlin { // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellijPlatform { pluginConfiguration { - name = properties("pluginName") - } -} - -val apolloDependencies = configurations.create("apolloDependencies").apply { - listOf(":apollo-annotations", ":apollo-api", ":apollo-runtime").forEach { - dependencies.add(project.dependencies.project(it, "jvmApiElements")) - } -} - -tasks { - withType { - kotlinOptions { - freeCompilerArgs = listOf("-Xcontext-receivers") + id.set(properties("pluginId")) + name.set(properties("pluginName")) + version.set(project.version.toString()) + ideaVersion { + sinceBuild = properties("pluginSinceBuild") + untilBuild = properties("pluginUntilBuild") } - } - - patchPluginXml { - pluginId.set(properties("pluginId")) - pluginVersion.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( + // 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 = "" @@ -82,7 +70,6 @@ tasks { 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." @@ -92,6 +79,34 @@ tasks { ) } + 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")) + } + } +} + +val apolloDependencies = configurations.create("apolloDependencies").apply { + listOf(":apollo-annotations", ":apollo-api", ":apollo-runtime").forEach { + dependencies.add(project.dependencies.project(it, "jvmApiElements")) + } +} + +tasks { + withType { + kotlinOptions { + freeCompilerArgs = listOf("-Xcontext-receivers") + } + } + runIde { // Enables debug logging for the plugin systemProperty("idea.log.debug.categories", "Apollo") @@ -110,20 +125,6 @@ tasks { // systemProperty("idea.is.internal", "false") } - signPlugin { - certificateChain.set(System.getenv("CERTIFICATE_CHAIN")) - privateKey.set(System.getenv("PRIVATE_KEY")) - password.set(System.getenv("PRIVATE_KEY_PASSWORD")) - } - - 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")) - } - } - // Log tests withType { testLogging { @@ -175,8 +176,6 @@ dependencies { testImplementation(libs.google.testparameterinjector) } -fun isSnapshotBuild() = System.getenv("IJ_PLUGIN_SNAPSHOT").toBoolean() - apollo { service("apolloDebugServer") { packageName.set("com.apollographql.ijplugin.apollodebugserver") From 9570a159a14f670f3e316184baa871f7ac18609d Mon Sep 17 00:00:00 2001 From: BoD Date: Tue, 27 Feb 2024 15:44:04 +0100 Subject: [PATCH 03/24] Fix verifyPlugin --- .github/workflows/pr.yml | 6 +++--- intellij-plugin/build.gradle.kts | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) 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/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index 73f0dfbdbb9..e0010f012dd 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -92,6 +92,12 @@ intellijPlatform { channels.set(listOf("snapshots")) } } + + verifyPlugin { + ides { + recommended() + } + } } val apolloDependencies = configurations.create("apolloDependencies").apply { @@ -162,9 +168,10 @@ tasks.test.configure { dependencies { intellijPlatform { - create(properties("platformType"), properties("platformVersion")) + 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)) + pluginVerifier() } implementation(project(":apollo-gradle-plugin-external")) implementation(project(":apollo-ast")) From 630f9c5d2ac8614d2efbb97b01a3cfd717458b3a Mon Sep 17 00:00:00 2001 From: BoD Date: Tue, 27 Feb 2024 16:29:21 +0100 Subject: [PATCH 04/24] Move dependencies before intellijPlatform so verifyPlugin works --- intellij-plugin/build.gradle.kts | 104 +++++++++++++++---------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index e0010f012dd..7488d498591 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -48,58 +48,6 @@ kotlin { } } -// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html -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() - } - } -} - val apolloDependencies = configurations.create("apolloDependencies").apply { listOf(":apollo-annotations", ":apollo-api", ":apollo-runtime").forEach { dependencies.add(project.dependencies.project(it, "jvmApiElements")) @@ -200,3 +148,55 @@ tasks.configureEach { enabled = false } } + +// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html +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() + } + } +} From 9ceecccb18725191993cb75fbccb44f15c0c1d41 Mon Sep 17 00:00:00 2001 From: BoD Date: Wed, 28 Feb 2024 12:22:06 +0100 Subject: [PATCH 05/24] Move dependencies back at the bottom and add pluginVerifier() dependencies --- intellij-plugin/build.gradle.kts | 35 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index 7488d498591..93853535457 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -114,23 +114,6 @@ tasks.test.configure { systemProperty("idea.home.path", mockJdkRoot.relativeTo(project.projectDir).path) } -dependencies { - intellijPlatform { - 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)) - pluginVerifier() - } - 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) -} - apollo { service("apolloDebugServer") { packageName.set("com.apollographql.ijplugin.apollodebugserver") @@ -200,3 +183,21 @@ intellijPlatform { } } } + +dependencies { + intellijPlatform { + 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() + } + 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) +} From bb7f1d92954aefbe50facd18b75a662645d9b4cc Mon Sep 17 00:00:00 2001 From: BoD Date: Mon, 4 Mar 2024 11:18:54 +0100 Subject: [PATCH 06/24] Add testFramework() to dependencies --- intellij-plugin/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index 93853535457..ef7ff251521 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -191,6 +191,7 @@ dependencies { plugins(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) instrumentationTools() pluginVerifier() + testFramework() } implementation(project(":apollo-gradle-plugin-external")) implementation(project(":apollo-ast")) From bac7a6e0fe0144cf870dbd726d68c09499638458 Mon Sep 17 00:00:00 2001 From: BoD Date: Wed, 17 Apr 2024 11:17:45 +0200 Subject: [PATCH 07/24] Bump to 2.0.0-beta1 --- gradle/libraries.toml | 2 +- gradle/repositories.gradle.kts | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/gradle/libraries.toml b/gradle/libraries.toml index 14bce0f3227..0683f970336 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-platform-plugin = "org.jetbrains.intellij.platform:intellij-platform-gradle-plugin:2.0.0-SNAPSHOT" +intellij-platform-plugin = "org.jetbrains.intellij.platform:intellij-platform-gradle-plugin:2.0.0-beta1" 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 3c51d56bbb7..a9d4b3630f5 100644 --- a/gradle/repositories.gradle.kts +++ b/gradle/repositories.gradle.kts @@ -30,16 +30,7 @@ listOf(pluginManagement.repositories, dependencyResolutionManagement.repositorie // For org.jetbrains.changelog includeModule("org.jetbrains.changelog", "org.jetbrains.changelog.gradle.plugin") includeModule("org.jetbrains.intellij.plugins", "gradle-changelog-plugin") - } - } - exclusiveContent { - // TODO Currently, org.jetbrains.intellij.platform is only available in the snapshots repository. - // It will be available at the gradlePluginPortal when stable. - forRepository { - maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } - } - filter { // For org.jetbrains.intellij.platform includeModule("org.jetbrains.intellij.platform", "intellij-platform-gradle-plugin") } From 523cedb6b660760dc25c5d14ea9cc06207fbf709 Mon Sep 17 00:00:00 2001 From: BoD Date: Wed, 17 Apr 2024 11:36:31 +0200 Subject: [PATCH 08/24] Add .intellijPlatform to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From 8034bfa5b4ee97e3bdf327a0bf48f8ecc2610dce Mon Sep 17 00:00:00 2001 From: BoD Date: Wed, 17 Apr 2024 11:41:11 +0200 Subject: [PATCH 09/24] Fix testFramework and toml plugin --- intellij-plugin/build.gradle.kts | 3 ++- intellij-plugin/gradle.properties | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index ef7ff251521..38074add3c8 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -2,6 +2,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.changelog.markdownToHTML +import org.jetbrains.intellij.platform.gradle.extensions.TestFrameworkType import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.net.URL import java.text.SimpleDateFormat @@ -191,7 +192,7 @@ dependencies { plugins(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty)) instrumentationTools() pluginVerifier() - testFramework() + testFramework(TestFrameworkType.Plugin.Java) } implementation(project(":apollo-gradle-plugin-external")) implementation(project(":apollo-ast")) diff --git a/intellij-plugin/gradle.properties b/intellij-plugin/gradle.properties index a3a9b3efc06..dc3ae85b5e3 100644 --- a/intellij-plugin/gradle.properties +++ b/intellij-plugin/gradle.properties @@ -21,10 +21,10 @@ platformVersion=232.10227.8 # 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 -platformBundledPlugins=com.intellij.java, org.jetbrains.kotlin, com.intellij.gradle, org.jetbrains.android -platformPlugins=com.intellij.lang.jsgraphql:4.0.2, org.toml.lang +platformBundledPlugins=com.intellij.java, org.jetbrains.kotlin, com.intellij.gradle, org.jetbrains.android, org.toml.lang +platformPlugins=com.intellij.lang.jsgraphql:4.0.2 # JVM language level used to build project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. javaVersion=17 From 58cf4b99334bb938686be6a1d91633d1b1c0c792 Mon Sep 17 00:00:00 2001 From: BoD Date: Wed, 17 Apr 2024 14:43:35 +0200 Subject: [PATCH 10/24] Fix plugin name in descriptor --- intellij-plugin/build.gradle.kts | 14 ++++++++------ intellij-plugin/gradle.properties | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index 38074add3c8..b36889fad02 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -1,9 +1,8 @@ - import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.changelog.markdownToHTML import org.jetbrains.intellij.platform.gradle.extensions.TestFrameworkType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask import java.net.URL import java.text.SimpleDateFormat import java.util.Date @@ -56,8 +55,8 @@ val apolloDependencies = configurations.create("apolloDependencies").apply { } tasks { - withType { - kotlinOptions { + withType> { + compilerOptions { freeCompilerArgs = listOf("-Xcontext-receivers") } } @@ -102,7 +101,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() + ) } } } @@ -133,7 +134,8 @@ tasks.configureEach { } } -// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html +// 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")) diff --git a/intellij-plugin/gradle.properties b/intellij-plugin/gradle.properties index dc3ae85b5e3..b040e135041 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 From e89a428dd2125ece7068ab5315db7672993fafd6 Mon Sep 17 00:00:00 2001 From: BoD Date: Wed, 17 Apr 2024 15:59:06 +0200 Subject: [PATCH 11/24] Add zipSigner() to dependencies --- intellij-plugin/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/intellij-plugin/build.gradle.kts b/intellij-plugin/build.gradle.kts index b36889fad02..dc04c0cc786 100644 --- a/intellij-plugin/build.gradle.kts +++ b/intellij-plugin/build.gradle.kts @@ -195,6 +195,7 @@ dependencies { instrumentationTools() pluginVerifier() testFramework(TestFrameworkType.Plugin.Java) + zipSigner() } implementation(project(":apollo-gradle-plugin-external")) implementation(project(":apollo-ast")) From 864d75105113a23abd9a80f22fea3ccd4052ef3c Mon Sep 17 00:00:00 2001 From: BoD Date: Fri, 19 Apr 2024 12:06:29 +0200 Subject: [PATCH 12/24] Add a runLocalIde task that uses the apolloIntellijPlugin.ideDir property --- .idea/runConfigurations/Run_IntelliJ_plugin.xml | 5 +++-- intellij-plugin/build.gradle.kts | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) 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 @@