diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a82ede3e..a04c205a4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -233,6 +233,23 @@ name and contact info to the [AUTHORS](AUTHORS) file. - Expand `Edit configuration templates...` and verify that Flutter is present. - Click [+] and verify that Flutter is present. +### Running against custom target IDEs + +To test or debug the plugin against a different IDE target (like IntelliJ IDEA Community or Ultimate) without changing the project's compilation target, you can use the custom `runTarget` Gradle task. + +Run it from the command line specifying the target IDE and version: +```bash +./gradlew runTarget -Pide=IntelliJ -PideV=2025.1 +``` + +* **`-Pide`**: Valid values are `AndroidStudio` (default), `IntelliJ` (Community), and `Ultimate`. +* **`-PideV`**: Any valid version string or build number for the selected IDE. + +To see a full list of available options and usage examples, run the task without any parameters: +```bash +./gradlew runTarget +``` + ## Provision Tool This is not currently required. However, for debugging unit tests, it may be handy; please ignore for now. diff --git a/build.gradle.kts b/build.gradle.kts index 992f124b9..81d8be9f2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -389,12 +389,18 @@ tasks { // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-faq.html#how-to-check-the-latest-available-eap-release tasks { printProductsReleases { - channels = listOf(ProductRelease.Channel.EAP) - types = listOf(IntelliJPlatformType.IntellijIdeaCommunity) + channels = listOf(ProductRelease.Channel.RELEASE, ProductRelease.Channel.EAP) + types = listOf(IntelliJPlatformType.IntellijIdeaCommunity, IntelliJPlatformType.IntellijIdeaUltimate) untilBuild = provider { null } doLast { productsReleases.get().max() + println() + println("Mapping printProductsReleases output to ideV:") + println(" - The prefix (e.g., IU-, IC-) maps to -Pide (Ultimate, IntelliJ).") + println(" - The number part (e.g., 261.23567.71) maps to -PideV.") + println(" - Example: IU-261.23567.71 -> -Pide=Ultimate -PideV=261.23567.71") + println() } } prepareJarSearchableOptions { @@ -415,6 +421,53 @@ tasks { } } +intellijPlatformTesting { + runIde { + register("runTarget") { + val target = project.findProperty("ide") as? String + val version = project.findProperty("ideV") as? String + + val actualTarget = target ?: "AndroidStudio" + type = when (actualTarget) { + "IntelliJ" -> IntelliJPlatformType.IntellijIdeaCommunity + "Ultimate" -> IntelliJPlatformType.IntellijIdeaUltimate + else -> IntelliJPlatformType.AndroidStudio + } + this.version = version ?: ideaVersion + } + } +} + +tasks.named("runTarget") { + val target = project.findProperty("ide") as? String + val version = project.findProperty("ideV") as? String + + doFirst { + if (target == null && version == null) { + println("============================================================") + println("runTarget - Available Options") + println("============================================================") + println("Valid values for -Pide:") + println(" - AndroidStudio (default)") + println(" - IntelliJ (IntelliJ IDEA Community)") + println(" - Ultimate (IntelliJ IDEA Ultimate)") + println() + println("Valid values for -PideV:") + println(" - Any valid version string for the selected IDE.") + println(" - Examples for IntelliJ/Ultimate: 2024.1, 2024.2, 2024.3, 2025.1") + println(" - Run './gradlew printProductsReleases' to see the full list.") + println() + println("Examples:") + println(" ./gradlew runTarget -Pide=IntelliJ -PideV=2025.1") + println(" ./gradlew runTarget -Pide=Ultimate -PideV=2025.1") + println("============================================================") + println("Stopping execution. Please run with parameters to launch a specific IDE.") + + throw org.gradle.api.tasks.StopExecutionException() + } + } +} + // A task to print the classpath used for compiling an IntelliJ plugin // Run with `./gradlew printCompileClasspath --no-configuration-cache ` tasks.register("printCompileClasspath") {