#!/bin/sh

set -e

this=odoc-on-odoc
indir=${PWD}
outdir=${ADT_ARTIFACTS:-/tmp}/${this}
mkdir -p ${outdir}

# QUILT_PATCHES=debian/patches quilt push -a
DUNE_BUILD_DIR=${outdir} dune build @doc 2>&1

nb_html=`find ${outdir}/default/_doc/_html/ -name "*.html" | wc -l`
echo -n "Generated $nb_html HTML pages. "
if [ $nb_html -gt 100 ]; then
    echo "That number seems OK."
else
    echo "That is not enough."
fi
