Should I Use patchPluginXml Or plugin.xml?

Answered

I'm confused about how we are supposed to create the plugin.xml file.

Some projects have a pre-built file in src/main/resources/META-INF/plugin.xml

e.g. https://github.com/JetBrains/intellij-platform-plugin-template/blob/master/src/main/resources/META-INF/plugin.xml

However, the docs  also say that this can generated by gradle and modified by the patchPluginXml task.

Confusingly, the template project does this also

https://github.com/JetBrains/intellij-platform-plugin-template/blob/master/build.gradle.kts#L89-L105

I don't understand the point of the patchPluginXml task if you already have a plugin.xml in the code.

Can someone explain the recommended approach and what how each should be used?

 

0
4 comments

It depends. If you never change your target platform (and thus do not plan to adjust since/until-build), then hardcoding in plugin.xml is fine.

In general, it is more flexible to let Gradle plugin handle it and override patching parameters handling in build file if necessary.

0

So are you saying that you should always have a plugin.xml file in the project and just use the plugin to update fields that can change each build?

Or are you saying that you don't actually need a plugin.xml file checked in and that you should just use the patchPluginXml task to generate it for you?

0

You absolutely _must_ have a plugin.xml in your project. The Gradle plugin just modifies some properties of it (if configured to do so and by default)

1

OK. Thanks for clearing that up for me.

0

Please sign in to leave a comment.