42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
usage() {
|
|
echo "Usage: $0 NEW_OUTPUT_ROOT [--include-json]" >&2
|
|
exit 2
|
|
}
|
|
|
|
output_root=${1:-}
|
|
[[ -n "$output_root" ]] || usage
|
|
shift
|
|
|
|
include_json=false
|
|
while (($#)); do
|
|
case $1 in
|
|
--include-json) include_json=true ;;
|
|
*) usage ;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
[[ ! -e "$output_root" ]]||{ echo "$output_root: output root already exists" >&2; exit 1; }
|
|
mkdir -p "$output_root/reports" "$output_root/diagnostics"
|
|
|
|
reporter/tools/validate-all.sh reports/reports
|
|
reporter/tools/render-all.sh reports/reports --output-dir "$output_root/reports/pdfs"
|
|
reporter/render-diagnostics.sh reports/diagnostics \
|
|
--output-dir "$output_root/diagnostics" \
|
|
--author "${DIAGNOSTICS_AUTHOR:-Beffroi}" \
|
|
--logo reports/assets/beffroi.png
|
|
|
|
if [[ "$include_json" == true ]]; then
|
|
reporter/tools/export-json-all.sh reports/reports --output-dir "$output_root/reports/pdfs"
|
|
while IFS= read -r -d '' source; do
|
|
relative=${source#reports/diagnostics/}
|
|
mkdir -p "$output_root/diagnostics/$(dirname "$relative")"
|
|
cp "$source" "$output_root/diagnostics/$relative"
|
|
done < <(find reports/diagnostics -type f -name '*.json' -print0)
|
|
fi
|
|
|
|
echo "Built publishable reports under $output_root"
|