Patch Gerrit's build system for webfont free war builds

Gerrit grew the ability to build webfont free documentation but this
wasn't extended to the release war builds. Add a new
release_webfont_free war release target that does build without webfonts
via a local patch against gerrit then build using that.

If this is successful we should reduce the number of external resources
needed by Gerrit (a win for our users) and we can work with upstream to
see about merging functionality that allows us to do this without a
special patch.

Change-Id: I0cb31a8ce98cb307aeafbb131ea073a3c887b3c4
This commit is contained in:
Clark Boylan 2024-05-02 12:09:16 -07:00
parent f6a131ebc0
commit 2f5a20e521
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,62 @@
diff --git a/BUILD b/BUILD
index 0c10d76fe2..c70e989670 100644
--- a/BUILD
+++ b/BUILD
@@ -34,6 +34,13 @@ pkg_war(
doc = True,
)
+pkg_war(
+ name = "release_webfont_free",
+ context = ["//plugins:core"],
+ doc = True,
+ doc_webfont = False,
+)
+
pkg_war(
name = "withdocs",
doc = True,
diff --git a/Documentation/BUILD b/Documentation/BUILD
index 85ddbe7413..3c22e37773 100644
--- a/Documentation/BUILD
+++ b/Documentation/BUILD
@@ -118,6 +118,15 @@ genasciidoc_zip(
directory = DOC_DIR,
)
+genasciidoc_zip(
+ name = "html_webfont_free",
+ srcs = SRCS,
+ attributes = documentation_attributes(),
+ backend = "html5",
+ directory = DOC_DIR,
+ webfonts = False,
+)
+
genasciidoc_zip(
name = "searchfree",
srcs = SRCS,
diff --git a/tools/bzl/pkg_war.bzl b/tools/bzl/pkg_war.bzl
index 4792de2f2a..fd5d455349 100644
--- a/tools/bzl/pkg_war.bzl
+++ b/tools/bzl/pkg_war.bzl
@@ -150,14 +150,17 @@ _pkg_war = rule(
implementation = _war_impl,
)
-def pkg_war(name, ui = "polygerrit", context = [], doc = False, **kwargs):
+def pkg_war(name, ui = "polygerrit", context = [], doc = False, doc_webfont = True, **kwargs):
doc_ctx = []
doc_lib = []
ui_deps = []
if ui == "polygerrit":
ui_deps.append("//polygerrit-ui/app:polygerrit_ui")
if doc:
- doc_ctx.append("//Documentation:html")
+ if doc_webfont:
+ doc_ctx.append("//Documentation:html")
+ else:
+ doc_ctx.append("//Documentation:html_webfont_free")
doc_lib.append("//Documentation:index")
_pkg_war(

View File

@ -1,5 +1,14 @@
- hosts: all
tasks:
- name: Patch Gerrit's build system to allow for a release without webfonts
shell: |
set -ex
GERRIT_BASE=/home/zuul/src/gerrit.googlesource.com/gerrit
SYSTEM_CONFIG_BASE=/home/zuul/src/opendev.org/opendev/system-config
# Patch in the webfont free release target
patch -d $GERRIT_BASE -p1 -i \
$SYSTEM_CONFIG_BASE/docker/gerrit/patches/webfont_free.patch
- name: Build gerrit
include_role:
name: bazelisk-build
@ -9,7 +18,7 @@
# polygerrit/javascript plugins into the standard "release"
# target; we add plugins as separate targets here
bazelisk_targets:
- release
- release_webfont_free
- plugins/zuul-results-summary:zuul-results-summary
# Bazel makes "convenience symlinks" [1] starting with bazel-* to