Attempting to make runIde work for multiple independent IDEs#8865
Attempting to make runIde work for multiple independent IDEs#8865cj-radcliff wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the capability to run the IDE for plugin development against either Android Studio or IntelliJ Community Edition, configured via a Gradle property. This is a valuable enhancement for developer flexibility. The changes primarily involve build script modifications to conditionally handle IDE versions, dependencies, and source sets. A key change is the use of reflection to interact with Android Studio-specific classes, which correctly breaks a compile-time dependency and allows the plugin to build against IntelliJ CE. My feedback includes suggestions to remove temporary debugging statements from the build script and to correct an erroneous entry in a source exclusion list.
| "io/flutter/utils/AndroidLocationProvider.java", | ||
| "io/flutter/utils/FlutterExternalSystemTaskNotificationListener.java", | ||
| "io/flutter/utils/GradleUtils.java", | ||
| "org/jetbrains/android/facet/AndroidFrameworkDetector.java" |
There was a problem hiding this comment.
The path org/jetbrains/android/facet/AndroidFrameworkDetector.java is included in the exclusion list. This class is part of the Android plugin, not a source file within this project. Including it here is incorrect and confusing, and it should be removed. The reflective access to this class in ProjectOpenActivity.java is the correct way to handle the optional dependency.
There was a problem hiding this comment.
This was the intended fix.
|
I just have some high-level questions about this:
|
… IDE targets (#8910) Adds support for running the plugin against custom target IDEs using the new [`intellijPlatformTesting`](https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-testing-extension.html) Gradle extension, introducing a new parameterized `runTarget`. ## Why not update `runIde` directly? In the new IntelliJ Platform Gradle Plugin (v2.x), the default `runIde` task is strictly bound to the main project dependency used for compilation (which is Android Studio in our project). To run against a different IDE *without* changing the compilation target (which would break compilation due to our project's hard dependencies on Android Studio APIs), the plugin requires using the `intellijPlatformTesting` extension to register a custom task. We can't easily re-target the default `runIde` task without also changing what we compile against. (And if we don't change what we compile against we're in the reflection business so we can compile in the absence of AS deps OR code splitting which is a headache; see relevant conversation in #8865.) ## Details - Registers a custom `runIde` task named `runTarget` in `build.gradle.kts`. - Added support for `-Pide` (values: `AndroidStudio`, `IntelliJ`, `Ultimate`) and `-PideV` (version string or build number) properties. - Adds a self-documenting help output to `runTarget` that lists available options and examples when run without parameters, and then exits without launching the IDE. - Updates the existing `printProductsReleases` task to include instructions on how to map its output to the new `-Pide` and `-PideV` parameters. --- ## Sample Outputs ### 1. Running `runTarget` without parameters Running the task without parameters prints a help report and stops execution. ```bash ./gradlew runTarget ============================================================ runTarget - Available Options ============================================================ Valid values for -Pide: - AndroidStudio (default) - IntelliJ (IntelliJ IDEA Community) - Ultimate (IntelliJ IDEA Ultimate) Valid values for -PideV: - Any valid version string for the selected IDE. - Examples for IntelliJ/Ultimate: 2024.1, 2024.2, 2024.3, 2025.1 - Run './gradlew printProductsReleases' to see the full list. Examples: ./gradlew runTarget -Pide=IntelliJ -PideV=2025.1 ./gradlew runTarget -Pide=Ultimate -PideV=2025.1 ============================================================ Stopping execution. Please run with parameters to launch a specific IDE. ``` ### 2. Running printProductsReleases The task now prints mapping instructions after listing the available releases. ``` ./gradlew printProductsReleases IU-261.23567.71 IU-253.31033.53 IC-252.27397.28 Mapping printProductsReleases output to ideV: - The prefix (e.g., IU-, IC-) maps to -Pide (Ultimate, IntelliJ). - The number part (e.g., 261.23567.71) maps to -PideV. - Example: IU-261.23567.71 -> -Pide=Ultimate -PideV=261.23567.71 ``` Fixes: #8909 --- Review the contribution guidelines below: - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. - [x] I've included the required information in the description above. - [x] My up-to-date information is in the `AUTHORS` file. - [x] I've updated `CHANGELOG.md` if appropriate. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide](../CONTRIBUTING.md) and the [Flutter organization contributor guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
This PR attempts to allow users to runIde with either AS or IC (Intellij community) on the command line, allowing either IDE to be properly started to do testing. There is a minor change to a java file that loads an Android plugin class at runtime. This would normally fail silently, but due to Gradle compile time constraints, this will not compile correctly as written. So it has been updated with reflection to make the execution of the class a run time instead of a compile time thing.