aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGina Dimino <gdimino@google.com>2019-01-23 10:46:16 -0800
committerGina Dimino <gdimino@google.com>2019-12-20 14:24:07 -0800
commitf3c78821531b7def0fbbb77dfe04d59f3e4bae46 (patch)
tree24154f626541c998245063072d3cd193882059ef
parented88ca860aada1b26093859cec3e88a15839a678 (diff)
downloadcdd-f3c78821531b7def0fbbb77dfe04d59f3e4bae46.tar.gz
CDD build script and helper shell script.
Test: ./cdd_gen.sh --version <version-number> --branch <branch-name> Change-Id: Iaec01dd19385623b7d53462969d8f604ffde45c9
-rwxr-xr-xcdd_gen.sh57
-rwxr-xr-xmake_cdd.py8
2 files changed, 39 insertions, 26 deletions
diff --git a/cdd_gen.sh b/cdd_gen.sh
index 5d9d7dd..86582eb 100755
--- a/cdd_gen.sh
+++ b/cdd_gen.sh
@@ -13,51 +13,66 @@
# pip install pytidylib
#
-POSITIONAL=()
+positional=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-v|--version)
- VERSION="$2"
+ version="$2"
shift # past argument
shift # past value
;;
-b|--branch)
- BRANCH="$2"
+ branch="$2"
shift # past argument
shift # past value
;;
--default)
- DEFAULT=YES
+ default=YES
shift # past argument
;;
*) # unknown option
- POSITIONAL+=("$1") # save it in an array for later
+ positional+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
-set -- "${POSITIONAL[@]}" # restore positional parameters
+set -- "${positional[@]}" # restore positional parameters
-echo "VERSION = ${VERSION}"
-echo "BRANCH = ${BRANCH}"
+if [ -z "${version}" ];
+then
+ read -p "Version number: " version
+fi
-current_time=$(date "+%m.%d-%H.%M")
-echo "Current Time : $current_time"
+if [ -z "${branch+x}" ];
+then
+ read -p "AOSP branch name for revision history: " branch
+fi
-filename="android-${VERSION}-cdd-${current_time}"
+echo "version = ${version}"
+echo "branch = ${branch}"
+
+current_date=$(date "+%m-%d")
+echo "Current Date : $current_date"
+
+filename="android-${version}-cdd-${current_date}"
echo "$filename"
-if [ -z "${VERSION+x}" ] || [ -z "${BRANCH+x}" ];
-then
- echo "No variables!"
- python make_cdd.py --output $filename;
-else
- echo "Variables!"
- python make_cdd.py --version $VERSION --branch $BRANCH --output $filename;
-fi
-wkhtmltopdf -B 1in -T 1in -L .75in -R .75in page $filename.html --footer-html source/android-cdd-footer.html /tmp/$filename-body.pdf
-wkhtmltopdf -s letter -B 0in -T 0in -L 0in -R 0in cover source/android-cdd-cover.html /tmp/$filename-cover.pdf
+python make_cdd.py --version $version --branch $branch --output $filename;
+
+mkdir -p /tmp/$filename
+
+wkhtmltopdf -B 1in -T 1in -L .75in -R .75in page $filename.html --footer-html source/android-cdd-footer.html /tmp/$filename/$filename-body.pdf
+wkhtmltopdf -s letter -B 0in -T 0in -L 0in -R 0in cover source/android-cdd-cover.html /tmp/$filename/$filename-cover.pdf
+
+
+mv $filename.html /tmp/$filename
+mv $filename-devsite.html /tmp/$filename
+
+echo ""
+echo "The generated files have been placed in the /tmp/$filename directory."
+echo "Please copy them to your Google Drive or another more permanent location."
+echo ""
diff --git a/make_cdd.py b/make_cdd.py
index f2e143c..b9ae036 100755
--- a/make_cdd.py
+++ b/make_cdd.py
@@ -23,8 +23,6 @@ import tidylib
HEADERS_FOR_TOC = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']
-global ANDROID_VERSION
-ANDROID_VERSION = "7.0, (N)"
TOC_PER_COL = 34
def get_section_info(my_path):
@@ -61,10 +59,10 @@ def get_section_info(my_path):
return section_info
-def get_soup(section_info):
+def get_soup(section_info, version):
html_body_text = u'''<!DOCTYPE html>
<head>
-<title>Android ''' + ANDROID_VERSION + ''' Compatibility Definition</title>
+<title>Android ''' + version + ''' Compatibility Definition</title>
<link rel="stylesheet" type="text/css" href="source/android-cdd.css"/>
<meta charset="utf-8" />
</head>
@@ -194,7 +192,7 @@ def main():
}
# Generate the HTML for PDF
- soup = get_soup(section_info)
+ soup = get_soup(section_info, ANDROID_VERSION)
add_id_to_section_headers(soup)
add_toc(soup)
html = soup.prettify(formatter='html')