blob: b66fd773d33734f7099dc3c94b218f451b397a1e [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 = [
David Ostrovskyfa189072016-11-30 08:52:06 +010012 "//gerrit-common:server",
13 "//gerrit-extension-api:api",
14 "//gerrit-gwtexpui:linker_server",
15 "//gerrit-gwtexpui:server",
16 "//gerrit-httpd:httpd",
17 "//gerrit-server:server",
18 "//gerrit-sshd:sshd",
19 "//lib:guava",
20 "//lib/guice:guice",
21 "//lib/guice:guice-assistedinject",
22 "//lib/guice:guice-servlet",
23 "//lib/jgit/org.eclipse.jgit:jgit",
24 "//lib/joda:joda-time",
25 "//lib/log:api",
26 "//lib/log:log4j",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020027]
28
29DEPS = BASE_JETTY_DEPS + [
David Ostrovskyfa189072016-11-30 08:52:06 +010030 "//gerrit-reviewdb:server",
31 "//lib/log:jsonevent-layout",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020032]
33
34java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010035 name = "init-api",
36 srcs = INIT_API_SRCS,
37 visibility = ["//visibility:public"],
38 deps = DEPS + ["//gerrit-common:annotations"],
David Ostrovskyb81b4f72016-05-21 19:55:01 +020039)
40
41java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010042 name = "init",
Edwin Kempina4c095f2017-01-05 09:36:37 +010043 srcs = glob([SRCS + "init/**/*.java"]),
David Ostrovskyfa189072016-11-30 08:52:06 +010044 resources = glob([RSRCS + "init/*"]),
45 visibility = ["//visibility:public"],
46 deps = DEPS + [
47 ":init-api",
48 ":util",
49 "//gerrit-common:annotations",
David Pursehouse9561f382017-02-28 17:32:44 +090050 "//gerrit-elasticsearch:elasticsearch",
David Ostrovskyfa189072016-11-30 08:52:06 +010051 "//gerrit-launcher:launcher", # We want this dep to be provided_deps
52 "//gerrit-lucene:lucene",
53 "//lib:args4j",
54 "//lib:derby",
55 "//lib:gwtjsonrpc",
56 "//lib:gwtorm",
57 "//lib:h2",
58 "//lib/commons:validator",
59 "//lib/mina:sshd",
60 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +020061)
62
63REST_UTIL_DEPS = [
David Ostrovskyfa189072016-11-30 08:52:06 +010064 "//gerrit-cache-h2:cache-h2",
65 "//gerrit-util-cli:cli",
66 "//lib:args4j",
67 "//lib:gwtorm",
68 "//lib/commons:dbcp",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020069]
70
71java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010072 name = "util",
73 visibility = ["//visibility:public"],
74 exports = [":util-nodep"],
75 runtime_deps = DEPS + REST_UTIL_DEPS,
David Ostrovskyb81b4f72016-05-21 19:55:01 +020076)
77
78java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010079 name = "util-nodep",
80 srcs = glob([SRCS + "util/*.java"]),
81 visibility = ["//visibility:public"],
82 deps = DEPS + REST_UTIL_DEPS, # We want all these deps to be provided_deps
David Ostrovskyb81b4f72016-05-21 19:55:01 +020083)
84
85JETTY_DEPS = [
David Ostrovskyfa189072016-11-30 08:52:06 +010086 "//lib/jetty:jmx",
87 "//lib/jetty:server",
88 "//lib/jetty:servlet",
David Ostrovskyb81b4f72016-05-21 19:55:01 +020089]
90
91java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010092 name = "http",
93 visibility = ["//visibility:public"],
94 exports = [":http-jetty"],
95 runtime_deps = DEPS + JETTY_DEPS,
David Ostrovskyb81b4f72016-05-21 19:55:01 +020096)
97
98java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +010099 name = "http-jetty",
100 srcs = glob([SRCS + "http/jetty/*.java"]),
101 visibility = ["//visibility:public"],
102 deps = JETTY_DEPS + BASE_JETTY_DEPS + [
103 # We want all these deps to be provided_deps
104 "//gerrit-launcher:launcher",
105 "//gerrit-reviewdb:client",
106 "//lib:servlet-api-3_1",
107 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200108)
109
110REST_PGM_DEPS = [
David Ostrovskyfa189072016-11-30 08:52:06 +0100111 ":http",
112 ":init",
113 ":init-api",
114 ":util",
115 "//gerrit-cache-h2:cache-h2",
116 "//gerrit-elasticsearch:elasticsearch",
117 "//gerrit-gpg:gpg",
118 "//gerrit-lucene:lucene",
119 "//gerrit-oauth:oauth",
120 "//gerrit-openid:openid",
121 "//lib:args4j",
122 "//lib:gwtorm",
123 "//lib:protobuf",
124 "//lib:servlet-api-3_1-without-neverlink",
125 "//lib/prolog:cafeteria",
126 "//lib/prolog:compiler",
127 "//lib/prolog:runtime",
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200128]
129
130java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +0100131 name = "pgm",
132 resources = glob([RSRCS + "*"]),
133 visibility = ["//visibility:public"],
134 runtime_deps = DEPS + REST_PGM_DEPS + [
135 ":daemon",
136 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200137)
138
139# no transitive deps, used for gerrit-acceptance-framework
140java_library(
David Ostrovskyfa189072016-11-30 08:52:06 +0100141 name = "daemon",
142 srcs = glob([
143 SRCS + "*.java",
144 SRCS + "rules/*.java",
145 ]),
146 resources = glob([RSRCS + "*"]),
147 visibility = ["//visibility:public"],
148 deps = DEPS + REST_PGM_DEPS + [
149 # We want all these deps to be provided_deps
150 "//gerrit-launcher:launcher",
151 "//lib/auto:auto-value",
152 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200153)
154
155junit_tests(
David Ostrovskyfa189072016-11-30 08:52:06 +0100156 name = "pgm_tests",
157 srcs = glob(["src/test/java/**/*.java"]),
158 deps = [
159 ":init",
160 ":init-api",
161 ":pgm",
162 "//gerrit-common:server",
163 "//gerrit-server:server",
164 "//lib:guava",
165 "//lib:junit",
166 "//lib/easymock",
167 "//lib/guice",
168 "//lib/jgit/org.eclipse.jgit:jgit",
169 "//lib/jgit/org.eclipse.jgit.junit:junit",
170 ],
David Ostrovskyb81b4f72016-05-21 19:55:01 +0200171)
Han-Wen Nienhuysc65ad972016-09-21 12:07:22 +0200172
173license_test(
David Ostrovskyfa189072016-11-30 08:52:06 +0100174 name = "pgm_license_test",
175 target = ":pgm",
Yuxuan 'fishy' Wang9d0e8ea2016-08-09 13:55:47 -0700176)