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

Should support runIde with multi-module plugin #1620

Open
Vanco opened this issue May 14, 2024 · 8 comments
Open

Should support runIde with multi-module plugin #1620

Vanco opened this issue May 14, 2024 · 8 comments
Assignees
Milestone

Comments

@Vanco
Copy link

Vanco commented May 14, 2024

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

@hsz hsz added this to the 2.0.0-beta3 milestone May 14, 2024
@hsz hsz self-assigned this May 14, 2024
hsz added a commit that referenced this issue May 14, 2024
…as project dependencies and extending customizable tasks #1620
@hsz
Copy link
Member

hsz commented May 14, 2024

@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!

@Vanco
Copy link
Author

Vanco commented May 21, 2024

@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.

@hsz
Copy link
Member

hsz commented May 21, 2024

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

@Vanco
Copy link
Author

Vanco commented May 22, 2024

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

screen

@novotnyr
Copy link
Contributor

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

@Vanco
Copy link
Author

Vanco commented May 29, 2024

@novotnyr I tried, and the issue still there.

I think you don't really understand the issue. Let me explain the problem to you in detail.
The plugin-base contain four jars in the plugin:

plugin-base
        └── lib
             │   batik-all-1.17.jar
             │   plugin-base-1.0-SNAPSHOT-instrumented.jar
             │   xml-apis-ext-1.3.04.jar
             │   xmlgraphics-commons-2.9.jar

and the plugin-ext contain one jars in the plugin:

plugin-ext
        └── lib
            │   plugin-ext-1.0-SNAPSHOT-instrumented.jar

When it deployed into the .sandbox, The structure we expect:

.IntelliJIDEAx0/
└── plugins
    └── plugin-base
        └── lib
             │   batik-all-1.17.jar
             │   plugin-base-1.0-SNAPSHOT-instrumented.jar
             │   xml-apis-ext-1.3.04.jar
             │   xmlgraphics-commons-2.9.jar
    └── plugin-ext
        └── lib
            │   plugin-ext-1.0-SNAPSHOT-instrumented.jar

@Vanco
Copy link
Author

Vanco commented May 29, 2024

@YannCebron please see my post above.

the 2.0.0-beta3, the .sandbox looks like this
issue-plugin-structrue
int this way, the plugin-base will have classloader issue.

@Vanco
Copy link
Author

Vanco commented Jun 4, 2024

@YannCebron any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants