blob: bd3e4463a34846f7440bf0affa0bfff63a82f916 [file] [log] [blame] [view]
Hugo Arès0249b402017-07-20 13:45:54 -04001# Build
Hugo Arès2e55f8d2016-10-26 14:00:45 -04002
Hugo Arès0249b402017-07-20 13:45:54 -04003This plugin can be built with Bazel, and two build modes are supported:
Hugo Arès2e55f8d2016-10-26 14:00:45 -04004
Hugo Arès0249b402017-07-20 13:45:54 -04005* Standalone
6* In Gerrit tree
Hugo Arès2e55f8d2016-10-26 14:00:45 -04007
Hugo Arès0249b402017-07-20 13:45:54 -04008Standalone build mode is recommended, as this mode doesn't require local Gerrit
9tree to exist. Moreover, there are some limitations and additional manual steps
10required when building in Gerrit tree mode (see corresponding sections).
11
12## Build standalone
13
14To build the plugin, issue the following command:
15
16```
17 bazel build @PLUGIN@
18```
19
20The output is created in
21
22```
David Pursehouse581f9b52019-10-16 12:48:35 +090023 bazel-bin/@PLUGIN@.jar
Hugo Arès0249b402017-07-20 13:45:54 -040024```
25
26To package the plugin sources run:
27
28```
29 bazel build lib@PLUGIN@__plugin-src.jar
30```
31
32The output is created in:
33
34```
35 bazel-bin/lib@PLUGIN@__plugin-src.jar
36```
37
38To execute the tests run:
39
40```
41 bazel test //...
42```
43
44This project can be imported into the Eclipse IDE:
45
46```
47 ./tools/eclipse/project.sh
48```
49
50## Build in Gerrit tree
51
52Clone or link this plugin to the plugins directory of Gerrit's
53source tree. From Gerrit source tree issue the command:
Hugo Arès2e55f8d2016-10-26 14:00:45 -040054
55```
Paladox none9aad7232017-02-12 20:28:42 +000056 bazel build plugins/@PLUGIN@
Hugo Arès2e55f8d2016-10-26 14:00:45 -040057```
58
Hugo Arès2e55f8d2016-10-26 14:00:45 -040059The output is created in
60
61```
David Pursehouse581f9b52019-10-16 12:48:35 +090062 bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar
Hugo Arès2e55f8d2016-10-26 14:00:45 -040063```
64
Nguyen Tuan Khang Phan25284252020-01-24 12:55:24 -050065To execute the tests run either one of:
66
67```
68 bazel test --test_tag_filters=@PLUGIN@ //...
69 bazel test plugins/@PLUGIN@:@PLUGIN@_tests
70```
71
Hugo Arès0249b402017-07-20 13:45:54 -040072This project can be imported into the Eclipse IDE:
73Add the plugin name to the `CUSTOM_PLUGINS` in `tools/bzl/plugins.bzl`, and
74execute:
Hugo Arès2e55f8d2016-10-26 14:00:45 -040075
76```
77 ./tools/eclipse/project.py
78```
Paladox none9aad7232017-02-12 20:28:42 +000079
Hugo Arès0249b402017-07-20 13:45:54 -040080[Back to @PLUGIN@ documentation index][index]
81
82[index]: index.html