include_defs('//Documentation/asciidoc.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;' + 'ln -s $SRCDIR/licenses.txt LICENSES.txt;' + 'zip -qr $OUT *', srcs = [genfile(d) for d in HTML] + glob([ 'images/*.jpg', 'images/*.png', ]) + [ genfile('licenses.html'), genfile('licenses.txt'), ], deps = [':' + d for d in HTML] + [ ':licenses.html', ':licenses.txt', ], out = 'html.zip', visibility = ['PUBLIC'], ) genasciidoc( name = 'generate_html', srcs = SRCS + [genfile('licenses.txt')], outs = HTML + ['licenses.html'], deps = [':config', ':licenses.txt'], attributes = ['toc', 'newline="\\n"'], backend = 'xhtml11', conf_file = genfile('asciidoc.conf'), ) genrule( name = 'licenses.txt', cmd = '${:gen_licenses} >$OUT', srcs = [], deps = [':gen_licenses'] + MAIN, out = 'licenses.txt', ) genrule( name = 'config', cmd = 'cp $SRCS $OUT &&' + 'echo "[attributes]" >>$OUT &&' + 'echo "revision=`git describe HEAD`" >>$OUT', srcs = ['asciidoc.conf'], out = 'asciidoc.conf', ) python_binary( name = 'gen_licenses', main = 'gen_licenses.py', )