Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - Building with Buck |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 2 | |
| 3 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 4 | == Installation |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 5 | |
Deniz Türkoglu | d7559c0 | 2014-09-08 11:27:23 +0200 | [diff] [blame] | 6 | Note that you need to use Java 7 for building gerrit. |
| 7 | |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 8 | There is currently no binary distribution of Buck, so it has to be manually |
David Pursehouse | 64c1644 | 2013-05-14 10:49:03 +0900 | [diff] [blame] | 9 | built and installed. Apache Ant is required. Currently only Linux and Mac |
David Ostrovsky | 69349b4 | 2015-04-20 06:56:30 +0200 | [diff] [blame] | 10 | OS are supported. |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 11 | |
| 12 | Clone the git and build it: |
| 13 | |
| 14 | ---- |
David Pursehouse | 3e028c9 | 2015-04-16 16:00:59 +0900 | [diff] [blame] | 15 | git clone https://github.com/facebook/buck |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 16 | cd buck |
Shawn Pearce | 552c1b5 | 2014-11-27 11:48:28 -0800 | [diff] [blame] | 17 | git checkout $(cat ../gerrit/.buckversion) |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 18 | ant |
| 19 | ---- |
| 20 | |
David Pursehouse | e9803ab | 2014-03-12 14:15:10 +0900 | [diff] [blame] | 21 | If you don't have a `bin/` directory in your home directory, create one: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 22 | |
| 23 | ---- |
David Pursehouse | 64c1644 | 2013-05-14 10:49:03 +0900 | [diff] [blame] | 24 | mkdir ~/bin |
David Pursehouse | e9803ab | 2014-03-12 14:15:10 +0900 | [diff] [blame] | 25 | ---- |
| 26 | |
| 27 | Add the `~/bin` folder to the path: |
| 28 | |
| 29 | ---- |
David Pursehouse | 64c1644 | 2013-05-14 10:49:03 +0900 | [diff] [blame] | 30 | PATH=~/bin:$PATH |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 31 | ---- |
| 32 | |
David Pursehouse | e9803ab | 2014-03-12 14:15:10 +0900 | [diff] [blame] | 33 | Note that the buck executable needs to be available in all shell sessions, |
| 34 | so also make sure it is appended to the path globally. |
| 35 | |
David Pursehouse | 1d04f64 | 2014-09-10 11:09:02 +0200 | [diff] [blame] | 36 | Add a symbolic link in `~/bin` to the buck and buckd executables: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 37 | |
| 38 | ---- |
David Pursehouse | 64c1644 | 2013-05-14 10:49:03 +0900 | [diff] [blame] | 39 | ln -s `pwd`/bin/buck ~/bin/ |
David Pursehouse | 1d04f64 | 2014-09-10 11:09:02 +0200 | [diff] [blame] | 40 | ln -s `pwd`/bin/buckd ~/bin/ |
David Pursehouse | 64c1644 | 2013-05-14 10:49:03 +0900 | [diff] [blame] | 41 | ---- |
| 42 | |
David Pursehouse | 5c42b8c | 2013-05-17 13:25:47 +0100 | [diff] [blame] | 43 | Verify that `buck` is accessible: |
David Pursehouse | 64c1644 | 2013-05-14 10:49:03 +0900 | [diff] [blame] | 44 | |
| 45 | ---- |
| 46 | which buck |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 47 | ---- |
| 48 | |
David Pursehouse | be28499 | 2013-09-26 14:43:33 +0900 | [diff] [blame] | 49 | To enable autocompletion of buck commands, install the autocompletion |
David Pursehouse | ad4ed96 | 2014-09-10 11:09:26 +0200 | [diff] [blame] | 50 | script from `./scripts/buck_completion.bash` in the buck project. Refer |
| 51 | to the script's header comments for installation instructions. |
David Pursehouse | be28499 | 2013-09-26 14:43:33 +0900 | [diff] [blame] | 52 | |
David Ostrovsky | 69349b4 | 2015-04-20 06:56:30 +0200 | [diff] [blame] | 53 | == Prerequisites |
| 54 | |
| 55 | Buck requires Python version 2.7 to be installed. The Maven download toolchain |
| 56 | requires `curl` to be installed. |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 57 | |
David Pursehouse | 5861a9a | 2013-05-15 10:25:19 +0900 | [diff] [blame] | 58 | [[eclipse]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 59 | == Eclipse Integration |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 60 | |
| 61 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 62 | === Generating the Eclipse Project |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 63 | |
Shawn Pearce | a7a3ee1 | 2013-09-20 10:42:37 -0700 | [diff] [blame] | 64 | Create the Eclipse project: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 65 | |
| 66 | ---- |
Shawn Pearce | a7a3ee1 | 2013-09-20 10:42:37 -0700 | [diff] [blame] | 67 | tools/eclipse/project.py |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 68 | ---- |
| 69 | |
David Pursehouse | 2b16f6a | 2015-08-28 09:38:50 +0900 | [diff] [blame] | 70 | and then follow the link:dev-eclipse.html#setup[setup instructions]. |
David Pursehouse | b46cf49 | 2013-05-14 09:41:30 +0900 | [diff] [blame] | 71 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 72 | === Refreshing the Classpath |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 73 | |
Shawn Pearce | a7a3ee1 | 2013-09-20 10:42:37 -0700 | [diff] [blame] | 74 | If an updated classpath is needed, the Eclipse project can be |
| 75 | refreshed and missing dependency JARs can be downloaded: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 76 | |
| 77 | ---- |
Shawn Pearce | a7a3ee1 | 2013-09-20 10:42:37 -0700 | [diff] [blame] | 78 | tools/eclipse/project.py |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 79 | ---- |
| 80 | |
| 81 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 82 | === Attaching Sources |
Shawn Pearce | 7b55326 | 2013-05-13 21:25:13 -0700 | [diff] [blame] | 83 | |
| 84 | To save time and bandwidth source JARs are only downloaded by the buck |
| 85 | build where necessary to compile Java source into JavaScript using the |
| 86 | GWT compiler. Additional sources may be obtained, allowing Eclipse to |
| 87 | show documentation or dive into the implementation of a library JAR: |
| 88 | |
| 89 | ---- |
Shawn Pearce | a7a3ee1 | 2013-09-20 10:42:37 -0700 | [diff] [blame] | 90 | tools/eclipse/project.py --src |
Shawn Pearce | 7b55326 | 2013-05-13 21:25:13 -0700 | [diff] [blame] | 91 | ---- |
| 92 | |
| 93 | |
David Pursehouse | 6de7ee2 | 2013-05-20 11:08:51 +0900 | [diff] [blame] | 94 | [[build]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 95 | == Building on the Command Line |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 96 | |
| 97 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 98 | === Gerrit Development WAR File |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 99 | |
| 100 | To build the Gerrit web application: |
| 101 | |
| 102 | ---- |
| 103 | buck build gerrit |
| 104 | ---- |
| 105 | |
| 106 | The output executable WAR will be placed in: |
| 107 | |
| 108 | ---- |
David Ostrovsky | f377aa9 | 2015-09-14 17:46:28 +0900 | [diff] [blame] | 109 | buck-out/gen/gerrit/gerrit.war |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 110 | ---- |
| 111 | |
| 112 | |
David Ostrovsky | 7a29533 | 2015-02-27 19:19:45 +0100 | [diff] [blame] | 113 | === Headless Mode |
| 114 | |
| 115 | To build Gerrit in headless mode, i.e. without the GWT Web UI: |
| 116 | |
| 117 | ---- |
| 118 | buck build headless |
| 119 | ---- |
| 120 | |
| 121 | The output executable WAR will be placed in: |
| 122 | |
| 123 | ---- |
David Ostrovsky | f377aa9 | 2015-09-14 17:46:28 +0900 | [diff] [blame] | 124 | buck-out/gen/headless/headless.war |
David Ostrovsky | 7a29533 | 2015-02-27 19:19:45 +0100 | [diff] [blame] | 125 | ---- |
| 126 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 127 | === Extension and Plugin API JAR Files |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 128 | |
David Ostrovsky | e5487a0 | 2013-11-25 00:00:13 +0100 | [diff] [blame] | 129 | To build the extension, plugin and GWT API JAR files: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 130 | |
| 131 | ---- |
| 132 | buck build api |
| 133 | ---- |
| 134 | |
David Ostrovsky | e5487a0 | 2013-11-25 00:00:13 +0100 | [diff] [blame] | 135 | Java binaries, Java sources and Java docs are generated into corresponding |
David Pursehouse | 43dc748 | 2013-12-13 14:54:42 +0900 | [diff] [blame] | 136 | project directories in `buck-out/gen`, here as example for plugin API: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 137 | |
| 138 | ---- |
David Ostrovsky | e5487a0 | 2013-11-25 00:00:13 +0100 | [diff] [blame] | 139 | buck-out/gen/gerrit-plugin-api/plugin-api.jar |
David Ostrovsky | f377aa9 | 2015-09-14 17:46:28 +0900 | [diff] [blame] | 140 | buck-out/gen/gerrit-plugin-api/plugin-api-javadoc/plugin-api-javadoc.jar |
David Ostrovsky | e5487a0 | 2013-11-25 00:00:13 +0100 | [diff] [blame] | 141 | buck-out/gen/gerrit-plugin-api/plugin-api-src.jar |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 142 | ---- |
| 143 | |
David Ostrovsky | 358a458 | 2014-05-13 23:55:04 +0200 | [diff] [blame] | 144 | Install {extension,plugin,gwt}-api to the local maven repository: |
David Ostrovsky | 6e6a967 | 2013-05-30 01:10:12 +0200 | [diff] [blame] | 145 | |
| 146 | ---- |
| 147 | buck build api_install |
| 148 | ---- |
| 149 | |
David Ostrovsky | 358a458 | 2014-05-13 23:55:04 +0200 | [diff] [blame] | 150 | Install gerrit.war to the local maven repository: |
| 151 | |
| 152 | ---- |
| 153 | buck build war_install |
| 154 | ---- |
| 155 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 156 | === Plugins |
David Pursehouse | 0bc51db | 2013-05-14 12:46:49 +0900 | [diff] [blame] | 157 | |
| 158 | To build all core plugins: |
| 159 | |
| 160 | ---- |
| 161 | buck build plugins:core |
| 162 | ---- |
| 163 | |
| 164 | The output JAR files for individual plugins will be placed in: |
| 165 | |
| 166 | ---- |
| 167 | buck-out/gen/plugins/<name>/<name>.jar |
| 168 | ---- |
| 169 | |
| 170 | The JAR files will also be packaged in: |
| 171 | |
| 172 | ---- |
David Ostrovsky | f377aa9 | 2015-09-14 17:46:28 +0900 | [diff] [blame] | 173 | buck-out/gen/plugins/core/core.zip |
David Pursehouse | 0bc51db | 2013-05-14 12:46:49 +0900 | [diff] [blame] | 174 | ---- |
| 175 | |
| 176 | To build a specific plugin: |
| 177 | |
| 178 | ---- |
Shawn Pearce | 6586c20 | 2013-11-09 08:54:48 -0800 | [diff] [blame] | 179 | buck build plugins/<name>:<name> |
David Pursehouse | 0bc51db | 2013-05-14 12:46:49 +0900 | [diff] [blame] | 180 | ---- |
| 181 | |
| 182 | The output JAR file will be be placed in: |
| 183 | |
| 184 | ---- |
| 185 | buck-out/gen/plugins/<name>/<name>.jar |
| 186 | ---- |
| 187 | |
| 188 | Note that when building an individual plugin, the `core.zip` package |
| 189 | is not regenerated. |
| 190 | |
Shawn Pearce | 6586c20 | 2013-11-09 08:54:48 -0800 | [diff] [blame] | 191 | Additional plugins with BUCK files can be added to the build |
| 192 | environment by cloning the source repository into the plugins |
| 193 | subdirectory: |
| 194 | |
| 195 | ---- |
| 196 | git clone https://gerrit.googlesource.com/plugins/<name> plugins/<name> |
| 197 | echo /plugins/<name> >>.git/info/exclude |
| 198 | ---- |
| 199 | |
| 200 | Additional plugin sources will be automatically added to Eclipse the |
| 201 | next time project.py is run: |
| 202 | |
| 203 | ---- |
| 204 | tools/eclipse/project.py |
| 205 | ---- |
| 206 | |
David Pursehouse | 90a9c10 | 2013-09-06 18:42:10 +0900 | [diff] [blame] | 207 | |
| 208 | [[documentation]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 209 | === Documentation |
David Pursehouse | 90a9c10 | 2013-09-06 18:42:10 +0900 | [diff] [blame] | 210 | |
Yuxuan 'fishy' Wang | f780397 | 2014-09-03 12:23:21 -0700 | [diff] [blame] | 211 | To build only the documentation for testing or static hosting: |
David Pursehouse | 90a9c10 | 2013-09-06 18:42:10 +0900 | [diff] [blame] | 212 | |
| 213 | ---- |
| 214 | buck build docs |
| 215 | ---- |
| 216 | |
Yuxuan 'fishy' Wang | f780397 | 2014-09-03 12:23:21 -0700 | [diff] [blame] | 217 | The generated html files will NOT come with the search box, and will be |
| 218 | placed in: |
David Pursehouse | 90a9c10 | 2013-09-06 18:42:10 +0900 | [diff] [blame] | 219 | |
| 220 | ---- |
Yuxuan 'fishy' Wang | f780397 | 2014-09-03 12:23:21 -0700 | [diff] [blame] | 221 | buck-out/gen/Documentation/searchfree__tmp/Documentation |
David Pursehouse | 90a9c10 | 2013-09-06 18:42:10 +0900 | [diff] [blame] | 222 | ---- |
| 223 | |
Yuxuan 'fishy' Wang | f780397 | 2014-09-03 12:23:21 -0700 | [diff] [blame] | 224 | The html files will also be bundled into `searchfree.zip` in this location: |
David Pursehouse | 90a9c10 | 2013-09-06 18:42:10 +0900 | [diff] [blame] | 225 | |
David Ostrovsky | 7cd233e | 2013-09-26 07:21:31 +0200 | [diff] [blame] | 226 | ---- |
David Ostrovsky | f377aa9 | 2015-09-14 17:46:28 +0900 | [diff] [blame] | 227 | buck-out/gen/Documentation/searchfree/searchfree.zip |
David Ostrovsky | 7cd233e | 2013-09-26 07:21:31 +0200 | [diff] [blame] | 228 | ---- |
David Pursehouse | 90a9c10 | 2013-09-06 18:42:10 +0900 | [diff] [blame] | 229 | |
David Pursehouse | c08d03e | 2013-12-10 18:16:10 +0900 | [diff] [blame] | 230 | To build the executable WAR with the documentation included: |
| 231 | |
| 232 | ---- |
| 233 | buck build withdocs |
| 234 | ---- |
| 235 | |
| 236 | The WAR file will be placed in: |
| 237 | |
| 238 | ---- |
David Ostrovsky | f377aa9 | 2015-09-14 17:46:28 +0900 | [diff] [blame] | 239 | buck-out/gen/withdocs/withdocs.war |
David Pursehouse | c08d03e | 2013-12-10 18:16:10 +0900 | [diff] [blame] | 240 | ---- |
| 241 | |
Shawn Pearce | 1657046 | 2015-01-14 16:27:42 -0800 | [diff] [blame] | 242 | [[soyc]] |
| 243 | === GWT Compile Report |
| 244 | |
| 245 | The GWT compiler can output a compile report (or "story of your compile"), |
| 246 | describing the size of the JavaScript and which source classes contributed |
| 247 | to the overall download size. |
| 248 | |
| 249 | ---- |
| 250 | buck build soyc |
| 251 | ---- |
| 252 | |
| 253 | The report will be written as an HTML page to the extras directory, and |
| 254 | can be opened and viewed in any web browser: |
| 255 | |
| 256 | ---- |
| 257 | extras/gerrit_ui/soycReport/compile-report/index.html |
| 258 | ---- |
| 259 | |
| 260 | Only the "Split Point Report" is created, "Compiler Metrics" are not output. |
| 261 | |
David Ostrovsky | 811e603 | 2013-09-06 08:35:45 +0200 | [diff] [blame] | 262 | [[release]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 263 | === Gerrit Release WAR File |
David Ostrovsky | 811e603 | 2013-09-06 08:35:45 +0200 | [diff] [blame] | 264 | |
| 265 | To build the release of the Gerrit web application, including documentation and |
| 266 | all core plugins: |
| 267 | |
| 268 | ---- |
| 269 | buck build release |
| 270 | ---- |
| 271 | |
| 272 | The output release WAR will be placed in: |
| 273 | |
| 274 | ---- |
David Ostrovsky | f377aa9 | 2015-09-14 17:46:28 +0900 | [diff] [blame] | 275 | buck-out/gen/release/release.war |
David Ostrovsky | 811e603 | 2013-09-06 08:35:45 +0200 | [diff] [blame] | 276 | ---- |
David Pursehouse | 0bc51db | 2013-05-14 12:46:49 +0900 | [diff] [blame] | 277 | |
David Ostrovsky | e64e30d | 2014-03-25 06:25:56 -0700 | [diff] [blame] | 278 | [[all]] |
| 279 | === Combined build target |
| 280 | |
| 281 | To build release and api targets, a combined build target is provided: |
| 282 | |
| 283 | ---- |
| 284 | buck build all |
| 285 | ---- |
| 286 | |
David Pursehouse | 5861a9a | 2013-05-15 10:25:19 +0900 | [diff] [blame] | 287 | [[tests]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 288 | == Running Unit Tests |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 289 | |
Dave Borowitz | afd7d39 | 2015-06-22 09:48:33 -0700 | [diff] [blame] | 290 | To run all tests including acceptance tests (but not flaky tests): |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 291 | |
| 292 | ---- |
Dave Borowitz | afd7d39 | 2015-06-22 09:48:33 -0700 | [diff] [blame] | 293 | buck test --exclude flaky |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 294 | ---- |
| 295 | |
Dave Borowitz | afd7d39 | 2015-06-22 09:48:33 -0700 | [diff] [blame] | 296 | To exclude flaky and slow tests: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 297 | |
| 298 | ---- |
Dave Borowitz | afd7d39 | 2015-06-22 09:48:33 -0700 | [diff] [blame] | 299 | buck test --exclude flaky slow |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 300 | ---- |
| 301 | |
Christian Aistleitner | 9fb5881 | 2015-06-21 19:46:11 +0200 | [diff] [blame] | 302 | To run only a specific group of acceptance tests: |
David Ostrovsky | c4e0ac6 | 2014-04-21 18:25:18 +0200 | [diff] [blame] | 303 | |
| 304 | ---- |
Christian Aistleitner | 9fb5881 | 2015-06-21 19:46:11 +0200 | [diff] [blame] | 305 | buck test --include api |
David Ostrovsky | c4e0ac6 | 2014-04-21 18:25:18 +0200 | [diff] [blame] | 306 | ---- |
| 307 | |
| 308 | The following groups of tests are currently supported: |
| 309 | |
Christian Aistleitner | b03fc1a | 2015-06-21 19:49:12 +0200 | [diff] [blame] | 310 | * acceptance |
David Ostrovsky | c4e0ac6 | 2014-04-21 18:25:18 +0200 | [diff] [blame] | 311 | * api |
David Ostrovsky | 4efb0f2 | 2014-12-18 08:55:13 +0100 | [diff] [blame] | 312 | * edit |
Dave Borowitz | afd7d39 | 2015-06-22 09:48:33 -0700 | [diff] [blame] | 313 | * flaky |
David Ostrovsky | c4e0ac6 | 2014-04-21 18:25:18 +0200 | [diff] [blame] | 314 | * git |
| 315 | * pgm |
| 316 | * rest |
| 317 | * server |
| 318 | * ssh |
Christian Aistleitner | b03fc1a | 2015-06-21 19:49:12 +0200 | [diff] [blame] | 319 | * slow |
David Ostrovsky | c4e0ac6 | 2014-04-21 18:25:18 +0200 | [diff] [blame] | 320 | |
David Ostrovsky | bb70615 | 2015-10-16 06:29:17 +0200 | [diff] [blame] | 321 | To run a specific test group, e.g. the rest-account test group: |
Edwin Kempin | 674078a | 2013-08-20 11:37:14 +0200 | [diff] [blame] | 322 | |
| 323 | ---- |
David Ostrovsky | bb70615 | 2015-10-16 06:29:17 +0200 | [diff] [blame] | 324 | buck test //gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account:rest-account |
Edwin Kempin | 674078a | 2013-08-20 11:37:14 +0200 | [diff] [blame] | 325 | ---- |
| 326 | |
David Ostrovsky | faec805 | 2014-08-10 00:32:52 +0200 | [diff] [blame] | 327 | To create test coverage report: |
| 328 | |
| 329 | ---- |
| 330 | buck test --code-coverage --code-coverage-format html --no-results-cache |
| 331 | ---- |
| 332 | |
| 333 | The HTML report is created in `buck-out/gen/jacoco/code-coverage/index.html`. |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 334 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 335 | == Dependencies |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 336 | |
| 337 | Dependency JARs are normally downloaded automatically, but Buck can inspect |
| 338 | its graph and download any missing JAR files. This is useful to enable |
Shawn Pearce | a7a3ee1 | 2013-09-20 10:42:37 -0700 | [diff] [blame] | 339 | subsequent builds to run without network access: |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 340 | |
| 341 | ---- |
Shawn Pearce | a7a3ee1 | 2013-09-20 10:42:37 -0700 | [diff] [blame] | 342 | tools/download_all.py |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 343 | ---- |
| 344 | |
David Pursehouse | b46cf49 | 2013-05-14 09:41:30 +0900 | [diff] [blame] | 345 | When downloading from behind a proxy (which is common in some corporate |
| 346 | environments), it might be necessary to explicitly specify the proxy that |
| 347 | is then used by `curl`: |
| 348 | |
| 349 | ---- |
| 350 | export http_proxy=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port> |
| 351 | ---- |
| 352 | |
Shawn Pearce | 1b89f85 | 2013-05-13 20:26:34 -0700 | [diff] [blame] | 353 | Redirection to local mirrors of Maven Central and the Gerrit storage |
| 354 | bucket is supported by defining specific properties in |
| 355 | `local.properties`, a file that is not tracked by Git: |
| 356 | |
| 357 | ---- |
| 358 | echo download.GERRIT = http://nexus.my-company.com/ >>local.properties |
| 359 | echo download.MAVEN_CENTRAL = http://nexus.my-company.com/ >>local.properties |
| 360 | ---- |
| 361 | |
David Pursehouse | 6fb2c4d | 2013-05-16 16:51:46 +0900 | [diff] [blame] | 362 | The `local.properties` file may be placed in the root of the gerrit repository |
| 363 | being built, or in `~/.gerritcodereview/`. The file in the root of the gerrit |
| 364 | repository has precedence. |
| 365 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 366 | == Building against unpublished Maven JARs |
David Ostrovsky | ee9f992 | 2013-08-15 00:21:04 +0200 | [diff] [blame] | 367 | |
| 368 | To build against unpublished Maven JARs, like gwtorm or PrologCafe, the custom |
David Pursehouse | b99db5c | 2013-09-26 11:34:42 +0900 | [diff] [blame] | 369 | JARs must be installed in the local Maven repository (`mvn clean install`) and |
| 370 | `maven_jar()` must be updated to point to the `MAVEN_LOCAL` Maven repository for |
David Ostrovsky | ee9f992 | 2013-08-15 00:21:04 +0200 | [diff] [blame] | 371 | that artifact: |
| 372 | |
David Pursehouse | b99db5c | 2013-09-26 11:34:42 +0900 | [diff] [blame] | 373 | [source,python] |
David Ostrovsky | ee9f992 | 2013-08-15 00:21:04 +0200 | [diff] [blame] | 374 | ---- |
| 375 | maven_jar( |
| 376 | name = 'gwtorm', |
| 377 | id = 'gwtorm:gwtorm:42', |
David Ostrovsky | ee9f992 | 2013-08-15 00:21:04 +0200 | [diff] [blame] | 378 | license = 'Apache2.0', |
| 379 | repository = MAVEN_LOCAL, |
| 380 | ) |
| 381 | ---- |
| 382 | |
David Ostrovsky | 07df959 | 2014-02-01 23:47:22 +0100 | [diff] [blame] | 383 | == Building against unpublished JARs, that change frequently |
| 384 | |
| 385 | If a dependent Gerrit library is undergoing active development it must be |
| 386 | recompiled and the change must be reflected in the Buck build process. For |
| 387 | example testing Gerrit against changed JGit snapshot version. After building |
| 388 | JGit library, the artifacts are created in local Maven build directory, e. g.: |
| 389 | |
| 390 | ---- |
| 391 | mvn package |
| 392 | /home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT.jar |
| 393 | /home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT-sources.jar |
| 394 | ---- |
| 395 | |
| 396 | If as usual, installation of the build artifacts takes place in local maven |
| 397 | repository, then the Buck build must fetch them from there with normal |
| 398 | `download_file.py` process. Disadvantage of this approach is that Buck cache |
| 399 | invalidation must occur to refresh the artifacts after next |
| 400 | change-compile-install round trip. |
| 401 | |
| 402 | To shorten that workflow and take the installation of the artifacts to the |
| 403 | local Maven repository and fetching it again from there out of the picture, |
| 404 | `local_jar()` method is used instead of `maven_jar()`: |
| 405 | |
| 406 | [source,python] |
| 407 | ---- |
| 408 | local_jar( |
| 409 | name = 'jgit', |
| 410 | jar = '/home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT.jar', |
| 411 | src = '/home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT-sources.jar', |
| 412 | deps = [':ewah'] |
| 413 | ) |
| 414 | ---- |
| 415 | |
| 416 | This creates a symlink to the Buck targets direct against artifacts in |
| 417 | another project's Maven target directory: |
| 418 | |
| 419 | ---- |
| 420 | buck-out/gen/lib/jgit/jgit.jar -> |
| 421 | /home/<user>/projects/jgit/org.eclipse.jgit/target/org.eclipse.jgit-3.3.0-SNAPSHOT.jar |
| 422 | ---- |
| 423 | |
David Ostrovsky | 1a1b8b8a | 2014-10-23 22:37:58 +0200 | [diff] [blame] | 424 | After `buck clean` and `buck build lib/jgit:jgit` the symbolic link that was |
| 425 | created the first time is lost due to Buck's caching mechanism. This means that |
| 426 | when a new version of the local artifact is deployed (by running `mvn package` |
| 427 | in the JGit project in the example above), Buck is not aware of it, because it |
| 428 | still has a stale version of it in its cache. |
| 429 | |
| 430 | To solve this problem and re-create the symbolic link, you don't need to wipe out |
| 431 | the entire Buck cache. Just rebuilding the target with the `--no-cache` option |
| 432 | does the job: |
| 433 | |
| 434 | ---- |
| 435 | buck clean |
| 436 | buck build --no-cache lib/jgit:jgit |
| 437 | ---- |
| 438 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 439 | == Building against artifacts from custom Maven repositories |
David Ostrovsky | 2536d06 | 2013-11-14 00:35:07 +0100 | [diff] [blame] | 440 | |
| 441 | To build against custom Maven repositories, two modes of operations are |
| 442 | supported: with rewrite in local.properties and without. |
| 443 | |
| 444 | Without rewrite the URL of custom Maven repository can be directly passed |
| 445 | to the maven_jar() function: |
| 446 | |
| 447 | [source,python] |
| 448 | ---- |
| 449 | GERRIT_FORGE = 'http://gerritforge.com/snapshot' |
| 450 | |
| 451 | maven_jar( |
| 452 | name = 'gitblit', |
| 453 | id = 'com.gitblit:gitblit:1.4.0', |
| 454 | sha1 = '1b130dbf5578ace37507430a4a523f6594bf34fa', |
| 455 | license = 'Apache2.0', |
| 456 | repository = GERRIT_FORGE, |
| 457 | ) |
| 458 | ---- |
| 459 | |
| 460 | When the custom URL has to be rewritten, then the same logic as with Gerrit |
| 461 | known Maven repository is used: Repo name must be defined that matches an entry |
| 462 | in local.properties file: |
| 463 | |
| 464 | ---- |
| 465 | download.GERRIT_FORGE = http://my.company.mirror/gerrit-forge |
| 466 | ---- |
| 467 | |
| 468 | And corresponding BUCK excerpt: |
| 469 | |
| 470 | [source,python] |
| 471 | ---- |
| 472 | GERRIT_FORGE = 'GERRIT_FORGE:' |
| 473 | |
| 474 | maven_jar( |
| 475 | name = 'gitblit', |
| 476 | id = 'com.gitblit:gitblit:1.4.0', |
| 477 | sha1 = '1b130dbf5578ace37507430a4a523f6594bf34fa', |
| 478 | license = 'Apache2.0', |
| 479 | repository = GERRIT_FORGE, |
| 480 | ) |
| 481 | ---- |
| 482 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 483 | === Caching Build Results |
Shawn Pearce | 9e4e243 | 2013-05-30 13:09:29 -0700 | [diff] [blame] | 484 | |
| 485 | Build results can be locally cached, saving rebuild time when |
| 486 | switching between Git branches. Buck's documentation covers |
| 487 | caching in link:http://facebook.github.io/buck/concept/buckconfig.html[buckconfig]. |
| 488 | The trivial case using a local directory is: |
| 489 | |
| 490 | ---- |
| 491 | cat >.buckconfig.local <<EOF |
| 492 | [cache] |
| 493 | mode = dir |
| 494 | dir = buck-cache |
| 495 | EOF |
| 496 | ---- |
| 497 | |
David Pursehouse | 6c3fd80 | 2014-10-24 13:50:44 +0900 | [diff] [blame] | 498 | [[clean-cache]] |
| 499 | === Cleaning The Buck Cache |
| 500 | |
| 501 | The cache for the Gerrit Code Review project is located in |
Christian Aistleitner | 6f6de0d | 2015-03-26 14:25:03 +0100 | [diff] [blame] | 502 | `~/.gerritcodereview/buck-cache/locally-built-artifacts`. |
David Pursehouse | 6c3fd80 | 2014-10-24 13:50:44 +0900 | [diff] [blame] | 503 | |
| 504 | The Buck cache should never need to be manually deleted. If you find yourself |
| 505 | deleting the Buck cache regularly, then it is likely that there is something |
| 506 | wrong with your environment or your workflow. |
| 507 | |
| 508 | If you really do need to clean the cache manually, then: |
| 509 | |
| 510 | ---- |
Christian Aistleitner | 6f6de0d | 2015-03-26 14:25:03 +0100 | [diff] [blame] | 511 | rm -rf ~/.gerritcodereview/buck-cache/locally-built-artifacts |
David Pursehouse | 6c3fd80 | 2014-10-24 13:50:44 +0900 | [diff] [blame] | 512 | ---- |
| 513 | |
Christian Aistleitner | 6f6de0d | 2015-03-26 14:25:03 +0100 | [diff] [blame] | 514 | Note that the root `buck-cache` folder should not be deleted as it also contains |
| 515 | the `downloaded-artifacts` directory, which holds the artifacts that got |
| 516 | downloaded (not built locally). |
David Pursehouse | 6c3fd80 | 2014-10-24 13:50:44 +0900 | [diff] [blame] | 517 | |
Edwin Kempin | 9a8b1dc | 2013-09-16 09:08:34 +0200 | [diff] [blame] | 518 | [[buck-daemon]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 519 | === Using Buck daemon |
David Ostrovsky | d5ae8d3 | 2013-09-15 20:10:17 +0200 | [diff] [blame] | 520 | |
David Pursehouse | b99db5c | 2013-09-26 11:34:42 +0900 | [diff] [blame] | 521 | Buck ships with a daemon command `buckd`, which uses the |
David Ostrovsky | d5ae8d3 | 2013-09-15 20:10:17 +0200 | [diff] [blame] | 522 | link:https://github.com/martylamb/nailgun[Nailgun] protocol for running |
| 523 | Java programs from the command line without incurring the JVM startup |
David Pursehouse | b99db5c | 2013-09-26 11:34:42 +0900 | [diff] [blame] | 524 | overhead. |
| 525 | |
| 526 | Using a Buck daemon can save significant amounts of time as it avoids the |
| 527 | overhead of starting a Java virtual machine, loading the buck class files |
| 528 | and parsing the build files for each command. |
| 529 | |
| 530 | It is safe to run several buck daemons started from different project |
| 531 | directories and they will not interfere with each other. Buck's documentation |
| 532 | covers daemon in http://facebook.github.io/buck/command/buckd.html[buckd]. |
| 533 | |
David Ostrovsky | 26e3be6 | 2014-05-23 08:34:07 +0200 | [diff] [blame] | 534 | To use `buckd` the additional |
| 535 | link:https://facebook.github.io/watchman[watchman] program must be installed. |
| 536 | |
David Ostrovsky | 3717542 | 2014-09-22 09:55:40 +0200 | [diff] [blame] | 537 | To disable `buckd`, the environment variable `NO_BUCKD` must be set. It's not |
| 538 | recommended to put it in the shell config, as it can be forgotten about it and |
| 539 | then assumed Buck was working as it should when it should be using buckd. |
| 540 | Prepend the variable to Buck invocation instead: |
| 541 | |
| 542 | ---- |
David Pursehouse | 8d4d316 | 2014-10-24 13:57:06 +0900 | [diff] [blame] | 543 | NO_BUCKD=1 buck build gerrit |
David Ostrovsky | 3717542 | 2014-09-22 09:55:40 +0200 | [diff] [blame] | 544 | ---- |
| 545 | |
David Ostrovsky | 26e3be6 | 2014-05-23 08:34:07 +0200 | [diff] [blame] | 546 | [[watchman]] |
| 547 | === Installing watchman |
| 548 | |
| 549 | Watchman is used internally by Buck to monitor directory trees and is needed |
| 550 | for buck daemon to work properly. Because buckd is activated by default in the |
| 551 | latest version of Buck, it searches for the watchman executable in the |
| 552 | path and issues a warning when it is not found and kills buckd. |
| 553 | |
| 554 | To prepare watchman installation on Linux: |
David Ostrovsky | d5ae8d3 | 2013-09-15 20:10:17 +0200 | [diff] [blame] | 555 | |
| 556 | ---- |
David Ostrovsky | 26e3be6 | 2014-05-23 08:34:07 +0200 | [diff] [blame] | 557 | git clone https://github.com/facebook/watchman.git |
| 558 | cd watchman |
| 559 | ./autogen.sh |
David Ostrovsky | d5ae8d3 | 2013-09-15 20:10:17 +0200 | [diff] [blame] | 560 | ---- |
| 561 | |
David Ostrovsky | 26e3be6 | 2014-05-23 08:34:07 +0200 | [diff] [blame] | 562 | To install it in user home directory (without root privileges): |
| 563 | |
| 564 | ---- |
| 565 | ./configure --prefix $HOME/watchman |
| 566 | make install |
| 567 | ---- |
| 568 | |
| 569 | To install it system wide: |
| 570 | |
| 571 | ---- |
| 572 | ./configure |
| 573 | make |
| 574 | sudo make install |
| 575 | ---- |
| 576 | |
| 577 | Put $HOME/watchman/bin/watchman in path or link to $HOME/bin/watchman. |
| 578 | |
| 579 | To install watchman on OS X: |
| 580 | |
| 581 | ---- |
| 582 | brew install --HEAD watchman |
| 583 | ---- |
| 584 | |
| 585 | See the original documentation for more information: |
| 586 | link:https://facebook.github.io/watchman/docs/install.html[Watchman |
| 587 | installation]. |
| 588 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 589 | === Override Buck's settings |
David Ostrovsky | efaff30 | 2013-09-20 22:36:14 +0200 | [diff] [blame] | 590 | |
Shawn Pearce | 4e1a8bc | 2013-11-28 18:38:30 -0800 | [diff] [blame] | 591 | Additional JVM args for Buck can be set in `.buckjavaargs` in the |
| 592 | project root directory. For example to override Buck's default 1GB |
| 593 | heap size: |
David Ostrovsky | efaff30 | 2013-09-20 22:36:14 +0200 | [diff] [blame] | 594 | |
| 595 | ---- |
Shawn Pearce | 4e1a8bc | 2013-11-28 18:38:30 -0800 | [diff] [blame] | 596 | cat > .buckjavaargs <<EOF |
| 597 | -XX:MaxPermSize=512m -Xms8000m -Xmx16000m |
David Ostrovsky | efaff30 | 2013-09-20 22:36:14 +0200 | [diff] [blame] | 598 | EOF |
| 599 | ---- |
| 600 | |
David Ostrovsky | fe2934e | 2014-04-22 00:36:12 +0200 | [diff] [blame] | 601 | == Rerun unit tests |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 602 | |
David Pursehouse | 56f60a4 | 2014-07-10 11:20:33 +0900 | [diff] [blame] | 603 | Test execution results are cached by Buck. If a test that was already run |
| 604 | needs to be repeated, the unit test cache for that test must be removed first: |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 605 | |
| 606 | ---- |
David Ostrovsky | bb70615 | 2015-10-16 06:29:17 +0200 | [diff] [blame] | 607 | rm -rf buck-out/bin/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account/.rest-account/ |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 608 | ---- |
| 609 | |
David Pursehouse | 56f60a4 | 2014-07-10 11:20:33 +0900 | [diff] [blame] | 610 | After clearing the cache, the test can be run again: |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 611 | |
| 612 | ---- |
David Ostrovsky | bb70615 | 2015-10-16 06:29:17 +0200 | [diff] [blame] | 613 | buck test //gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account:rest-account |
| 614 | [-] TESTING...FINISHED 12,3s (12 PASS/0 FAIL) |
| 615 | RESULTS FOR //gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account:rest-account |
| 616 | PASS 970ms 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.CapabilitiesIT |
| 617 | PASS 999ms 1 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.EditPreferencesIT |
| 618 | PASS 1,2s 1 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.GetAccountDetailIT |
| 619 | PASS 951ms 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.GetAccountIT |
| 620 | PASS 6,4s 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.GetDiffPreferencesIT |
| 621 | PASS 1,2s 4 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.PutUsernameIT |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 622 | TESTS PASSED |
| 623 | ---- |
| 624 | |
David Pursehouse | 56f60a4 | 2014-07-10 11:20:33 +0900 | [diff] [blame] | 625 | An alternative approach is to use Buck's `--filters` (`-f`) option: |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 626 | |
| 627 | ---- |
David Ostrovsky | 7f66014 | 2015-10-16 17:24:17 +0200 | [diff] [blame^] | 628 | buck test -f 'com.google.gerrit.acceptance.rest.account.CapabilitiesIT' |
| 629 | Using buckd. |
| 630 | [-] PROCESSING BUCK FILES...FINISHED 1,0s [100%] |
| 631 | [-] BUILDING...FINISHED 2,8s [100%] (334/701 JOBS, 110 UPDATED, 5,1% CACHE MISS) |
| 632 | [-] TESTING...FINISHED 9,2s (6 PASS/0 FAIL) |
David Ostrovsky | bb70615 | 2015-10-16 06:29:17 +0200 | [diff] [blame] | 633 | RESULTS FOR SELECTED TESTS |
David Ostrovsky | 7f66014 | 2015-10-16 17:24:17 +0200 | [diff] [blame^] | 634 | PASS 8,0s 2 Passed 0 Skipped 0 Failed com.google.gerrit.acceptance.rest.account.CapabilitiesIT |
David Ostrovsky | bb70615 | 2015-10-16 06:29:17 +0200 | [diff] [blame] | 635 | PASS <100ms 4 Passed 0 Skipped 0 Failed //tools:util_test |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 636 | TESTS PASSED |
| 637 | ---- |
| 638 | |
David Pursehouse | 56f60a4 | 2014-07-10 11:20:33 +0900 | [diff] [blame] | 639 | When this option is used, the cache is disabled per design and doesn't need to |
David Ostrovsky | 7f66014 | 2015-10-16 17:24:17 +0200 | [diff] [blame^] | 640 | be explicitly deleted. Note, that this is a known issue, that python tests are |
| 641 | always executed. |
David Pursehouse | 56f60a4 | 2014-07-10 11:20:33 +0900 | [diff] [blame] | 642 | |
| 643 | Note that when this option is used, the whole unit test cache is dropped, so |
David Ostrovsky | 074859e | 2014-04-19 22:52:47 +0200 | [diff] [blame] | 644 | repeating the |
| 645 | |
| 646 | ---- |
David Pursehouse | 56f60a4 | 2014-07-10 11:20:33 +0900 | [diff] [blame] | 647 | buck test |
David Ostrovsky | 074859e | 2014-04-19 22:52:47 +0200 | [diff] [blame] | 648 | ---- |
| 649 | |
David Pursehouse | 56f60a4 | 2014-07-10 11:20:33 +0900 | [diff] [blame] | 650 | causes all tests to be executed again. |
| 651 | |
| 652 | To run tests without using cached results at all, use the `--no-results-cache` |
| 653 | option: |
| 654 | |
| 655 | ---- |
| 656 | buck test --no-results-cache |
| 657 | ---- |
David Ostrovsky | a4ea92e7 | 2014-03-25 06:42:33 -0700 | [diff] [blame] | 658 | |
David Ostrovsky | 7674c52 | 2015-10-15 04:55:46 +0200 | [diff] [blame] | 659 | == Upgrading Buck |
| 660 | |
| 661 | The following tests should be executed, when Buck version is upgraded: |
| 662 | |
| 663 | * buck build release |
| 664 | * buck build api_install |
| 665 | * buck test |
| 666 | * install and verify new gerrit site |
| 667 | * upgrade and verify existing gerrit site |
| 668 | * reindex existing gerrit site |
| 669 | * verify that tools/eclipse/project.py produces sane Eclipse project |
| 670 | * verify that tools/eclipse/project.py --src generates sources as well |
| 671 | * verify that unit test execution from Eclipse works |
| 672 | * verify that daemon started from Eclipse works |
| 673 | * verify that GWT SDM debug session started from Eclipse works |
| 674 | |
David Ostrovsky | 44c7e61 | 2015-06-16 08:58:48 +0200 | [diff] [blame] | 675 | == Known issues and bugs |
| 676 | |
| 677 | === Symbolic links and `watchman` |
| 678 | |
| 679 | `Buck` with activated `Watchman` has currently a |
| 680 | [known bug](https://github.com/facebook/buck/issues/341) related to |
| 681 | symbolic links. The symbolic links are used very often with external |
| 682 | plugins, that are linked per symbolic link to the plugins directory. |
| 683 | With this use case Buck is failing to rebuild the plugin artefact |
| 684 | after it was built. All attempts to convince Buck to rebuild will fail. |
| 685 | The only known way to recover is to weep out `buck-out` directory. The |
| 686 | better workaround is to avoid using Watchman in this specific use case. |
| 687 | Watchman can either be de-installed or disabled. See |
| 688 | link:#buck-daemon[Using Buck daemon] section above how to temporarily |
| 689 | disable `buckd`. |
| 690 | |
David Ostrovsky | 66f3429 | 2015-06-17 00:25:59 +0200 | [diff] [blame] | 691 | === Re-triggering rule execution |
| 692 | |
| 693 | There is no way to re-trigger custom rules with side effects, like |
| 694 | `api_{deploy|install}`. This is a `genrule()` that depends on Java sources |
| 695 | and is deploying the Plugin API through custom Python script to the local or |
| 696 | remote Maven repositories. When for some reasons the deployment was undone, |
| 697 | there is no supported way to re-trigger the execution of `api_{deploy|install}` |
| 698 | targets. That's because `--no-cache` option will ignore the `Buck` cache, but |
| 699 | there is no way to ignore `buck-out` directory. To overcome this Buck's design |
| 700 | limitation new `tools/maven/api.py` script was added, that always re-triggers |
| 701 | installation or deployment of Plugin API to local or Central Maven repository. |
| 702 | |
| 703 | ``` |
| 704 | tools/maven/api.py {deploy|install} |
| 705 | ``` |
| 706 | |
| 707 | Dry run mode is also supported: |
| 708 | |
| 709 | ``` |
| 710 | tools/maven/api.py -n {deploy|install} |
| 711 | ``` |
| 712 | |
| 713 | With this script the deployment would re-trigger on every invocation. |
| 714 | |
David Pursehouse | 226eaf3 | 2014-12-18 17:49:28 +0900 | [diff] [blame] | 715 | == Troubleshooting Buck |
| 716 | |
| 717 | In some cases problems with Buck itself need to be investigated. See for example |
| 718 | link:https://gerrit-review.googlesource.com/62411[this attempt to upgrade Buck] |
| 719 | and link:https://github.com/facebook/buck/pull/227[the fix that was needed] to |
| 720 | make the update possible. |
| 721 | |
| 722 | To build Gerrit with a custom version of Buck, the following steps are necessary: |
| 723 | |
| 724 | 1. In the Buck git apply any necessary changes from pull requests |
| 725 | 2. Compile Buck with `ant` |
| 726 | 3. In the root of the Gerrit project create a `.nobuckcheck` file to prevent Buck |
| 727 | from updating itself |
| 728 | 4. Replace the sha1 in Gerrit's `.buckversion` file with the required version from |
| 729 | the custom Buck build |
| 730 | 5. Build Gerrit as usual |
| 731 | |
David Pursehouse | d0525a7 | 2013-05-09 17:49:34 +0100 | [diff] [blame] | 732 | GERRIT |
| 733 | ------ |
| 734 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 735 | |
| 736 | SEARCHBOX |
| 737 | --------- |