David Ostrovsky | 7a68655 | 2014-01-24 19:03:50 +0100 | [diff] [blame] | 1 | = Gerrit Code Review - Building plugins |
| 2 | |
| 3 | |
| 4 | From build process perspective there are three types of plugins: |
| 5 | |
| 6 | * Maven driven |
| 7 | * Buck in tree driven |
| 8 | * Buck standalone driven |
| 9 | |
| 10 | These types can be combined: if both files in plugin's root directory exist: |
| 11 | |
| 12 | * `BUCK` |
| 13 | * `pom.xml` |
| 14 | |
| 15 | the plugin can be built with both Buck and Maven. |
| 16 | |
| 17 | |
| 18 | == Maven driven build |
| 19 | |
| 20 | If plugin contains `pom.xml` file, it can be built with Maven as usually: |
| 21 | |
| 22 | ---- |
| 23 | mvn clean package |
| 24 | ---- |
| 25 | |
| 26 | Exceptions from the rule above: |
| 27 | |
| 28 | === Exception 1: |
| 29 | |
| 30 | |
| 31 | Plugin's `pom.xml` references snapshot version of plugin API: |
| 32 | `2.8-SNAPSHOT`. In this case there are two possibilities: |
| 33 | |
| 34 | * switch to release API. Change plugin API version in `pom.xml` from |
| 35 | `2.8-SNAPSHOT` to `2.8.1` and repeat step 1 above. |
| 36 | * build and install `SNAPSHOT` version of plugin API in local Maven repository: |
| 37 | |
| 38 | ---- |
| 39 | buck build api_install |
| 40 | ---- |
| 41 | |
| 42 | === Exception 2: |
| 43 | |
| 44 | Plugin's `pom.xml` references other own or foreign (unpublished) libraries or |
| 45 | even other Gerrit plugins. These libraries and/or plugins must be built and |
| 46 | installed in local Maven repository. Clone the related projects and issue |
| 47 | |
| 48 | ---- |
| 49 | mvn install |
| 50 | ---- |
| 51 | |
| 52 | Repeat step 1. above. |
| 53 | |
| 54 | |
| 55 | == Buck in tree driven |
| 56 | |
| 57 | |
| 58 | The fact that plugin contains `BUCK` file doesn't mean that building this |
| 59 | plugin from the plugin directory works. For now it doesn't. Buck in tree driven |
| 60 | means it can only be built from within Gerrit tree. Clone or link the plugin |
| 61 | into gerrit/plugins directory: |
| 62 | |
| 63 | ---- |
| 64 | cd gerrit |
| 65 | buck build plugins/<plugin-name>:<plugin-name> |
| 66 | ---- |
| 67 | |
| 68 | The output can be normally found in the following directory: |
| 69 | |
| 70 | ---- |
| 71 | buck-out/gen/plugins/<plugin-name>/<plugin-name>.jar |
| 72 | ---- |
| 73 | |
| 74 | Some plugins describe their build process in `src/main/resources/Documentation/build.md` |
| 75 | file. It may worth checking. |
| 76 | |
| 77 | == Buck standalone driven |
| 78 | |
| 79 | Only few plugins support that mode for now: |
| 80 | |
| 81 | ---- |
| 82 | cd reviewers |
| 83 | buck build plugin |
| 84 | ---- |
| 85 | |
| 86 | GERRIT |
| 87 | ------ |
| 88 | Part of link:index.html[Gerrit Code Review] |
| 89 | |
| 90 | SEARCHBOX |
| 91 | --------- |