blob: c133e3f0da5a27dcf67faa35a68bc7ca215f81d4 [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#
9# To run this script, you must install the jinja2 and wkhtmltopdf packages
10# using the apt-get install command.
11#
12
13POSITIONAL=()
14while [[ $# -gt 0 ]]
15do
16key="$1"
17
18case $key in
19 -v|--version)
20 VERSION="$2"
21 shift # past argument
22 shift # past value
23 ;;
24 -b|--branch)
25 BRANCH="$2"
26 shift # past argument
27 shift # past value
28 ;;
29 --default)
30 DEFAULT=YES
31 shift # past argument
32 ;;
33 *) # unknown option
34 POSITIONAL+=("$1") # save it in an array for later
35 shift # past argument
36 ;;
37esac
38done
39set -- "${POSITIONAL[@]}" # restore positional parameters
40
41echo "VERSION = ${VERSION}"
42echo "BRANCH = ${BRANCH}"
43
44current_time=$(date "+%m.%d-%H.%M")
45echo "Current Time : $current_time"
46
47filename="android-${VERSION}-cdd-${current_time}"
48echo "$filename"
49
50if [ -z "${VERSION+x}" ] || [ -z "${BRANCH+x}" ];
51then
52 echo "No variables!"
53 python make_cdd.py --output $filename;
54else
55 echo "Variables!"
56 python make_cdd.py --version $VERSION --branch $BRANCH --output $filename;
57fi
58
59wkhtmltopdf -B 1in -T 1in -L .75in -R .75in page $filename.html --footer-html source/android-cdd-footer.html /tmp/$filename-body.pdf
60wkhtmltopdf -s letter -B 0in -T 0in -L 0in -R 0in cover source/android-cdd-cover.html /tmp/$filename-cover.pdf