JetBrains / intellij-platform-gradle-plugin

Gradle plugin for building plugins for IntelliJ-based IDEs
https://plugins.jetbrains.com/docs/intellij/gradle-prerequisites.html
Apache License 2.0
1.4k stars 270 forks source link

Cannot use EAP snapshots in 2.0.0-beta5 #1638

Open rybak opened 1 month ago

rybak commented 1 month ago

What happened?

Timeline for context

  1. My plugin failed compatibility verification for IntelliJ build 242.10180.25
  2. I got very confused, but eventually figured out that I need to migrate from "Gradle IntelliJ Plugin 1.14.1" to the "IntelliJ Platform Gradle Plugin".
  3. I started the migration with 2.0.0-beta4 and then switched to 2.0.0-beta5.
  4. Eventually I managed to build my plugin against IntelliJ IDEA Community 2024.1.2.

Problem

I'm trying to ensure that my plugin will be compatible with IntelliJ 2024.2 (which hasn't been released yet), but using EAP builds with the new plugin (2.0.0-beta5) fails.

Relevant log output or stack trace

* What went wrong:
Could not determine the dependencies of task ':buildSearchableOptions'.
> Failed to query the value of task ':buildSearchableOptions' property 'runtimeDirectory'.
   > No IntelliJ Platform dependency found.
     Please ensure there is a single IntelliJ Platform dependency defined in your project and that the necessary repositories, where it can be located, are added.
     See: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html

Steps to reproduce

  1. Specify 242.12881.66-EAP-SNAPSHOT (built on 2024-05-29 06:22:58 UTC, see snapshot repository), as a platform dependency in the Gradle build script:

    repositories { mavenCentral() intellijPlatform { defaultRepositories() } } dependencies { intellijPlatform { create("IC", "242.12881.66-EAP-SNAPSHOT") ... } }

  2. Run ./gradlew --refresh-dependencies clean buildPlugin

Gradle IntelliJ Plugin version

2.0.0-beta5

Gradle version

8.7

Operating System

Linux

Link to build, i.e. failing GitHub Action job

No response

PawelLipski commented 1 month ago

FWIW, you can check my PRs https://github.com/VirtusLab/git-machete-intellij-plugin/pull/1846, https://github.com/VirtusLab/git-machete-intellij-plugin/pull/1859. Still, I haven't got verifyPlugin to work as it did in 1.x yet (https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/1637).

hsz commented 1 month ago

In the changelog of beta2, it was noted that we're switching to CDN as a primary source of IntelliJ Platform archives. To switch back to IJ Maven repository, use the following Gradle property:

org.jetbrains.intellij.platform.buildFeature.useBinaryReleases=false

This mechanism is still under development and looking at the feedback, I have to make more transparent.

rybak commented 1 month ago

Thank you! Adding the property to the command:

$ ./gradlew -Porg.jetbrains.intellij.platform.buildFeature.useBinaryReleases=false buildPlugin

fixes the build for me!

ahus1 commented 1 month ago

I tried the option org.jetbrains.intellij.platform.buildFeature.useBinaryReleases to get the EAP working, but once I do that, the plugin doesn't use the JetBrains runtime any more when running ./gradlew clean runIde

Instead, it starts the IDE with the JDK I'm using to build the plugin. Due to that, JCEF isn't present, which I need for my developing parts of my plugin.

Reproducible in the template project on the 2.0.0 branch which is currently on 2.0.0-beta5 by running

./gradlew -Porg.jetbrains.intellij.platform.buildFeature.useBinaryReleases=false clean runIde

Is there a way to use the EAP build with the JBR and JCEF?

hsz commented 3 weeks ago

You need to add a dependency on JCEF explicitly.

dependencies {
  intellijPlatform {
    ...
    jetbrainsRuntime()
  }
}
ahus1 commented 3 weeks ago

Thank you @hsz for the answer. After adding it also to the repository, it now works for me as expected. With the keyword from your answer I also found the matching docs page.

I'm still a little surprised I need to specify JBR manually instead of using it manually, as I wouldn't know which other runtime I would use as a plugin developer when running a plugin.