intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

Should support runIde with multi-module plugin

Open Vanco opened this issue 1 month ago • 9 comments

Describe the need of your request

Let's make a multi-module plugin project DemoPlugin, it contains DemoPluginBase and DemoPluginExt mudule. The DemoPluginBase is a plugin whitch expose an extention point, and the DemoPluginExt is a plugin make use the extention point from DemoPluginBase. During the developing phese, I need to run gradle task :DemoPluginExt:runIde, how to config the plugin dependcency to make both DemoPluginBase and DemoPluginExt deploy to the .sandbox and run it?

First attempt

DemoPluginExt/build.gradle.kts

dependencies {
    implementation(project(":DemoPluginBase"))
    intellijPlatform {
        bundledPlugins("?")
        plugins("?")
     }
}

If I config like this, the DemoPluginExt will include all jar from DemoPluginBase, whitch is not what I expected.

Second attempt

DemoPluginExt/build.gradle.kts

dependencies {
    intellijPlatform {
        bundledPlugins("?")
        plugins("DemoPluginBase")
     }
}

how do I put the DemoPluginBase in the plugin dependency? because the DemoPluginBase is not release yet, it was not in repository, it is not a bundledPlugin too. where to put local-in-developing plugin in the plugin dependency?

And the sandbox only contain DemoPluginExt when I run :DemoPluginExt:runIde, should have DemoPluginBase also. sandbox

.IntelliJIDEAx0/
└── plugins
    └── DemoPluginExt
        └── lib
            │   ...

Proposed solution

DemoPluginExt/build.gradle.kts

dependencies {
    intellijPlatform {
        bundledPlugins("?")
        plugins(project(":DemoPluginBase"))
     }
}

sandbox

.IntelliJIDEAx0/
└── plugins
    └── DemoPluginBase
        └── lib
             │   ...
    └── DemoPluginExt
        └── lib
            │   ...

Alternatives you've considered

No response

Additional context

No response

Vanco avatar May 14 '24 03:05 Vanco

@Vanco Thank you for filing the issue!

In the 2.0.0-SNAPSHOT release you'll find the latest changes that include localPlugin helper, which can be used as follows:

dependencies {
    intellijPlatform {
        // use ProjectDependency
        localPlugin(project(":DemoPluginBase"))

        // use a File/String/Directory to pass a directory with extracted plugin
        localPlugin("/path/to/plugin/")

        // use a File/String to pass a path to the plugin ZIP archive
        localPlugin("/path/to/plugin.zip")
     }
}

The same helper is also available for customizable tasks, like:

tasks {
    val runPhpStormWithLocalPlugin by registering(CustomRunIdeTask::class) {
        type = IntelliJPlatformType.PhpStorm

        plugins {
            localPlugin(...)
        }
    }
}

Please let me know, if this works for you!

hsz avatar May 14 '24 21:05 hsz

@hsz Thank you for quick respond!

I tried with localPlugin(project(":DemoPluginBase")) and it still not work. the .sandbox looks like:

.IntelliJIDEAx0/
└── plugins
    └── jarOfBase.jsr // missing plugin directory
    └── DemoPluginExt
        └── lib
            │   jarOfExt.jar

expected this structure:

.IntelliJIDEAx0/
└── plugins
    └── DemoPluginBase
        └── lib
             │   jarOfBase.jar
    └── DemoPluginExt
        └── lib
            │   jarOfExt.jar

That means: If I run :DemoPluginExt:runIde, Both :DemoPluginBase and :DemoPluginExt directory should prepared in the .IntelliJIDEAx0/pluigins directory.

Vanco avatar May 21 '24 07:05 Vanco

Could you provide a minimal reproducible example so I could test it locally?

hsz avatar May 21 '24 11:05 hsz

Sure. please use this democode. muti-plugin.zip all the jar should be in plugin-base/lib directory

screen

Vanco avatar May 22 '24 00:05 Vanco

@Vanco please try the beta3. I tried to use your plugin and looks like it is fixed.

novotnyr avatar May 24 '24 09:05 novotnyr