| 1 |
MediaWiki-Vendor |
| 2 |
================ |
| 3 |
|
| 4 |
[Composer] managed libraries required or recommended for use with [MediaWiki]. |
| 5 |
This repository is maintained for use on the Wikimedia Foundation production |
| 6 |
and testing clusters, but may be useful for anyone wishing to avoid directly |
| 7 |
managing MediaWiki dependencies with Composer. |
| 8 |
|
| 9 |
|
| 10 |
Usage |
| 11 |
----- |
| 12 |
|
| 13 |
Checkout this library into $IP/vendor using `git clone <URL>` or add the |
| 14 |
repository as a git submodule using `git submodule add <URL> vendor` followed |
| 15 |
by `git submodule update --init`. |
| 16 |
|
| 17 |
|
| 18 |
Adding or updating libraries |
| 19 |
---------------------------- |
| 20 |
|
| 21 |
0. Read the [documentation] on the process for adding new libraries. |
| 22 |
1. Ensure you're using version 2.9.1 of composer via `composer --version`. |
| 23 |
Everyone using the same version means that diffs from the autoloader are |
| 24 |
minimal and so easier to validate and manually rebase. This is most easily |
| 25 |
done with Docker. For example, to run `composer update --no-dev` do: |
| 26 |
``` |
| 27 |
docker run --rm -it -u "$(id -u):$(id -g)" -v "$PWD/.git:/src/.git:ro" -v "$PWD:/src" -w /src docker-registry.wikimedia.org/releng/composer-php81:8.1.33 update --no-dev |
| 28 |
``` |
| 29 |
2. Edit the composer.json file to add/update the libraries you want to change. |
| 30 |
It is recommended that you use `composer require <package> <version> |
| 31 |
--no-update` to do so as composer will then automatically sort the |
| 32 |
composer.json file. |
| 33 |
3. Run `composer update --no-dev` to download files and update the autoloader. |
| 34 |
4. Add all the new dependencies that got installed to composer.json as well, |
| 35 |
so that everything has their version pinned. (You can look at the changes |
| 36 |
in composer.lock or composer/installed.json to see what they are.) |
| 37 |
5. In some cases, the libraries might include not needed files (e.g. test files, |
| 38 |
project files, etc). If you cannot exclude them from library's archive |
| 39 |
(e.g. by `export-ignore`ing unwanted files in library's `.gitattributes` |
| 40 |
file), you can skip checking them in by listing them in `.gitignore` file. |
| 41 |
6. Rarely, lint checks fail because test files in some library were written |
| 42 |
for an unsupported PHP version. In that case add the test directories to |
| 43 |
the --exclude parameter in the script > test field in composer.json, and |
| 44 |
to .gitignore. |
| 45 |
7. Add and commit changes as a gerrit patch. |
| 46 |
8. Review and merge changes. |
| 47 |
|
| 48 |
Note that you MUST pair patches changing versions of libraries used by MediaWiki |
| 49 |
itself with ones for the "core" repo. Specifically, the patch in mediawiki/core |
| 50 |
must have a `Depends-On` footer to the patch in mediawiki/vendor. |
| 51 |
|
| 52 |
The vendor repo has special configuration, which skips the integrity checks and |
| 53 |
so allowing a circular dependency Gordian knot to be fixed. However, this means |
| 54 |
that, if merged alone without a pair, you'll cause ALL patches in MediaWiki and |
| 55 |
ALL extensions to fail their continuous integration tests. |
| 56 |
|
| 57 |
If in doubt, seek advice from regular commiters to this repository. |
| 58 |
|
| 59 |
|
| 60 |
[Composer]: https://getcomposer.org/ |
| 61 |
[MediaWiki]: https://www.mediawiki.org/wiki/MediaWiki |
| 62 |
[documentation]: https://www.mediawiki.org/wiki/Manual:External_libraries |