David Pursehouse | 31c8240 | 2019-09-04 15:02:32 +0900 | [diff] [blame] | 1 | load("@rules_java//java:defs.bzl", "java_binary", "java_library") |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 2 | load("//tools/bzl:genrule2.bzl", "genrule2") |
David Pursehouse | 1d53668 | 2019-01-10 21:44:13 +0900 | [diff] [blame] | 3 | load("//tools/bzl:javadoc.bzl", "java_doc") |
Jacek Centkowski | 75d1c18 | 2017-02-24 14:59:15 +0100 | [diff] [blame] | 4 | load( |
| 5 | "//tools/bzl:plugins.bzl", |
| 6 | "CORE_PLUGINS", |
| 7 | "CUSTOM_PLUGINS", |
| 8 | ) |
Ben Rohlfs | e510fa7 | 2022-12-20 09:42:41 +0100 | [diff] [blame] | 9 | load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test") |
Ben Rohlfs | b3e7cd5 | 2021-08-10 11:42:54 +0200 | [diff] [blame] | 10 | |
| 11 | package(default_visibility = ["//visibility:public"]) |
| 12 | |
Ben Rohlfs | af3ea83 | 2021-08-17 13:10:16 +0200 | [diff] [blame] | 13 | exports_files([ |
| 14 | ".eslintrc.js", |
| 15 | ".eslintignore", |
| 16 | ".prettierrc.js", |
| 17 | "rollup.config.js", |
| 18 | "tsconfig-plugins-base.json", |
| 19 | ]) |
Ben Rohlfs | b3e7cd5 | 2021-08-10 11:42:54 +0200 | [diff] [blame] | 20 | |
David Ostrovsky | af71968 | 2016-09-28 20:31:18 +0200 | [diff] [blame] | 21 | genrule2( |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 22 | name = "core", |
Jacek Centkowski | 75d1c18 | 2017-02-24 14:59:15 +0100 | [diff] [blame] | 23 | srcs = ["//plugins/%s:%s.jar" % (n, n) for n in CORE_PLUGINS + CUSTOM_PLUGINS], |
David Ostrovsky | fa18907 | 2016-11-30 08:52:06 +0100 | [diff] [blame] | 24 | outs = ["core.zip"], |
| 25 | cmd = "mkdir -p $$TMP/WEB-INF/plugins;" + |
| 26 | "for s in $(SRCS) ; do " + |
| 27 | "ln -s $$ROOT/$$s $$TMP/WEB-INF/plugins;done;" + |
| 28 | "cd $$TMP;" + |
| 29 | "zip -qr $$ROOT/$@ .", |
David Ostrovsky | af71968 | 2016-09-28 20:31:18 +0200 | [diff] [blame] | 30 | ) |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 31 | |
| 32 | PLUGIN_API = [ |
David Ostrovsky | 590071e | 2017-09-21 22:54:20 +0200 | [diff] [blame] | 33 | "//java/com/google/gerrit/server", |
Han-Wen Nienhuys | fd6962b | 2018-07-06 15:39:30 +0200 | [diff] [blame] | 34 | "//java/com/google/gerrit/server/ioutil", |
David Ostrovsky | e1f11c7 | 2018-01-18 06:35:24 +0100 | [diff] [blame] | 35 | "//java/com/google/gerrit/server/restapi", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 36 | "//java/com/google/gerrit/pgm/init/api", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 37 | "//java/com/google/gerrit/httpd", |
| 38 | "//java/com/google/gerrit/sshd", |
| 39 | ] |
| 40 | |
| 41 | EXPORTS = [ |
David Ostrovsky | f51cf23 | 2018-08-31 06:19:26 +0200 | [diff] [blame] | 42 | "//antlr3:query_parser", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 43 | "//java/com/google/gerrit/common:annotations", |
| 44 | "//java/com/google/gerrit/common:server", |
Dave Borowitz | 62f32fc | 2019-01-15 18:45:22 -0800 | [diff] [blame] | 45 | "//java/com/google/gerrit/exceptions", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 46 | "//java/com/google/gerrit/extensions:api", |
Dave Borowitz | 3770c70 | 2018-11-13 17:07:14 -0800 | [diff] [blame] | 47 | "//java/com/google/gerrit/git", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 48 | "//java/com/google/gerrit/index", |
Luca Milanesio | bd73b49 | 2018-12-29 20:11:41 +0000 | [diff] [blame] | 49 | "//java/com/google/gerrit/index/project", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 50 | "//java/com/google/gerrit/index:query_exception", |
Dave Borowitz | 87bfe68 | 2018-12-18 17:59:29 -0800 | [diff] [blame] | 51 | "//java/com/google/gerrit/json", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 52 | "//java/com/google/gerrit/lifecycle", |
David Ostrovsky | e994e85 | 2019-10-06 00:13:58 +0200 | [diff] [blame] | 53 | "//java/com/google/gerrit/lucene", |
David Ostrovsky | da429b7 | 2019-01-29 09:04:01 +0100 | [diff] [blame] | 54 | "//java/com/google/gerrit/mail", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 55 | "//java/com/google/gerrit/metrics", |
| 56 | "//java/com/google/gerrit/metrics/dropwizard", |
David Ostrovsky | b03a6e9 | 2019-05-26 14:11:47 +0200 | [diff] [blame] | 57 | "//java/com/google/gerrit/entities", |
David Ostrovsky | fc1a9c7 | 2019-04-17 07:51:58 -0700 | [diff] [blame] | 58 | "//java/com/google/gerrit/server/api", |
David Ostrovsky | 37748ec | 2018-08-14 08:36:11 +0200 | [diff] [blame] | 59 | "//java/com/google/gerrit/server/audit", |
David Pursehouse | a1dacf1 | 2019-01-25 11:37:14 +0900 | [diff] [blame] | 60 | "//java/com/google/gerrit/server/cache/mem", |
Dave Borowitz | dd50404 | 2019-05-02 07:39:11 -0700 | [diff] [blame] | 61 | "//java/com/google/gerrit/server/cache/serialize", |
David Ostrovsky | dd56252 | 2020-07-03 06:25:53 +0200 | [diff] [blame] | 62 | "//java/com/google/gerrit/server/data", |
Edwin Kempin | f2c3830 | 2021-04-19 12:54:23 +0200 | [diff] [blame] | 63 | "//java/com/google/gerrit/server/git/receive", |
Edwin Kempin | 87527aa | 2018-09-06 16:12:54 +0200 | [diff] [blame] | 64 | "//java/com/google/gerrit/server/logging", |
David Ostrovsky | 460a3f3 | 2018-09-04 08:13:51 +0200 | [diff] [blame] | 65 | "//java/com/google/gerrit/server/schema", |
Edwin Kempin | ad19626 | 2018-09-18 17:55:51 +0200 | [diff] [blame] | 66 | "//java/com/google/gerrit/server/util/time", |
David Ostrovsky | f9f77be | 2022-05-14 10:27:35 +0200 | [diff] [blame] | 67 | "//java/com/google/gerrit/proto", |
David Pursehouse | 562b166 | 2018-11-17 00:31:41 -0800 | [diff] [blame] | 68 | "//java/com/google/gerrit/util/cli", |
Dave Borowitz | 791da3a64 | 2018-06-12 10:52:22 -0400 | [diff] [blame] | 69 | "//java/com/google/gerrit/util/http", |
Jacek Centkowski | a215f3e | 2020-03-10 20:25:33 +0100 | [diff] [blame] | 70 | "//java/com/google/gerrit/util/logging", |
David Ostrovsky | fc1a9c7 | 2019-04-17 07:51:58 -0700 | [diff] [blame] | 71 | "//lib/antlr:java-runtime", |
| 72 | "//lib/auto:auto-value-annotations", |
David Ostrovsky | ab6d2a1 | 2021-03-25 21:36:51 +0100 | [diff] [blame] | 73 | "//lib/auto:auto-value-gson", |
David Pursehouse | 4610fca | 2018-07-17 12:56:33 +0900 | [diff] [blame] | 74 | "//lib/commons:compress", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 75 | "//lib/commons:dbcp", |
Youssef Elghareeb | 9d0393c | 2021-10-07 17:29:11 +0200 | [diff] [blame] | 76 | "//lib/commons:lang3", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 77 | "//lib/dropwizard:dropwizard-core", |
Edwin Kempin | 8860e8e | 2018-05-08 11:19:37 +0200 | [diff] [blame] | 78 | "//lib/flogger:api", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 79 | "//lib/guice:guice", |
| 80 | "//lib/guice:guice-assistedinject", |
| 81 | "//lib/guice:guice-servlet", |
David Ostrovsky | e1359a3 | 2018-06-08 09:16:50 +0200 | [diff] [blame] | 82 | "//lib/guice:javax_inject", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 83 | "//lib/httpcomponents:httpclient", |
| 84 | "//lib/httpcomponents:httpcore", |
David Ostrovsky | 8bec855 | 2019-06-19 01:07:43 +0200 | [diff] [blame] | 85 | "//lib:jgit-servlet", |
| 86 | "//lib:jgit", |
David Pursehouse | 5adfd1b | 2019-06-30 16:24:48 +0900 | [diff] [blame] | 87 | "//lib:jsr305", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 88 | "//lib/log:api", |
| 89 | "//lib/log:log4j", |
| 90 | "//lib/mina:sshd", |
| 91 | "//lib/ow2:ow2-asm", |
| 92 | "//lib/ow2:ow2-asm-analysis", |
| 93 | "//lib/ow2:ow2-asm-commons", |
| 94 | "//lib/ow2:ow2-asm-util", |
| 95 | "//lib:args4j", |
| 96 | "//lib:blame-cache", |
| 97 | "//lib:guava", |
| 98 | "//lib:guava-retrying", |
| 99 | "//lib:gson", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 100 | "//lib:icu4j", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 101 | "//lib:mime-util", |
| 102 | "//lib:protobuf", |
David Ostrovsky | 753738b | 2019-09-23 22:41:19 +0200 | [diff] [blame] | 103 | "//lib:servlet-api-without-neverlink", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 104 | "//lib:soy", |
| 105 | "//prolog:gerrit-prolog-common", |
| 106 | ] |
| 107 | |
| 108 | java_binary( |
David Ostrovsky | a8f47b5 | 2020-01-24 20:17:37 +0100 | [diff] [blame] | 109 | name = "bouncycastle-deploy-env", |
| 110 | main_class = "Dummy", |
Ben Rohlfs | b3e7cd5 | 2021-08-10 11:42:54 +0200 | [diff] [blame] | 111 | visibility = ["//visibility:private"], |
David Ostrovsky | a8f47b5 | 2020-01-24 20:17:37 +0100 | [diff] [blame] | 112 | runtime_deps = [ |
| 113 | "//lib/bouncycastle:bcpg", |
| 114 | "//lib/bouncycastle:bcpkix", |
| 115 | "//lib/bouncycastle:bcprov", |
| 116 | ], |
| 117 | ) |
| 118 | |
| 119 | java_binary( |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 120 | name = "plugin-api", |
David Ostrovsky | a8f47b5 | 2020-01-24 20:17:37 +0100 | [diff] [blame] | 121 | deploy_env = ["bouncycastle-deploy-env"], |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 122 | main_class = "Dummy", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 123 | runtime_deps = [":plugin-lib"], |
| 124 | ) |
| 125 | |
| 126 | java_library( |
| 127 | name = "plugin-lib", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 128 | exports = PLUGIN_API + EXPORTS, |
| 129 | ) |
| 130 | |
| 131 | java_library( |
| 132 | name = "plugin-lib-neverlink", |
| 133 | neverlink = 1, |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 134 | exports = PLUGIN_API + EXPORTS, |
| 135 | ) |
| 136 | |
| 137 | java_binary( |
| 138 | name = "plugin-api-sources", |
| 139 | main_class = "Dummy", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 140 | runtime_deps = [ |
David Ostrovsky | f51cf23 | 2018-08-31 06:19:26 +0200 | [diff] [blame] | 141 | "//antlr3:libquery_parser-src.jar", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 142 | "//java/com/google/gerrit/common:libannotations-src.jar", |
| 143 | "//java/com/google/gerrit/common:libserver-src.jar", |
David Ostrovsky | b03a6e9 | 2019-05-26 14:11:47 +0200 | [diff] [blame] | 144 | "//java/com/google/gerrit/entities:libentities-src.jar", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 145 | "//java/com/google/gerrit/extensions:libapi-src.jar", |
| 146 | "//java/com/google/gerrit/httpd:libhttpd-src.jar", |
| 147 | "//java/com/google/gerrit/index:libindex-src.jar", |
| 148 | "//java/com/google/gerrit/index:libquery_exception-src.jar", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 149 | "//java/com/google/gerrit/pgm/init/api:libapi-src.jar", |
David Ostrovsky | 590071e | 2017-09-21 22:54:20 +0200 | [diff] [blame] | 150 | "//java/com/google/gerrit/server:libserver-src.jar", |
David Ostrovsky | e1f11c7 | 2018-01-18 06:35:24 +0100 | [diff] [blame] | 151 | "//java/com/google/gerrit/server/restapi:librestapi-src.jar", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 152 | "//java/com/google/gerrit/sshd:libsshd-src.jar", |
Dave Borowitz | 791da3a64 | 2018-06-12 10:52:22 -0400 | [diff] [blame] | 153 | "//java/com/google/gerrit/util/http:libhttp-src.jar", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 154 | ], |
| 155 | ) |
| 156 | |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 157 | java_doc( |
| 158 | name = "plugin-api-javadoc", |
| 159 | libs = PLUGIN_API + [ |
David Ostrovsky | f51cf23 | 2018-08-31 06:19:26 +0200 | [diff] [blame] | 160 | "//antlr3:query_parser", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 161 | "//java/com/google/gerrit/index", |
| 162 | "//java/com/google/gerrit/index:query_exception", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 163 | "//java/com/google/gerrit/common:annotations", |
| 164 | "//java/com/google/gerrit/common:server", |
| 165 | "//java/com/google/gerrit/extensions:api", |
David Ostrovsky | b03a6e9 | 2019-05-26 14:11:47 +0200 | [diff] [blame] | 166 | "//java/com/google/gerrit/entities", |
Dave Borowitz | 791da3a64 | 2018-06-12 10:52:22 -0400 | [diff] [blame] | 167 | "//java/com/google/gerrit/util/http", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 168 | ], |
| 169 | pkgs = ["com.google.gerrit"], |
| 170 | title = "Gerrit Review Plugin API Documentation", |
David Ostrovsky | 32c6933 | 2017-08-24 22:10:33 +0200 | [diff] [blame] | 171 | ) |
Ben Rohlfs | e510fa7 | 2022-12-20 09:42:41 +0100 | [diff] [blame] | 172 | |
| 173 | # This is a generic test target for TypeScript plugins. |
| 174 | # |
| 175 | # `nodejs_test` needs to run in the directory where the `package.json` and |
| 176 | # `node_modules` are, so unfortunately we cannot move this target into the |
| 177 | # BUILD files of individual plugins. On the other hand one common target |
| 178 | # for all plugins also has the advantage of being re-usable. |
| 179 | # |
| 180 | # For making this work for a specific plugin you have make the source files |
| 181 | # of the plugin available as a `filegroup` and add it to the `data` attribute. |
| 182 | # And you have to specify the `PLUGIN_DIR` in the `env` attribute. |
| 183 | nodejs_test( |
| 184 | name = "web-test-runner", |
| 185 | size = "large", |
| 186 | chdir = package_name(), |
| 187 | data = [ |
| 188 | ":package.json", |
| 189 | ":web-test-runner.config.mjs", |
| 190 | # This is an example of how you could reference your plugin sources: |
| 191 | # "//plugins/codemirror-editor/web:codemirror-test-sources", |
| 192 | "@plugins_npm//:node_modules", |
| 193 | ], |
| 194 | entry_point = "@plugins_npm//:node_modules/@web/test-runner/dist/bin.js", |
| 195 | env = {"PLUGIN_DIR": "codemirror-editor"}, |
| 196 | tags = [ |
| 197 | "local", |
| 198 | "manual", |
| 199 | ], |
| 200 | ) |