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

Rename plugin.json to use composer.json #5921

Open
mattab opened this issue Aug 4, 2014 · 17 comments
Open

Rename plugin.json to use composer.json #5921

mattab opened this issue Aug 4, 2014 · 17 comments
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@mattab
Copy link
Member

mattab commented Aug 4, 2014

Currently, plugins have to define a plugin.json doc

Goal of this ticket is to reuse composer.json file, instead of asking user to create plugin.json as well as composer.json

Tasks

  • change ExamplePlugin
  • update developer guides
  • update Marketplace logic
  • keep Backward Compability
  • maybe provide script to change plugin.json to composer.json to all core plugins (or manually)
@mattab mattab added this to the Short term milestone Aug 4, 2014
@ThaDafinser
Copy link
Contributor

+1
Additional benefits:

@ThaDafinser
Copy link
Contributor

Also what to think about:
Symfony + ZF have a really good bundle/module structure.

E.g. currently it looks a bit weired me to add a test folder in the root of the piwik plugin structure.

http://modules.zendframework.com/
https://github.com/doctrine/DoctrineModule
http://knpbundles.com/

@tsteur
Copy link
Member

tsteur commented Aug 15, 2014

When doing this we should also update all of our plugins to use composer.json instead of the getInformation() method in the plugin class.

@mattab mattab added the c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. label Sep 9, 2014
@mnapoli
Copy link
Contributor

mnapoli commented Oct 29, 2014

Does this issue covers installing plugins from composer instead of submodules too?

Because we could use http://composer.github.io/installers/ which already exists for Piwik (https://github.com/composer/installers/blob/master/src/Composer/Installers/PiwikInstaller.php). The problem I see is that plugins require "piwik", so if piwik requires some plugins which in turn require piwik, we've got a nice loop.

Anyway maybe I'm off-topic, but I'd love to get rid of submodules and maybe this could be done at the same time.

@mattab
Copy link
Member Author

mattab commented Oct 29, 2014

Does this issue covers installing plugins from composer instead of submodules too?

No it's out of scope for the issue, but it's very important topic. This is related to misc-EnterpriseComposerFiles repo. Maybe we can create a new issue to discuss how this should be done in perfect world? It's not high priority but in December I think we should start working on it.

@mnapoli
Copy link
Contributor

mnapoli commented Oct 29, 2014

OK make sense.

However we need to keep in mind that if we rename plugin.json to composer.json, then all plugins will be incompatible with any future work to make them installable with Composer. That's because all plugins will require piwik/piwik in composer.json, so if piwik/piwik requires them, then there's a loop.

So if later we want to install plugins with composer, we will need to modify every plugin's composer.json.

I don't have a better alternative to suggest, I just want to point that out. Maybe it's not such a big deal.

@tsteur
Copy link
Member

tsteur commented Oct 29, 2014

We will most likely not use composer itself to install plugins in the near future as it might require an internet connection to fetch dependencies etc. Plugins should not require piwik/piwik anyway and we could simply remove it as you said.

@mnapoli
Copy link
Contributor

mnapoli commented Oct 29, 2014

We will most likely not use composer itself to install plugins in the near future as it might require an internet connection to fetch dependencies etc.

I don't see the difference with today. First, before packaging we have plugins embedded in the repo an plugins in git submodules: submodules could be replaced by composer. That's a win for us and doesn't change a thing in production where there might not be internet. Then once Piwik is in production we can either download plugins through the marketplace or install them manually. The last one wouldn't change, so it doesn't matter if there is no internet. And downloading plugins through the marketplace could (or not) use composer too.

In any way, composer could replace submodules without affecting production, wether there is internet or not.

@tsteur
Copy link
Member

tsteur commented Oct 29, 2014

What would be the advantages of using composer instead of submodules? Would it make it easier to handle refactorings across the code base including submodules? => This is may main problem with submodules but doesn't change it with composer I think. It might be even rather less work with submodules. Currently, we have to create a branch of piwik/piwik as well as each submodule for this.

@tsteur
Copy link
Member

tsteur commented Oct 29, 2014

Also installing a plugin is currently only unzipping a ZIP file basically... So not sure if much advantage with composer

@tsteur
Copy link
Member

tsteur commented Oct 29, 2014

I think we will have to discuss in different issues as it is different for core plugins that are currently managed via submodules and 3rd party plugins and 3rd party plugins on the marketplace. It brings different advantages / disadvantages etc. Otherwise we might talk about different things but mean the same and we might get confused :)

@mattab mattab modified the milestones: Short term, Mid term Dec 18, 2014
@quba
Copy link
Contributor

quba commented Aug 4, 2015

@mattab can we maybe implement this one in Piwik 3.0?

@mattab mattab modified the milestones: 3.0.0, Mid term Aug 9, 2015
@mattab
Copy link
Member Author

mattab commented Aug 11, 2015

it would be a useful improvement to the platform @quba let's try it!

@mattab mattab added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Oct 1, 2015
@mattab mattab removed the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Jul 8, 2016
@mattab mattab modified the milestones: Mid term, 3.0.0 Jul 8, 2016
@ThaDafinser
Copy link
Contributor

Another benefit: i tend to forget to change the version in plugin.json - since i'm so used to only create a tag like it work at composer/packagist

ThaDafinser/Piwik-IntranetGeoIP#25

@tsteur
Copy link
Member

tsteur commented Sep 1, 2016

I totally agree. Managing the version in plugin.json is a bit of a pain especially since someone has to tag it anyway. Problem is when a plugin is not published via github it will need a version in the plugin.json. What we could likely do is, if "version" in plugin.json is missing, we use the github release tag. If version is present, we use that version.

@tsteur
Copy link
Member

tsteur commented Sep 1, 2016

I will have a look and see if this is easy to implement next week

@tsteur
Copy link
Member

tsteur commented Sep 1, 2016

@ThaDafinser it is actually not trivial to remove the version from plugin.json. Problem is that our core and plugin updates are defined by a plugin version number, eg 2.1.4.php. The core knows in the option DB table which plugin version is currently installed and when the plugin version changes, it will install all missing updates and update the record in the option table. We could add the version number on the Marketplace but this wouldn't help when actually developing the plugin or when using the plugin directly from git etc. It would basically become almost impossible to test plugin updates as a developer etc. Eventually we need to change that in #5985 . The update files should be based on a timestamp or it should at least know which updates have been inserted already etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

5 participants