Bazel: Include documentation in release and withdocs WAR
Change-Id: Ide3114d14cc8acc722f6e04cf2fc357d16775df9
This commit is contained in:
9
BUILD
9
BUILD
@@ -19,8 +19,7 @@ genrule(
|
||||
|
||||
pkg_war(name = 'gerrit')
|
||||
pkg_war(name = 'headless', ui = None)
|
||||
pkg_war(name = 'release', ui = 'ui_optdbg_r', context = ['//plugins:core'])
|
||||
pkg_war(
|
||||
name = "polygerrit",
|
||||
ui = "polygerrit"
|
||||
)
|
||||
pkg_war(name = "polygerrit", ui = "polygerrit")
|
||||
pkg_war(name = 'release', ui = 'ui_optdbg_r', context = ['//plugins:core'], doc = True)
|
||||
pkg_war(name = 'withdocs', doc = True)
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
package(default_visibility = ['//visibility:public'])
|
||||
|
||||
load("//tools/bzl:asciidoc.bzl", "documentation_attributes")
|
||||
load("//tools/bzl:asciidoc.bzl", "genasciidoc")
|
||||
load("//tools/bzl:asciidoc.bzl", "genasciidoc_zip")
|
||||
|
@@ -3,7 +3,6 @@
|
||||
Bazel build is experimental. Major missing parts:
|
||||
|
||||
* PolyGerrit
|
||||
* Documentation index
|
||||
* License tracking
|
||||
* Version stamping
|
||||
* Custom plugins
|
||||
@@ -121,7 +120,29 @@ is not regenerated.
|
||||
[[documentation]]
|
||||
=== Documentation
|
||||
|
||||
To build only the documentation for testing or static hosting:
|
||||
|
||||
----
|
||||
bazel build Documentation:searchfree
|
||||
----
|
||||
|
||||
The html files will be bundled into `searchfree.zip` in this location:
|
||||
|
||||
----
|
||||
bazel-bin/Documentation/searchfree.zip
|
||||
----
|
||||
|
||||
To build the executable WAR with the documentation included:
|
||||
|
||||
----
|
||||
bazel build withdocs
|
||||
----
|
||||
|
||||
The WAR file will be placed in:
|
||||
|
||||
----
|
||||
bazel-bin/withdocs.war
|
||||
----
|
||||
|
||||
[[release]]
|
||||
=== Gerrit Release WAR File
|
||||
|
@@ -76,7 +76,10 @@ def _war_impl(ctx):
|
||||
# Add lib
|
||||
transitive_lib_deps = set()
|
||||
for l in ctx.attr.libs:
|
||||
transitive_lib_deps += l.java.transitive_runtime_deps
|
||||
if hasattr(l, 'java'):
|
||||
transitive_lib_deps += l.java.transitive_runtime_deps
|
||||
elif hasattr(l, 'files'):
|
||||
transitive_lib_deps += l.files
|
||||
|
||||
for dep in transitive_lib_deps:
|
||||
cmd += _add_file(dep, build_output + '/WEB-INF/lib/')
|
||||
@@ -115,6 +118,9 @@ def _war_impl(ctx):
|
||||
use_default_shell_env = True,
|
||||
)
|
||||
|
||||
# context: go to the root directory
|
||||
# libs: go to the WEB-INF/lib directory
|
||||
# pgmlibs: go to the WEB-INF/pgm-lib directory
|
||||
_pkg_war = rule(
|
||||
attrs = {
|
||||
'context': attr.label_list(allow_files = True),
|
||||
@@ -125,18 +131,23 @@ _pkg_war = rule(
|
||||
outputs = {'war' : '%{name}.war'},
|
||||
)
|
||||
|
||||
def pkg_war(name, ui = 'ui_optdbg', context = [], **kwargs):
|
||||
def pkg_war(name, ui = 'ui_optdbg', context = [], doc = False, **kwargs):
|
||||
doc_ctx = []
|
||||
doc_lib = []
|
||||
ui_deps = []
|
||||
if ui == 'polygerrit' or ui == 'ui_optdbg' or ui == 'ui_optdbg_r':
|
||||
ui_deps.append('//polygerrit-ui/app:polygerrit_ui')
|
||||
if ui != 'polygerrit':
|
||||
ui_deps.append('//gerrit-gwtui:%s' % ui)
|
||||
if doc:
|
||||
doc_ctx.append('//Documentation:html')
|
||||
doc_lib.append('//Documentation:index')
|
||||
|
||||
_pkg_war(
|
||||
name = name,
|
||||
libs = LIBS,
|
||||
libs = LIBS + doc_lib,
|
||||
pgmlibs = PGMLIBS,
|
||||
context = context + ui_deps + [
|
||||
context = doc_ctx + context + ui_deps + [
|
||||
'//gerrit-main:main_bin_deploy.jar',
|
||||
'//gerrit-war:webapp_assets',
|
||||
],
|
||||
|
Reference in New Issue
Block a user