blob: 5d9d7dd207639cc6cfa3e7a2cabff81b2268cc1a [file] [log] [blame]
Gina Dimino391dde62017-11-15 13:48:52 -08001#!/bin/bash
2#
3# Build the CDD HTML and PDF from the source files.
4# From the root directory run:
5# ./cdd_gen.sh --version xx --branch xx
6#
7# where version is the version number and branch is the name of the AOSP branch.
8#
Glenn Kasten06c07212019-08-26 16:51:02 -07009# To run this script, you must install these packages as shown:
10# sudo apt-get install wkhtmltopdf
11# pip install Jinja2
12# pip install markdown
13# pip install pytidylib
Gina Dimino391dde62017-11-15 13:48:52 -080014#
15
16POSITIONAL=()
17while [[ $# -gt 0 ]]
18do
19key="$1"
20
21case $key in
22 -v|--version)
23 VERSION="$2"
24 shift # past argument
25 shift # past value
26 ;;
27 -b|--branch)
28 BRANCH="$2"
29 shift # past argument
30 shift # past value
31 ;;
32 --default)
33 DEFAULT=YES
34 shift # past argument
35 ;;
36 *) # unknown option
37 POSITIONAL+=("$1") # save it in an array for later
38 shift # past argument
39 ;;
40esac
41done
42set -- "${POSITIONAL[@]}" # restore positional parameters
43
44echo "VERSION = ${VERSION}"
45echo "BRANCH = ${BRANCH}"
46
47current_time=$(date "+%m.%d-%H.%M")
48echo "Current Time : $current_time"
49
50filename="android-${VERSION}-cdd-${current_time}"
51echo "$filename"
52
53if [ -z "${VERSION+x}" ] || [ -z "${BRANCH+x}" ];
54then
55 echo "No variables!"
56 python make_cdd.py --output $filename;
57else
58 echo "Variables!"
59 python make_cdd.py --version $VERSION --branch $BRANCH --output $filename;
60fi
61
62wkhtmltopdf -B 1in -T 1in -L .75in -R .75in page $filename.html --footer-html source/android-cdd-footer.html /tmp/$filename-body.pdf
63wkhtmltopdf -s letter -B 0in -T 0in -L 0in -R 0in cover source/android-cdd-cover.html /tmp/$filename-cover.pdf