blob: e17f6290bf274a143e542462fa0c0f6d1a15fa44 [file] [log] [blame]
David Ostrovskyfa189072016-11-30 08:52:06 +01001load("//tools/bzl:java.bzl", "java_library2")
2load("//tools/bzl:junit.bzl", "junit_tests")
3load("//tools/bzl:license.bzl", "license_test")
David Ostrovskyb81b4f72016-05-21 19:55:01 +02004
David Ostrovskyfa189072016-11-30 08:52:06 +01005SRCS = "src/main/java/com/google/gerrit/pgm/"
David Ostrovskyb81b4f72016-05-21 19:55:01 +02006
David Ostrovskyfa189072016-11-30 08:52:06 +01007RSRCS = "src/main/resources/com/google/gerrit/pgm/"
8
9INIT_API_SRCS = glob([SRCS + "init/api/*.java"])
David Ostrovskyb81b4f72016-05-21 19:55:01 +020010
11BASE_JETTY_DEPS = [
Dave Borowitza9c68322017-06-27 09:18:21 -040012 "//gerrit-common:annotations",
David Ostrovskyfa189072016-11-30 08:52:06 +010013 "//gerrit-common:server",
14 "//gerrit-extension-api:api",
15 "//gerrit-gwtexpui:linker_server",
16 "//gerrit-gwtexpui:server",
17 "//gerrit-httpd:httpd",
18 "//gerrit-server:server",
19 "//gerrit-sshd:sshd",
20 "//lib:guava",
21 "//lib/guice:guice",
22 "//lib/guice:guice-assistedinject",
23 "//lib/guice:guice-servlet",
24 "//lib/jgit/org.eclipse.jgit:jgit",
25 "//lib/joda:joda-time",
26 "//lib/log:api",
27 "//lib/log:log4j",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020028]
29
30DEPS = BASE_JETTY_DEPS + [
David Ostrovskyfa189072016-11-30 08:52:06 +010031 "//gerrit-reviewdb:server",
Dave Borowitzcab12222017-08-09 12:55:51 -040032 "//gerrit-server:metrics",
Dave Borowitz798b8832017-08-03 11:07:15 -040033 "//gerrit-server:module",
34 "//gerrit-server:receive",
Edwin Kempin5be9c312017-07-07 10:40:55 +020035 "//lib:gwtorm",
David Ostrovskyfa189072016-11-30 08:52:06 +010036 "//lib/log:jsonevent-layout",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020037]
38
39java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010040 name = "init-api",
41 srcs = INIT_API_SRCS,
42 visibility = ["//visibility:public"],
Dave Borowitza9c68322017-06-27 09:18:21 -040043 deps = DEPS,
David Ostrovskyb81b4f72016-05-21 19:55:01 +020044)
45
46java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010047 name = "init",
Edwin Kempina4c095f2017-01-05 09:36:37 +010048 srcs = glob([SRCS + "init/**/*.java"]),
David Ostrovskyfa189072016-11-30 08:52:06 +010049 resources = glob([RSRCS + "init/*"]),
50 visibility = ["//visibility:public"],
51 deps = DEPS + [
52 ":init-api",
53 ":util",
Dave Borowitze47be682017-08-08 09:53:39 -040054 "//gerrit-index:index",
David Pursehouse9561f382017-02-28 17:32:44 +090055 "//gerrit-elasticsearch:elasticsearch",
David Ostrovskyfa189072016-11-30 08:52:06 +010056 "//gerrit-launcher:launcher", # We want this dep to be provided_deps
57 "//gerrit-lucene:lucene",
58 "//lib:args4j",
59 "//lib:derby",
60 "//lib:gwtjsonrpc",
David Ostrovskyfa189072016-11-30 08:52:06 +010061 "//lib:h2",
62 "//lib/commons:validator",
63 "//lib/mina:sshd",
64 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +020065)
66
67REST_UTIL_DEPS = [
David Ostrovskyfa189072016-11-30 08:52:06 +010068 "//gerrit-cache-h2:cache-h2",
Dave Borowitza3cc5102018-05-08 21:24:24 +020069 "//gerrit-cache-mem:mem",
David Ostrovskyfa189072016-11-30 08:52:06 +010070 "//gerrit-util-cli:cli",
71 "//lib:args4j",
David Ostrovskyfa189072016-11-30 08:52:06 +010072 "//lib/commons:dbcp",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020073]
74
75java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010076 name = "util",
77 visibility = ["//visibility:public"],
78 exports = [":util-nodep"],
79 runtime_deps = DEPS + REST_UTIL_DEPS,
David Ostrovskyb81b4f72016-05-21 19:55:01 +020080)
81
82java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010083 name = "util-nodep",
84 srcs = glob([SRCS + "util/*.java"]),
85 visibility = ["//visibility:public"],
86 deps = DEPS + REST_UTIL_DEPS, # We want all these deps to be provided_deps
David Ostrovskyb81b4f72016-05-21 19:55:01 +020087)
88
89JETTY_DEPS = [
David Ostrovskyfa189072016-11-30 08:52:06 +010090 "//lib/jetty:jmx",
91 "//lib/jetty:server",
92 "//lib/jetty:servlet",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020093]
94
95java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010096 name = "http",
97 visibility = ["//visibility:public"],
98 exports = [":http-jetty"],
99 runtime_deps = DEPS + JETTY_DEPS,
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200100)
101
102java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +0100103 name = "http-jetty",
104 srcs = glob([SRCS + "http/jetty/*.java"]),
105 visibility = ["//visibility:public"],
106 deps = JETTY_DEPS + BASE_JETTY_DEPS + [
107 # We want all these deps to be provided_deps
108 "//gerrit-launcher:launcher",
109 "//gerrit-reviewdb:client",
110 "//lib:servlet-api-3_1",
111 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200112)
113
114REST_PGM_DEPS = [
David Ostrovskyfa189072016-11-30 08:52:06 +0100115 ":http",
116 ":init",
117 ":init-api",
118 ":util",
119 "//gerrit-cache-h2:cache-h2",
Dave Borowitza3cc5102018-05-08 21:24:24 +0200120 "//gerrit-cache-mem:mem",
David Ostrovskyfa189072016-11-30 08:52:06 +0100121 "//gerrit-elasticsearch:elasticsearch",
122 "//gerrit-gpg:gpg",
Dave Borowitze47be682017-08-08 09:53:39 -0400123 "//gerrit-index:index",
David Ostrovskyfa189072016-11-30 08:52:06 +0100124 "//gerrit-lucene:lucene",
125 "//gerrit-oauth:oauth",
126 "//gerrit-openid:openid",
127 "//lib:args4j",
David Ostrovskyfa189072016-11-30 08:52:06 +0100128 "//lib:protobuf",
129 "//lib:servlet-api-3_1-without-neverlink",
130 "//lib/prolog:cafeteria",
131 "//lib/prolog:compiler",
132 "//lib/prolog:runtime",
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200133]
134
135java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +0100136 name = "pgm",
137 resources = glob([RSRCS + "*"]),
138 visibility = ["//visibility:public"],
139 runtime_deps = DEPS + REST_PGM_DEPS + [
140 ":daemon",
141 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200142)
143
144# no transitive deps, used for gerrit-acceptance-framework
145java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +0100146 name = "daemon",
147 srcs = glob([
148 SRCS + "*.java",
149 SRCS + "rules/*.java",
150 ]),
151 resources = glob([RSRCS + "*"]),
152 visibility = ["//visibility:public"],
153 deps = DEPS + REST_PGM_DEPS + [
154 # We want all these deps to be provided_deps
155 "//gerrit-launcher:launcher",
156 "//lib/auto:auto-value",
David Ostrovsky55313472018-08-01 22:33:57 +0200157 "//lib/auto:auto-value-annotations",
David Ostrovskyfa189072016-11-30 08:52:06 +0100158 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200159)
160
161junit_tests(
David Ostrovskyfa189072016-11-30 08:52:06 +0100162 name = "pgm_tests",
163 srcs = glob(["src/test/java/**/*.java"]),
164 deps = [
Shawn Pearced79dcef2017-06-10 11:57:30 -0700165 ":http-jetty",
David Ostrovskyfa189072016-11-30 08:52:06 +0100166 ":init",
167 ":init-api",
168 ":pgm",
169 "//gerrit-common:server",
170 "//gerrit-server:server",
171 "//lib:guava",
172 "//lib:junit",
Shawn Pearced79dcef2017-06-10 11:57:30 -0700173 "//lib:truth",
David Ostrovskyfa189072016-11-30 08:52:06 +0100174 "//lib/easymock",
175 "//lib/guice",
176 "//lib/jgit/org.eclipse.jgit:jgit",
177 "//lib/jgit/org.eclipse.jgit.junit:junit",
178 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200179)
Han-Wen Nienhuysc65ad972016-09-21 12:07:22 +0200180
181license_test(
David Ostrovskyfa189072016-11-30 08:52:06 +0100182 name = "pgm_license_test",
183 target = ":pgm",
Yuxuan 'fishy' Wang9d0e8ea2016-08-09 13:55:47 -0700184)