
Bazel buildtools project includes in addition to buildifier also unused deps and buildozer utilities, that detect unused dependencies and fix them by applying the removal to the build files. This change is created by installing unused_deps from buildtools@HEAD and running: $ unused_deps //... and applying the suggested modifications. One side effect of this clean up, is that some plugins might need to be adapted. Particularly, j.c.g.g.server.audit:audit rule excessively added unused dependencies, among other lucene, and the audit rule is included in j.c.g.g.testing:gerrit-test-util rules and thus inherited by the core and plugins testing code. The correct way to do it, is to add lucene as runtime dependency instead. Another side effect is that //prolog:gerrit-prolog-common is now removed from j.c.g.g.httpd.init:init rule (as it is unused there). Given that init rule is a root for gerrit.war gathering machinery, the prolof predicates would be missing in the final build artifact. To rectify, add prolog predicates in addition to the init rule to the gerrit.war gathering machinery. Change-Id: Ib3e6c218ffc6a85f31e8a1192cdd60c759cbd68e
152 lines
4.9 KiB
Python
152 lines
4.9 KiB
Python
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
|
load("//tools/bzl:genrule2.bzl", "genrule2")
|
|
load("//tools/bzl:javadoc.bzl", "java_doc")
|
|
load(
|
|
"//tools/bzl:plugins.bzl",
|
|
"CORE_PLUGINS",
|
|
"CUSTOM_PLUGINS",
|
|
)
|
|
|
|
genrule2(
|
|
name = "core",
|
|
srcs = ["//plugins/%s:%s.jar" % (n, n) for n in CORE_PLUGINS + CUSTOM_PLUGINS],
|
|
outs = ["core.zip"],
|
|
cmd = "mkdir -p $$TMP/WEB-INF/plugins;" +
|
|
"for s in $(SRCS) ; do " +
|
|
"ln -s $$ROOT/$$s $$TMP/WEB-INF/plugins;done;" +
|
|
"cd $$TMP;" +
|
|
"zip -qr $$ROOT/$@ .",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
PLUGIN_API = [
|
|
"//java/com/google/gerrit/server",
|
|
"//java/com/google/gerrit/server/ioutil",
|
|
"//java/com/google/gerrit/server/restapi",
|
|
"//java/com/google/gerrit/pgm/init/api",
|
|
"//java/com/google/gerrit/httpd",
|
|
"//java/com/google/gerrit/sshd",
|
|
]
|
|
|
|
EXPORTS = [
|
|
"//antlr3:query_parser",
|
|
"//java/com/google/gerrit/common:annotations",
|
|
"//java/com/google/gerrit/common:server",
|
|
"//java/com/google/gerrit/exceptions",
|
|
"//java/com/google/gerrit/extensions:api",
|
|
"//java/com/google/gerrit/git",
|
|
"//java/com/google/gerrit/index",
|
|
"//java/com/google/gerrit/index/project",
|
|
"//java/com/google/gerrit/index:query_exception",
|
|
"//java/com/google/gerrit/json",
|
|
"//java/com/google/gerrit/lifecycle",
|
|
"//java/com/google/gerrit/lucene",
|
|
"//java/com/google/gerrit/mail",
|
|
"//java/com/google/gerrit/metrics",
|
|
"//java/com/google/gerrit/metrics/dropwizard",
|
|
"//java/com/google/gerrit/reviewdb:server",
|
|
"//java/com/google/gerrit/server/api",
|
|
"//java/com/google/gerrit/server/audit",
|
|
"//java/com/google/gerrit/server/cache/mem",
|
|
"//java/com/google/gerrit/server/cache/serialize",
|
|
"//java/com/google/gerrit/server/logging",
|
|
"//java/com/google/gerrit/server/schema",
|
|
"//java/com/google/gerrit/server/util/time",
|
|
"//java/com/google/gerrit/util/cli",
|
|
"//java/com/google/gerrit/util/http",
|
|
"//lib/antlr:java-runtime",
|
|
"//lib/auto:auto-value-annotations",
|
|
"//lib/commons:compress",
|
|
"//lib/commons:dbcp",
|
|
"//lib/commons:lang",
|
|
"//lib/dropwizard:dropwizard-core",
|
|
"//lib/flogger:api",
|
|
"//lib/guice:guice",
|
|
"//lib/guice:guice-assistedinject",
|
|
"//lib/guice:guice-servlet",
|
|
"//lib/guice:javax_inject",
|
|
"//lib/httpcomponents:httpclient",
|
|
"//lib/httpcomponents:httpcore",
|
|
"//lib/jackson:jackson-core",
|
|
"//lib/jgit/org.eclipse.jgit.http.server:jgit-servlet",
|
|
"//lib/jgit/org.eclipse.jgit:jgit",
|
|
"//lib:jsr305",
|
|
"//lib/log:api",
|
|
"//lib/log:log4j",
|
|
"//lib/mina:sshd",
|
|
"//lib/ow2:ow2-asm",
|
|
"//lib/ow2:ow2-asm-analysis",
|
|
"//lib/ow2:ow2-asm-commons",
|
|
"//lib/ow2:ow2-asm-util",
|
|
"//lib:args4j",
|
|
"//lib:blame-cache",
|
|
"//lib:guava",
|
|
"//lib:guava-retrying",
|
|
"//lib:gson",
|
|
"//lib:icu4j",
|
|
"//lib:jsch",
|
|
"//lib:mime-util",
|
|
"//lib:protobuf",
|
|
"//lib:servlet-api-without-neverlink",
|
|
"//lib:soy",
|
|
"//prolog:gerrit-prolog-common",
|
|
]
|
|
|
|
java_binary(
|
|
name = "plugin-api",
|
|
main_class = "Dummy",
|
|
visibility = ["//visibility:public"],
|
|
runtime_deps = [":plugin-lib"],
|
|
)
|
|
|
|
java_library(
|
|
name = "plugin-lib",
|
|
visibility = ["//visibility:public"],
|
|
exports = PLUGIN_API + EXPORTS,
|
|
)
|
|
|
|
java_library(
|
|
name = "plugin-lib-neverlink",
|
|
neverlink = 1,
|
|
visibility = ["//visibility:public"],
|
|
exports = PLUGIN_API + EXPORTS,
|
|
)
|
|
|
|
java_binary(
|
|
name = "plugin-api-sources",
|
|
main_class = "Dummy",
|
|
visibility = ["//visibility:public"],
|
|
runtime_deps = [
|
|
"//antlr3:libquery_parser-src.jar",
|
|
"//java/com/google/gerrit/common:libannotations-src.jar",
|
|
"//java/com/google/gerrit/common:libserver-src.jar",
|
|
"//java/com/google/gerrit/extensions:libapi-src.jar",
|
|
"//java/com/google/gerrit/httpd:libhttpd-src.jar",
|
|
"//java/com/google/gerrit/index:libindex-src.jar",
|
|
"//java/com/google/gerrit/index:libquery_exception-src.jar",
|
|
"//java/com/google/gerrit/pgm/init/api:libapi-src.jar",
|
|
"//java/com/google/gerrit/reviewdb:libserver-src.jar",
|
|
"//java/com/google/gerrit/server:libserver-src.jar",
|
|
"//java/com/google/gerrit/server/restapi:librestapi-src.jar",
|
|
"//java/com/google/gerrit/sshd:libsshd-src.jar",
|
|
"//java/com/google/gerrit/util/http:libhttp-src.jar",
|
|
],
|
|
)
|
|
|
|
java_doc(
|
|
name = "plugin-api-javadoc",
|
|
libs = PLUGIN_API + [
|
|
"//antlr3:query_parser",
|
|
"//java/com/google/gerrit/index",
|
|
"//java/com/google/gerrit/index:query_exception",
|
|
"//java/com/google/gerrit/common:annotations",
|
|
"//java/com/google/gerrit/common:server",
|
|
"//java/com/google/gerrit/extensions:api",
|
|
"//java/com/google/gerrit/reviewdb:server",
|
|
"//java/com/google/gerrit/util/http",
|
|
],
|
|
pkgs = ["com.google.gerrit"],
|
|
title = "Gerrit Review Plugin API Documentation",
|
|
visibility = ["//visibility:public"],
|
|
)
|