Language and development rules: Difference between revisions

Jump to navigation Jump to search
m
Tag: 2017 source edit
Tag: 2017 source edit
Line 634: Line 634:
Composer is a tool to make deployment of PHP packages. Dolibarr is an application that use dependencies that are PHP packages so we could imaging to use composer to install Dolibarr.
Composer is a tool to make deployment of PHP packages. Dolibarr is an application that use dependencies that are PHP packages so we could imaging to use composer to install Dolibarr.
This is not a good idea as it is just technically not possible for the following reason:
This is not a good idea as it is just technically not possible for the following reason:
* First, you must understand that composer is a tool '''to deploy a frozen image of a package''' (like is Docker). It is a tool to '''deploy''', not a tool to '''manage dependencies''': Dolibarr is an application that has a lot of dependencies, but for each of them, the Dolibarr project has to apply some patches to have the dependencies working correclty (for diferent reasons, see the file dev/dolibarr_changes.txt for full list). Each PHP dependency has at least one change to do to have it working correctly. So the image of a library L that Dolibarr needs is NOT the image provided into the composer package by the L project.
* First, you must understand that composer is a tool '''to deploy a frozen image of a package''' (like is Docker). It is a tool to '''deploy''', not a tool to '''manage dependencies''' (event if some features exists for that): Dolibarr is an application that has a lot of dependencies, but for each of them, the Dolibarr project has to apply some patches to have the dependencies working correclty (for difgerent reasons, see the file dev/dolibarr_changes.txt for full list). Each PHP dependency has at least one change to do to have it working correctly. So the image of a library L that Dolibarr needs is NOT the image provided into the composer package by the L project.
After discussion with the author of the composer package, it appears that if a large project needs to use composer, the good way to do is to build ourself a very large package called "dolibarr" with no composer dependencies and all external libraries embed into the same composer project. The dependency system of composer project was simply designed to use an exact version of a library and not to use a patched version of this library.
After discussion with the author of the composer package, it appears that if a large project needs to use composer, the good way to do is to build ourself a very large package called "dolibarr" with no composer dependencies and all external libraries embed into the same composer project. The dependency system of composer project was simply designed to use an exact version of a library and not to use a patched version of this library.
* Second point is again a problem with the composer dependencies system: Each dependency on a library has itself a high number of sub-dependency. And all this sub-dependency has also a high number of dependencies that nobody can't control (there is always sub-dependencies on the libraries you use that are managed by a low level dependency project). The result is that when you use composer to install the main library you need, you install (and you can avoid it) a ton of other packages you don't need. For example, Dolibarr is a 80Mb project with all its PHP dependencies. If you install it with composer (we suppose the the first point is not a problem), then the project reach the size of 300 Mb. Size of project is multiplicated by 3.5 with no reason.
* Second point is again a problem with the composer dependencies system: Each dependency on a library has itself a high number of sub-dependency. And all this sub-dependency has also a high number of dependencies that nobody can't control (there is always sub-dependencies on the libraries you use that are managed by a low level dependency project). The result is that when you use composer to install the main library you need, you install (and you can avoid it) a ton of other packages you don't need. For example, Dolibarr is a 80Mb project with all its PHP dependencies. If you install it with composer (we suppose the the first point is not a problem), then the project reach the size of 300 Mb. Size of project is multiplicated by 3.5 with no reason.

Navigation menu