docgen: add a simple script that does doc generation in parallel

This commit is contained in:
Daniel Kolesa 2017-03-03 17:43:19 +01:00
parent bfeddb8e09
commit 0a252c4463
2 changed files with 41 additions and 0 deletions

View File

@ -59,6 +59,7 @@ eluaappsdir = $(datadir)/elua/apps
eluaapps_DATA = \
scripts/elua/apps/lualian.lua \
scripts/elua/apps/gendoc.lua \
scripts/elua/apps/gendoc.sh \
scripts/elua/apps/README-docgen.md
EXTRA_DIST2 += $(eluaapps_DATA)

40
src/scripts/elua/apps/gendoc.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# a parallel doc generation script
# exit on failure
set -e
gendoc() {
elua gendoc.lua --pass $@
}
gendoc rm $@
gendoc ref $@
# limit jobs otherwise stuff starts complaining in eldbus etc
MAXJ=192
I=0
for cl in $(gendoc clist $@); do
gendoc "$cl" $@ &
I=$(($I + 1))
if [ $I -gt $MAXJ ]; then
I=0
# wait for the batch to finish
wait
fi
done
# wait for all remaining stuff to finish
wait
gendoc types $@ &
gendoc vars $@ &
# types and vars run in parallel
wait
# final results
gendoc stats $@
exit 0