Add buck rule to generate docs for static hosting.
Add rule to build search-free documentation for static hosting, and update
dev-release documentation to reflect the new rule.
Change-Id: Ifc9284d3c44349e3099ad582fcc14ba27695f30a
diff --git a/.buckconfig b/.buckconfig
index 211e878..0d6d484 100644
--- a/.buckconfig
+++ b/.buckconfig
@@ -6,7 +6,7 @@
war_deploy = //tools/maven:war_deploy
war_install = //tools/maven:war_install
chrome = //:chrome
- docs = //Documentation:html
+ docs = //Documentation:searchfree
firefox = //:firefox
gerrit = //:gerrit
release = //:release
diff --git a/Documentation/BUCK b/Documentation/BUCK
index 5ea58fd..48a6525 100644
--- a/Documentation/BUCK
+++ b/Documentation/BUCK
@@ -6,30 +6,25 @@
MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
-genrule(
+genasciidoc(
name = 'html',
- cmd = 'cd $TMP;' +
- 'mkdir -p %s/images;' % DOC_DIR +
- 'unzip -q $(location %s) -d %s/;'
- % (':generate_html', DOC_DIR) +
- 'for s in $SRCS;do ln -s $s %s;done;' % DOC_DIR +
- 'mv %s/*.{jpg,png} %s/images;' % (DOC_DIR, DOC_DIR) +
- 'cp $(location %s) LICENSES.txt;' % ':licenses.txt' +
- 'zip -qr $OUT *',
- srcs = glob([
- 'images/*.jpg',
- 'images/*.png',
- ]) + [':doc.css'],
out = 'html.zip',
+ docdir = DOC_DIR,
+ srcs = SRCS + [':licenses.txt'],
+ attributes = documentation_attributes(git_describe()),
+ backend = 'html5',
visibility = ['PUBLIC'],
)
genasciidoc(
- name = 'generate_html',
+ name = 'searchfree',
+ out = 'searchfree.zip',
+ docdir = DOC_DIR,
srcs = SRCS + [':licenses.txt'],
attributes = documentation_attributes(git_describe()),
backend = 'html5',
- out = 'only_html.zip',
+ searchbox = False,
+ visibility = ['PUBLIC'],
)
genrule(
diff --git a/Documentation/asciidoc.defs b/Documentation/asciidoc.defs
index 6581dd7..2520c74 100644
--- a/Documentation/asciidoc.defs
+++ b/Documentation/asciidoc.defs
@@ -12,14 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-def genasciidoc(
+def genasciidoc_htmlonly(
name,
out,
srcs = [],
attributes = [],
backend = None,
+ searchbox = True,
visibility = []):
- EXPN = '.expn'
+ EXPN = '.' + name + '_expn'
asciidoc = [
'$(exe //lib/asciidoctor:asciidoc)',
@@ -51,9 +52,9 @@
genrule(
name = ex,
- cmd = '$(exe :replace_macros) --suffix=' + EXPN +
- ' -s ' + passed_src +
- ' -o $OUT',
+ cmd = '$(exe :replace_macros) --suffix="%s"' % EXPN +
+ ' -s ' + passed_src + ' -o $OUT' +
+ (' --searchbox' if searchbox else ' --no-searchbox'),
srcs = srcs,
out = ex,
)
@@ -69,3 +70,41 @@
out = out,
visibility = visibility,
)
+
+def genasciidoc(
+ name,
+ out,
+ docdir,
+ srcs = [],
+ attributes = [],
+ backend = None,
+ searchbox = True,
+ visibility = []):
+ SUFFIX = '_htmlonly'
+
+ genasciidoc_htmlonly(
+ name = name + SUFFIX,
+ srcs = srcs,
+ attributes = attributes,
+ backend = backend,
+ searchbox = searchbox,
+ out = name + SUFFIX + '.zip',
+ )
+
+ genrule(
+ name = name,
+ cmd = 'cd $TMP;' +
+ 'mkdir -p %s/images;' % docdir +
+ 'unzip -q $(location %s) -d %s/;'
+ % (':' + name + SUFFIX, docdir) +
+ 'for s in $SRCS;do ln -s $s %s;done;' % docdir +
+ 'mv %s/*.{jpg,png} %s/images;' % (docdir, docdir) +
+ 'cp $(location %s) LICENSES.txt;' % ':licenses.txt' +
+ 'zip -qr $OUT *',
+ srcs = glob([
+ 'images/*.jpg',
+ 'images/*.png',
+ ]) + [':doc.css'],
+ out = out,
+ visibility = visibility,
+ )
diff --git a/Documentation/dev-buck.txt b/Documentation/dev-buck.txt
index fee3996..3c87ca5 100644
--- a/Documentation/dev-buck.txt
+++ b/Documentation/dev-buck.txt
@@ -196,22 +196,23 @@
[[documentation]]
=== Documentation
-To build only the documentation:
+To build only the documentation for testing or static hosting:
----
buck build docs
----
-The generated html files will be placed in:
+The generated html files will NOT come with the search box, and will be
+placed in:
----
- buck-out/gen/Documentation/html__tmp/Documentation
+ buck-out/gen/Documentation/searchfree__tmp/Documentation
----
-The html files will also be bundled into `html.zip` in this location:
+The html files will also be bundled into `searchfree.zip` in this location:
----
- buck-out/gen/Documentation/html.zip
+ buck-out/gen/Documentation/searchfree.zip
----
To build the executable WAR with the documentation included:
diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt
index 84613c2..b78ee13 100644
--- a/Documentation/dev-release.txt
+++ b/Documentation/dev-release.txt
@@ -336,7 +336,13 @@
gerrit-documentation] storage bucket. The `gerrit-documentation`
storage bucket is accessible via the
link:https://cloud.google.com/console[Google Developers Console].
-** Documentation html files must be extracted from `buck-out/gen/Documentation/html.zip`
+** Documentation html files must be extracted from
+`buck-out/gen/Documentation/searchfree.zip` after generating with:
+
+----
+ buck build docs
+----
+
* Update Google Code project links
** Go to http://code.google.com/p/gerrit/admin
** Update the documentation link in the `Resources` section of the