Dissolve gerrit-war top-level directory

Change-Id: I2eaa09545e2ac8ef8f1346ab0cb203d00f811a38
This commit is contained in:
David Ostrovsky 2017-08-24 21:56:38 +02:00 committed by Dave Borowitz
parent 43c0f3d6a2
commit c75278248e
19 changed files with 100 additions and 97 deletions

View File

@ -1,75 +0,0 @@
load("//tools/bzl:genrule2.bzl", "genrule2")
java_library(
name = "init",
srcs = glob(["src/main/java/**/*.java"]),
visibility = ["//visibility:public"],
deps = [
"//gerrit-server:module",
"//gerrit-server:receive",
"//gerrit-server:server",
"//java/com/google/gerrit/elasticsearch",
"//java/com/google/gerrit/extensions:api",
"//java/com/google/gerrit/gpg",
"//java/com/google/gerrit/httpd",
"//java/com/google/gerrit/httpd/auth/oauth",
"//java/com/google/gerrit/httpd/auth/openid",
"//java/com/google/gerrit/lifecycle",
"//java/com/google/gerrit/lucene",
"//java/com/google/gerrit/metrics/dropwizard",
"//java/com/google/gerrit/pgm/http",
"//java/com/google/gerrit/pgm/init",
"//java/com/google/gerrit/pgm/init/api",
"//java/com/google/gerrit/pgm/util",
"//java/com/google/gerrit/reviewdb:server",
"//java/com/google/gerrit/server/cache/h2",
"//java/com/google/gerrit/sshd",
"//lib:guava",
"//lib:gwtorm",
"//lib:servlet-api-3_1",
"//lib/guice",
"//lib/guice:guice-servlet",
"//lib/jgit/org.eclipse.jgit:jgit",
"//lib/log:api",
"//prolog:gerrit-prolog-common",
],
)
genrule2(
name = "webapp_assets",
srcs = glob(["src/main/webapp/**/*"]),
outs = ["webapp_assets.zip"],
cmd = "cd gerrit-war/src/main/webapp; zip -qr $$ROOT/$@ .",
visibility = ["//visibility:public"],
)
java_import(
name = "log4j-config",
jars = [":log4j-config__jar"],
visibility = ["//visibility:public"],
)
genrule2(
name = "log4j-config__jar",
srcs = ["src/main/resources/log4j.properties"],
outs = ["log4j-config.jar"],
cmd = "cd gerrit-war/src/main/resources && zip -9Dqr $$ROOT/$@ .",
)
java_import(
name = "version",
jars = [":gen_version"],
visibility = ["//visibility:public"],
)
genrule2(
name = "gen_version",
outs = ["gen_version.jar"],
cmd = " && ".join([
"cd $$TMP",
"mkdir -p com/google/gerrit/common",
"cat $$ROOT/$(location //:version.txt) >com/google/gerrit/common/Version",
"zip -9Dqr $$ROOT/$@ .",
]),
tools = ["//:version.txt"],
)

View File

@ -1,3 +1,4 @@
load("//tools/bzl:genrule2.bzl", "genrule2")
load("//tools/bzl:gwt.bzl", "gwt_module")
ANNOTATIONS = [
@ -49,3 +50,21 @@ java_library(
"//lib/log:api",
],
)
java_import(
name = "version",
jars = [":gen_version"],
visibility = ["//visibility:public"],
)
genrule2(
name = "gen_version",
outs = ["gen_version.jar"],
cmd = " && ".join([
"cd $$TMP",
"mkdir -p com/google/gerrit/common",
"cat $$ROOT/$(location //:version.txt) >com/google/gerrit/common/Version",
"zip -9Dqr $$ROOT/$@ .",
]),
tools = ["//:version.txt"],
)

View File

@ -1,21 +1,62 @@
# TODO(davido): Consider to isolate war specific sources in its own package
WAR_SRCS = [
"ReviewDbDataSourceProvider.java",
"SiteInitializer.java",
"SitePathFromSystemConfigProvider.java",
"UnzippedDistribution.java",
"WebAppInitializer.java",
]
DEPS = [
"//gerrit-server:receive",
"//gerrit-server:server",
"//java/com/google/gerrit/extensions:api",
"//java/com/google/gerrit/lifecycle",
"//java/com/google/gerrit/reviewdb:server",
"//lib:guava",
"//lib:gwtorm",
"//lib/guice",
"//lib/guice:guice-servlet",
"//lib/jgit/org.eclipse.jgit:jgit",
"//lib/log:api",
]
java_library(
name = "war-init",
srcs = WAR_SRCS,
visibility = ["//visibility:public"],
deps = DEPS + [
":httpd",
"//gerrit-server:module",
"//java/com/google/gerrit/elasticsearch",
"//java/com/google/gerrit/gpg",
"//java/com/google/gerrit/httpd/auth/oauth",
"//java/com/google/gerrit/httpd/auth/openid",
"//java/com/google/gerrit/lucene",
"//java/com/google/gerrit/metrics/dropwizard",
"//java/com/google/gerrit/pgm/init",
"//java/com/google/gerrit/pgm/util",
"//java/com/google/gerrit/server/cache/h2",
"//java/com/google/gerrit/sshd",
"//lib:servlet-api-3_1",
"//prolog:gerrit-prolog-common",
],
)
java_library(
name = "httpd",
srcs = glob(["**/*.java"]),
srcs = glob(
["**/*.java"],
exclude = WAR_SRCS,
),
resource_strip_prefix = "resources",
resources = ["//resources/com/google/gerrit/httpd"],
visibility = ["//visibility:public"],
deps = [
"//gerrit-server:receive",
"//gerrit-server:server",
deps = DEPS + [
"//java/com/google/gerrit/common:annotations",
"//java/com/google/gerrit/common:server",
"//java/com/google/gerrit/extensions:api",
"//java/com/google/gerrit/index:query_exception",
"//java/com/google/gerrit/launcher",
"//java/com/google/gerrit/lifecycle",
"//java/com/google/gerrit/metrics",
"//java/com/google/gerrit/prettify:server",
"//java/com/google/gerrit/reviewdb:server",
"//java/com/google/gerrit/util/cli",
"//java/com/google/gerrit/util/http",
"//java/com/google/gwtexpui/linker:server",
@ -23,21 +64,13 @@ java_library(
"//java/org/eclipse/jgit:server",
"//lib:args4j",
"//lib:gson",
"//lib:guava",
"//lib:gwtjsonrpc",
"//lib:gwtorm",
"//lib:jsch",
"//lib:mime-util",
"//lib:servlet-api-3_1",
"//lib:soy",
"//lib/auto:auto-value",
"//lib/commons:codec",
"//lib/guice",
"//lib/guice:guice-assistedinject",
"//lib/guice:guice-servlet",
"//lib/jgit/org.eclipse.jgit.http.server:jgit-servlet",
"//lib/jgit/org.eclipse.jgit:jgit",
"//lib/log:api",
"//lib/lucene:lucene-core-and-backward-codecs",
],
)

View File

@ -208,7 +208,7 @@ public class StaticModule extends ServletModule {
if (p.unpackedWar != null) {
return p.unpackedWar.resolve(name);
}
return p.sourceRoot.resolve("gerrit-war/src/main/webapp/" + name);
return p.sourceRoot.resolve("webapp/" + name);
}
}

14
resources/BUILD Normal file
View File

@ -0,0 +1,14 @@
load("//tools/bzl:genrule2.bzl", "genrule2")
java_import(
name = "log4j-config",
jars = [":log4j-config__jar"],
visibility = ["//visibility:public"],
)
genrule2(
name = "log4j-config__jar",
srcs = ["log4j.properties"],
outs = ["log4j-config.jar"],
cmd = "cd resources && zip -9Dqr $$ROOT/$@ .",
)

View File

@ -17,14 +17,14 @@
jar_filetype = FileType([".jar"])
LIBS = [
"//gerrit-war:init",
"//gerrit-war:log4j-config",
"//gerrit-war:version",
"//java/com/google/gerrit/common:version",
"//java/com/google/gerrit/httpd:war-init",
"//lib:postgresql",
"//lib/bouncycastle:bcpkix",
"//lib/bouncycastle:bcprov",
"//lib/bouncycastle:bcpg",
"//lib/log:impl_log4j",
"//resources:log4j-config",
]
PGMLIBS = [
@ -149,7 +149,7 @@ def pkg_war(name, ui = 'ui_optdbg', context = [], doc = False, **kwargs):
pgmlibs = PGMLIBS,
context = doc_ctx + context + ui_deps + [
'//java:gerrit-main-class_deploy.jar',
'//gerrit-war:webapp_assets',
'//webapp:assets',
],
**kwargs
)

12
webapp/BUILD Normal file
View File

@ -0,0 +1,12 @@
load("//tools/bzl:genrule2.bzl", "genrule2")
genrule2(
name = "assets",
srcs = glob(
["**/*"],
exclude = ["BUILD"],
),
outs = ["assets.zip"],
cmd = "cd webapp; zip -qr $$ROOT/$@ .",
visibility = ["//visibility:public"],
)

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB