Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to IntelliJ Platform Gradle Plugin 2.0 #879

Merged

Conversation

citizenmatt
Copy link
Member

@citizenmatt citizenmatt commented May 9, 2024

This PR migrates to the new IntelliJ Platform Gradle Plugin 2.0 (beta2). This is necessary to target 242, and also allows us to use "split mode" to reproduce and debug remote development issues. It's also easier to configure, and makes it easy to run the plugin in a different IDE, even locally built or installed IDEs.

It is still a work in progress, and not yet ready to merge. I will be actively updating and force-pushing changes into this branch.

The following build features work as expected:

  • Build, run and debug the plugin, including loading the AceJump (optional) dependency
  • Build, run and debug :test, vim-engine:test, and java-tests:test
  • Separately run long-running-tests and property-tests (there are failures, but these match master)
  • Plugin verifier runs with a default IDE based on the configured settings (using the since-build value, so it's testing 241). The task name has changed from runPluginVerifier to verifyPlugin.
  • Updated "IdeaVim full verification" run configuration to use new verifyPlugin task name
  • Updated TC config files to use new verifyPlugin task name
  • Updated GitHub actions to use new testIdeUi task instead of previous runIdeForUiTests task name
  • The source jar file is built and correctly copied to the lib/src folder.
    However, the task has been renamed from createOpenApiSourcesJar to sourcesJar, and the filename is now IdeaVIM-{version}-sources.jar instead of IdeaVIM-{version}-src.jar. This reflects the behaviour of the task set up with the Gradle java.withSourcesJar() helper in the vim-engine module. The file is still created in the lib/src folder, and as the documentation states, there are no strict naming rules for the files in this directory. This task does not appear to be called externally, and the buildPlugin task's dependency has been updated to reflect the new name.
  • A new runIdeSplitMode task and equivalent "Start IJ with IdeaVim (Split Mode)" run configuration have been added, to run the IDE in split mode, with the plugin loaded in the frontend, as per remote dev/CWM.
    Split mode requires 242+ and the project is currently targeting 241. This task runs the current EAP, specified by version in gradle.properties. This version number will be updated for each EAP until 2024.2 is released. Once IdeaVim targets 2024.2, we can remove this version and let the runIdeSplitMode run with the version it is compiled against.
  • Remove the since-build value from plugin.xml. It is now handled by the Gradle plugin, and is now in the format {branch}.{build}. We would previously specify the third minor component, but this is not necessary (it might be different between IDEs).
  • Remove the since-build value from build.gradle.kts. The patchPluginXml uses the default value from the target IDE dependency.
  • The until-build value is not written to plugin.xml, as before.
  • UI tests aren't currently running. The download robot task is commented out, as it should be moved to a normal dependency. The UI test task is not yet supported by the gradle plugin.

Other changes:

  • settings.gradle has been migrated to settings.gradle.kts
  • The Gradle plugin writes various files to .intellijPlatform/ (Ivy XML files to reference bundled plugins, etc.) This folder is added to .gitignore
  • The CodeQL autobuild GitHub action needs a hint to choose the appropriate JVM version; it can't resolve the by project property IdeaVim uses to specify the sourceCompatibility version in gradle.properties.
    By default it will choose the lowest version supported by the used version of Gradle, which means version 11. We add a comment in build.gradle.kts as a hint to help it choose the right version. This is not a new problem, but only causes an issue now because the new plugin has dependencies that require version 17, and won't resolve otherwise. We should perhaps look at whether we should just hard code the value in build.gradle.kts instead of specifying it in gradle.properties and then repeating it in the hint comment, or we replace the autobuild action with an action that explicitly specifies the version.
  • The build.gradle.kts file has commented out runIdeCustom and runIdeLocal that can be edited and used to run the plugin in a different IDE, or to run the plugin in a locally installed IDE.

Misc (not blockers):

  • Remove temporary build feature to disable "binary releases" because the DevKit plugin (on the IdeaVim developer's machine) cannot currently download sources for binary releases. Will be removed once DevKit has been updated in 241 + 242

build.gradle.kts Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
build.gradle.kts Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
@citizenmatt citizenmatt force-pushed the feature/gradle-intellij-plugin-v2 branch 6 times, most recently from f274fff to 5356fed Compare May 15, 2024 10:52
@citizenmatt citizenmatt force-pushed the feature/gradle-intellij-plugin-v2 branch from 5356fed to 2ec7a33 Compare May 23, 2024 16:00
@AlexPl292
Copy link
Member

As a not, we HAVE to use 2.0 to target 242: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#usage

@citizenmatt citizenmatt force-pushed the feature/gradle-intellij-plugin-v2 branch 5 times, most recently from 99b47a3 to 8b0a60b Compare June 3, 2024 16:16
@citizenmatt citizenmatt force-pushed the feature/gradle-intellij-plugin-v2 branch from 8b0a60b to 636ac29 Compare June 10, 2024 19:53
@citizenmatt citizenmatt force-pushed the feature/gradle-intellij-plugin-v2 branch 6 times, most recently from b5fa0bc to b9c787c Compare June 12, 2024 17:17
@citizenmatt citizenmatt marked this pull request as ready for review June 12, 2024 17:18
@citizenmatt citizenmatt changed the title WIP: Migrate to IntelliJ Platform Gradle Plugin 2.0 Migrate to IntelliJ Platform Gradle Plugin 2.0 Jun 12, 2024
Also updates the GitHub workflows to use the new name for the testIdeUi task, and the TeamCity files to use the new name for the VerifyPlugin task
The autobuilder action can't resolve the 'by project' property to know what our source compatibility is, so we need to give it a hint. If we don't, it will assume the lowest version compatible with the current version of Gradle, which right now is 11.

This value doesn't have to match the `javaVersion` property, but has to allow us to resolve dependencies. Currently, we require at least version 17.
Let the Gradle plugin manage since-build, based on our target compile version. We leave until-build open ended
@citizenmatt citizenmatt force-pushed the feature/gradle-intellij-plugin-v2 branch from b9c787c to 5eb0fae Compare June 17, 2024 10:19
@citizenmatt
Copy link
Member Author

OK. I'm happy for this to merge. All tasks are migrated and working as expected. There are a couple of minor tweaks to be made as things progress, but there's nothing blocking merge.

@AlexPl292 AlexPl292 enabled auto-merge June 21, 2024 13:31
@AlexPl292 AlexPl292 disabled auto-merge June 21, 2024 13:31
@AlexPl292 AlexPl292 merged commit 86bbb28 into JetBrains:master Jun 21, 2024
2 of 3 checks passed
@AlexPl292
Copy link
Member

That's a big refactoring! Thank you!

@citizenmatt citizenmatt deleted the feature/gradle-intellij-plugin-v2 branch June 21, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants