How does Symfony manage Component subpackages with Git and Composer?
I'm trying to understand the workflow that Symfony uses to create separate bundles for each Symfony component (and Bridge or Bundle) while still including them in the main Symfony Framework.
The framework as well as each component have their own composer.json files :
Symfony
├── Component
| ├── Component1
| | ├── ...
| | └── composer.json
| ├── Component2
| | ├── ...
| | └── composer.json
| └── ...
└── ...
I would like to create a project in a similar way. How does Symfony use Git subtrees to keep track of the framework and components so that they can be installed individually or all along with the composer? Does the framework maintain a separate repository for each package? Is this process automated? It seems like a lot of work to manually update all component packages.
source to share
Every component and package in Symfony has its own repository on Github. They are used for sachets only and are therefore read-only. All work is done in the main repository.
After each commit, all changes will be pushed to the read-only repository. The script is not publicly available as I know, but you can read a little how Fabien implements it here
I am also using subtree splitting to distribute my packages to subrepositories in a jenkin task.
Below is a little tutorial on how to add subtree sections to the main repository and how to propagate it back to your repositories. The example carries over to your example directory structure, and the repositories are owned by Acme.
Create component
#execute in subtree repository
$ git init
$ git commit -a -m "init"
$ git remote add origin git@github.com:Acme/Component1.git
$ git push -u origin master
Add component to main repository
#execute in main repository
$ git remote add -f Component1 git@github.com:Acme/Component1.git
$ git subtree add --prefix Symfony/Component/Component1 --squash Component1/master
$ git subtree push --prefix=Symfony/Component/Component1 Component1 master
Click after changes in the main repository
#execute in main repository on a webhook in e.g. jenkins
$ git remote add -f Component1 git@github.com:Acme/Component1.git #only if you haven't add it before
$ git subtree push --prefix=Symfony/Component/Component1 Component1 master
We hope this helps you set up your infrastructure.
source to share
I don't know the exact procedure that Symfony should follow.
But in practice, there are many possible paths that can be followed.
The simplest seems to be to use a bash
script like the one provided here .
Or perhaps you want to set up a more complex flow like the one configured for Zend Framework .
Another solution is to use PHP and Composer as described here .
It really depends on your needs.
But the links I've provided should be a good starting point for a better understanding of how to set up a good workflow.
source to share