gerrit/Documentation/BUCK
Yuxuan 'fishy' Wang 1bfb51d524 Switch from asciidoc to asciidoctor
To avoid possible GPL licensing issues, switch documentation
rendering from asciidoc to to the MIT licensed asciidoctor.

Asciidoctor can't render our docs if it uses xhtml11 backend, so use
the html5 backend instead.

The current stable version of asciidoctor (0.1.3) has no default CSS.
Configure documentation to reference a modified copy of Gerrit's own
pegdown.css, which is used by plugin documentation rendering to get a
close approximation to the original asciidoc look.

Change-Id: If1ee984c77533d603768e5fac8a91eee211f0d5b
2013-09-05 16:47:50 -07:00

67 lines
1.5 KiB
Python

include_defs('//Documentation/asciidoc.defs')
include_defs('//Documentation/config.defs')
include_defs('//tools/git.defs')
MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
HTML = [txt[0:-4] + '.html' for txt in SRCS]
genrule(
name = 'html',
cmd = 'cd $TMP;' +
'mkdir -p Documentation/images;' +
'for s in $SRCS;do ln -s $s Documentation;done;' +
'mv Documentation/*.{jpg,png} Documentation/images;' +
'rm Documentation/licenses.txt;' +
'cp $SRCDIR/licenses.txt LICENSES.txt;' +
'zip -qr $OUT *',
srcs = [genfile(d) for d in HTML] +
glob([
'images/*.jpg',
'images/*.png',
]) + [
genfile('doc.css'),
genfile('licenses.html'),
genfile('licenses.txt'),
],
deps = [':' + d for d in HTML] + [
':licenses.html',
':licenses.txt',
':doc.css',
],
out = 'html.zip',
visibility = ['PUBLIC'],
)
genrule(
name = 'doc.css',
cmd = 'ln -s $SRCDIR/doc.css $OUT',
srcs = ['doc.css'],
out = 'doc.css',
)
genasciidoc(
srcs = SRCS + [genfile('licenses.txt')],
outs = HTML + ['licenses.html'],
deps = DOCUMENTATION_DEPS,
attributes = documentation_attributes(git_describe()),
backend = 'html5',
)
genrule(
name = 'licenses.txt',
cmd = '$(exe :gen_licenses) >$OUT',
deps = [':gen_licenses'] + MAIN,
out = 'licenses.txt',
)
python_binary(
name = 'gen_licenses',
main = 'gen_licenses.py',
)
python_binary(
name = 'replace_macros',
main = 'replace_macros.py',
)