Skip to content

Instantly share code, notes, and snippets.

@mattrude
Created June 11, 2014 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattrude/d8c5a5c0c71047bcf780 to your computer and use it in GitHub Desktop.
Save mattrude/d8c5a5c0c71047bcf780 to your computer and use it in GitHub Desktop.
(Legacy) Google Chrome Extension End-To-End build script, please see https://gist.github.com/mattrude/dbd3660802ae35572fc6 for the updated script.
#!/bin/bash
# end-to-end build script
# Matt Rude <matt@mattrude.com>
# Created: 11-June-2014
#
# This is the Google Chrome Extension End-To-End build script,
# the code may be found at: https://code.google.com/p/end-to-end/
# This is the same instructions as is found on the end-to-end site.
#
# This scirpt was built for Ubuntu 14.04 LTS, but should be able
# to work on almost any linux based system, with a few minor tweeks
# to the update process.
DIR='/root/'
PACKETS="curl git unzip subversion"
function check {
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "error with $1" >&2
exit 1
fi
return $status
}
# Install Needed Packets
UPDATE=""
dpkg --get-selections |awk '{print $1}' > /tmp/installed-packages.txt
for a in $PACKETS
do
if [ `egrep "^$a$" /tmp/installed-packages.txt |wc -l` != "1" ]; then
echo "$a is not installed"
UPDATE="$a $UPDATE"
fi
done
if [ "$UPDATE" != "" ]; then
apt-get install -y $UPDATE
fi
# create directory
rm -rf $DIR/e2e_dev
mkdir $DIR/e2e_dev
cd $DIR/e2e_dev
# checkout code
check git clone https://code.google.com/p/end-to-end/
# checkout closure library
check git clone https://github.com/google/closure-library/
# checkout closure templates
check svn checkout https://closure-templates.googlecode.com/svn/trunk/ closure-templates
# checkout zlib.js
check git clone https://github.com/imaya/zlib.js
check mkdir typedarray
check ln -s ../zlib.js/define/typedarray/use.js typedarray/use.js
# checkout js compiler
check curl https://dl.google.com/closure-compiler/compiler-latest.zip -O # -k --ssl-added-and-removed-here-;-)
check unzip compiler-latest.zip
# checkout css compiler
check curl https://closure-stylesheets.googlecode.com/files/closure-stylesheets-20111230.jar -O
##########
# Compile the Code
# alias compilers
shopt -s expand_aliases
alias jscompile_e2e="python closure-library/closure/bin/build/closurebuilder.py --root end-to-end --root closure-library --root closure-templates/javascript --root zlib.js/src --root typedarray -o compiled -c compiler.jar"
alias csscompile_e2e="java -jar closure-stylesheets-20111230.jar end-to-end/javascript/crypto/e2e/extension/ui/styles/base.css"
# compile javascript files
jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/bootstrap.js > end-to-end/javascript/crypto/e2e/extension/launcher_binary.js
a=$?
jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/helper/helper.js > end-to-end/javascript/crypto/e2e/extension/helper_binary.js
b=$?
jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/ui/glass/bootstrap.js > end-to-end/javascript/crypto/e2e/extension/glass_binary.js
c=$?
jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/ui/prompt/prompt.js > end-to-end/javascript/crypto/e2e/extension/prompt_binary.js
d=$?
jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/ui/settings/settings.js > end-to-end/javascript/crypto/e2e/extension/settings_binary.js
e=$?
jscompile_e2e -i end-to-end/javascript/crypto/e2e/extension/ui/welcome/welcome.js > end-to-end/javascript/crypto/e2e/extension/welcome_binary.js
f=$?
JSERRORS=`echo $(($a+$b+$c+$d+$e+$f))`
if [ $JSERRORS != 0 ]; then
echo "error in jscompile_e2e"
exit 1
fi
# copy html files
check find end-to-end/javascript/crypto/e2e/extension/ui -regex .*.html -exec cp -f "{}" end-to-end/javascript/crypto/e2e/extension/ \;
g=$?
if [ $g != 0 ]; then
echo "error in coping html files"
exit 1
fi
# copy css files
csscompile_e2e end-to-end/javascript/crypto/e2e/extension/ui/glass/glass.css > end-to-end/javascript/crypto/e2e/extension/glass_styles.css
h=$?
csscompile_e2e end-to-end/javascript/crypto/e2e/extension/ui/prompt/prompt.css > end-to-end/javascript/crypto/e2e/extension/prompt_styles.css
i=$?
csscompile_e2e end-to-end/javascript/crypto/e2e/extension/ui/settings/settings.css > end-to-end/javascript/crypto/e2e/extension/settings_styles.css
j=$?
csscompile_e2e end-to-end/javascript/crypto/e2e/extension/ui/welcome/welcome.css > end-to-end/javascript/crypto/e2e/extension/welcome_styles.css
k=$?
CSSERRORS=`echo $(($h+$i+$j+$k))`
if [ $CSSERRORS != 0 ]; then
echo "error in jscompile_e2e"
exit 1
fi
# copy gmonkey_stub.js
check cp -f end-to-end/javascript/crypto/e2e/extension/helper/gmonkeystub.js end-to-end/javascript/crypto/e2e/extension/gmonkeystub.js
l=$?
if [ $l != 0 ]; then
echo "error in coping gmonkey_stub.js"
exit 1
fi
echo ""
echo "Build Process Completed Successfully!"
echo "You may install the extension by coping the contents of $DIR/e2e_dev/end-to-end/javascript/crypto/e2e/extension to your desktop system and install via 'Options -> Tools -> Extensions'"
@thejh
Copy link

thejh commented Jul 11, 2014

# -k --ssl-added-and-removed-here-;-) :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment