pf4j / pf4j-update

Update mechanism for PF4J
Apache License 2.0
69 stars 39 forks source link

Automatically download plugin dependencies from repositories (Fix #22) #59

Open DRSchlaubi opened 2 years ago

DRSchlaubi commented 2 years ago

This is my initial attempt at implementing #22, any suggestions

Another way to solve this, would probably be to Download the plugin first, then inspect the manifest and download the plugins through that

decebals commented 2 years ago

@DRSchlaubi Sorry for delay and thank you for contribution. The idea is good, the implementation is OK. What I don't like is the part with add dependencies in PluginInfo (and in XML). The plugin's dependencies in my opinion should be discovered at runtime, using DependencyResolver existed in PF4J core, as I said in https://github.com/pf4j/pf4j-update/issues/22. It's hard to maintain (edit by hand) the dependencies available in plugins.json. I will take a look to see if I can extract this information at runtime.

DRSchlaubi commented 2 years ago

It's hard to maintain (edit by hand) the dependencies available in plugins.json.

I just wrote a Gradle plugin generating the complete plugins.json, so I guess I didn't think about that too much

decebals commented 2 years ago

It's hard to maintain (edit by hand) the dependencies available in plugins.json.

I just wrote a Gradle plugin generating the complete plugins.json, so I guess I didn't think about that too much

Interesting. Can you tell me more about this plugin? Is it open source, is it available for use by anyone?

In fact, I think that I am (very) curios how other people/projects maintain information about the available plugins (plugins.json) 😄.

DRSchlaubi commented 2 years ago

It's a work in progress, but it's here: https://github.com/DRSchlaubi/mikbot/tree/main/gradle-plugin It's currently not in the Gradle plugin portal because I got tired after working on it for 6 hrs, but it will be eventually

it can generate the plugin.properties file almost automatically id is the gradle module name, dependencies are inferred from from the actual module dependencies, as there is a plugin and optionalPlugin dependency config, version is also inferred from the module

It also supports making a repository by geenerating a local repository

My CI clones the existing repo which is a branch with GH Pages on it, then add ne new versions to it and generate the plugins.json and push it to the branch again Ci is here: https://github.com/DRSchlaubi/mikbot/blob/main/.github/workflows/ci.yaml#L58-L93

DRSchlaubi commented 2 years ago

The plugin should now be available to all Gradle users. docs are here: https://github.com/DRSchlaubi/mikbot/tree/main/gradle-plugin