Antonio Barone | 10d79e7 | 2020-09-28 18:09:21 +0200 | [diff] [blame] | 1 | # Build |
| 2 | |
| 3 | This plugin is built with Bazel in-tree build. |
| 4 | |
| 5 | ## Build in Gerrit tree |
| 6 | |
| 7 | Create a symbolic link of the repsotiory source to the Gerrit source |
| 8 | tree /plugins/cache-chronicalmap directory, and the external_plugin_deps.bzl |
| 9 | dependencies linked to /plugins/external_plugin_deps.bzl. |
| 10 | |
| 11 | Example: |
| 12 | |
| 13 | ```sh |
| 14 | git clone https://gerrit.googlesource.com/gerrit |
Antonio Barone | 62a9658 | 2020-09-28 18:25:34 +0200 | [diff] [blame] | 15 | git clone https://gerrit.googlesource.com/modules/cache-chroniclemap |
Antonio Barone | 10d79e7 | 2020-09-28 18:09:21 +0200 | [diff] [blame] | 16 | cd gerrit/plugins |
Sven Selberg | aae343f | 2021-12-03 12:51:19 +0000 | [diff] [blame] | 17 | ln -s ../../cache-chroniclemap . |
| 18 | ln -sf ../../cache-chroniclemap/external_plugin_deps.bzl . |
Antonio Barone | 10d79e7 | 2020-09-28 18:09:21 +0200 | [diff] [blame] | 19 | ``` |
| 20 | |
| 21 | From the Gerrit source tree issue the command `bazelsk build plugins/cache-chroniclemap`. |
| 22 | |
| 23 | Example: |
| 24 | |
| 25 | ```sh |
| 26 | bazelisk build plugins/cache-chroniclemap |
| 27 | ``` |
| 28 | |
| 29 | The libModule jar file is created under `basel-bin/plugins/cache-chroniclemap/cache-chroniclemap.jar` |
| 30 | |
| 31 | To execute the tests run `bazelisk test plugins/cache-chroniclemap/...` from the Gerrit source tree. |
| 32 | |
| 33 | Example: |
| 34 | |
| 35 | ```sh |
| 36 | bazelisk test plugins/cache-chroniclemap/... |
Jacek Centkowski | 8688e1c | 2023-10-23 12:55:55 +0200 | [diff] [blame] | 37 | ``` |
| 38 | |
| 39 | ## Run tests in IDE |
| 40 | |
| 41 | The cache-chroniclemap internals are JDK 17 compatible however JDK since that |
| 42 | version is more restrictive on which modules are by default accessible to the |
| 43 | third party libraries. Considering that, in order to run tests in IDE (e.g. |
| 44 | Eclipse), one needs to add the following VM arguments to the particular test's |
| 45 | _Debug/Run Configuration_: |
| 46 | |
| 47 | ``` |
| 48 | --add-exports=java.base/sun.nio.ch=ALL-UNNAMED |
| 49 | --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED |
| 50 | --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED |
| 51 | --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED |
| 52 | --add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED |
| 53 | --add-opens=java.base/java.lang=ALL-UNNAMED |
| 54 | --add-opens=java.base/java.lang.reflect=ALL-UNNAMED |
| 55 | --add-opens=java.base/java.io=ALL-UNNAMED |
| 56 | --add-opens=java.base/java.util=ALL-UNNAMED |
| 57 | ``` |