gerrit/Documentation/BUCK
Yuxuan 'fishy' Wang c5b0af0c77 Index documentation using lucene.
We'll also index documentation while generating them.

This CL will just store and pack the index files, but won't use them.
Another CL will provide the search UI to use the index files.

Index files will be stored at .index/ directory.

Change-Id: I3f2fa01088f94aaa2e449b3df6c018895df2c5a8
2013-09-27 09:31:32 -07:00

82 lines
1.9 KiB
Python

include_defs('//Documentation/asciidoc.defs')
include_defs('//Documentation/config.defs')
include_defs('//tools/git.defs')
DOC_DIR = 'Documentation'
INDEX_DIR = DOC_DIR + '/.index'
MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
genrule(
name = 'html',
cmd = 'cd $TMP;' +
'mkdir -p %s/images;' % DOC_DIR +
'unzip -q $SRCDIR/index.zip -d %s/;' % INDEX_DIR +
'unzip -q $SRCDIR/only_html.zip -d %s/;' % DOC_DIR +
'for s in $SRCS;do ln -s $s %s;done;' % DOC_DIR +
'mv %s/*.{jpg,png} %s/images;' % (DOC_DIR, DOC_DIR) +
'rm %s/only_html.zip;' % DOC_DIR +
'rm %s/index.zip;' % DOC_DIR +
'rm %s/licenses.txt;' % DOC_DIR +
'cp $SRCDIR/licenses.txt LICENSES.txt;' +
'zip -qr $OUT *',
srcs = glob([
'images/*.jpg',
'images/*.png',
]) + [
'doc.css',
genfile('licenses.txt'),
genfile('only_html.zip'),
genfile('index.zip'),
],
deps = [
':generate_html',
':index',
':licenses.txt',
],
out = 'html.zip',
visibility = ['PUBLIC'],
)
genasciidoc(
name = 'generate_html',
srcs = SRCS + [genfile('licenses.txt')],
deps = [':licenses.txt'],
attributes = documentation_attributes(git_describe()),
backend = 'html5',
out = 'only_html.zip',
)
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',
)
genrule(
name = 'index',
cmd = '$(exe //lib/asciidoctor:doc_indexer) ' +
'-z $OUT ' +
'--prefix "%s/" ' % DOC_DIR +
'--in-ext ".txt" ' +
'--out-ext ".html" ' +
'$SRCS',
srcs = SRCS + [genfile('licenses.txt')],
deps = [
':licenses.txt',
'//lib/asciidoctor:doc_indexer',
],
out = 'index.zip',
)