From 50f99d2d2eb68f812ad65ab7e717698bf5b95556 Mon Sep 17 00:00:00 2001 From: Gubolin Date: Sun, 22 Feb 2015 15:37:06 +0100 Subject: update to allow building with crosswalk --- binary.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'binary.sh') diff --git a/binary.sh b/binary.sh index 4fb045a..23f1535 100755 --- a/binary.sh +++ b/binary.sh @@ -17,7 +17,15 @@ then echo " Mobile amazon-fireos android blackberry10 firefoxos ios ubuntu wp8 win8 tizen" echo " Desktop win32 win64 osx linux32 linux64" echo "" - echo "If FILE/URL is given, it will be #open-ed inside Snap\! immediately. URL will be loaded at runtime." + echo "If FILE/URL is given, it will be #open-ed inside Snap! immediately. URL will be loaded at runtime." + echo "" + echo "" + echo "The following environment variables will be used, if available:" + echo " snapsource Path or URL to the Snap! git repository. This repository must contain the branch" + echo " mobileapp with the configuration files! Default: https://github.com/Gubolin/snap.git" + echo " crosswalk Path to a crosswalk-cordova directory. Download \"Cordova Android\" here:" + echo " https://crosswalk-project.org/documentation/downloads.html" + echo " If omitted, standard cordova will be used." exit 0 fi -- cgit v1.3.1 From 82a9e40bf889099c92f7c7e1f246fe702710c818 Mon Sep 17 00:00:00 2001 From: Gubolin Date: Sun, 22 Feb 2015 15:59:31 +0100 Subject: use another approach for loading projects at startup; remove more unneeded files --- binary.sh | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'binary.sh') diff --git a/binary.sh b/binary.sh index 23f1535..74a8d62 100755 --- a/binary.sh +++ b/binary.sh @@ -36,7 +36,6 @@ scriptdir=$(readlink -e ".") # UglifyJS2 (https://github.com/mishoo/UglifyJS2) ide=true -url=false platform=$2 # presentation mode @@ -45,16 +44,6 @@ then ide=false fi -if [ $ide == false ] -then - if [ -f "$3" ] - then - content="'$(cat $3)'" - else - url=true - fi -fi - buildsource=$(mktemp -d) git clone $snapsource $buildsource cd "$buildsource" @@ -65,30 +54,27 @@ rm -rf .git/ if [ $ide == false ] then # minimize everything - rm lang* ypr.js paint.js cloud.js gui.js - rm -r help/ + rm lang* ypr.js paint.js cloud.js gui.js *.sh *.pdf *.txt + rm -r help/ Costumes/ Backgrounds/ Sounds/ sed -i '/paint\.js"/d' snap.html sed -i '/cloud\.js"/d' snap.html sed -i 's/gui\.js"/binary\.js"/' snap.html - # load custom project from file or url - if [ $url == false ] + # if a file was given, move it to "project.xml" + # it will be loaded like an URL then + if [ -f "$3" ] then - sed -i '/sha512\.js"/a\ - ' snap.html - - echo "var code =" > code.js - echo "$content" >> code.js - echo ";" >> code.js - - sed -i "/ide\.openIn/a\ - ide.droppedText(code); " snap.html + cp "$3" "project.xml" + url="project.xml" else - sed -i "/ide\.openIn/a\ - ide.droppedText(ide.getURL('$3')); " snap.html + url=$3 fi + # load custom project from url + sed -i "/ide\.openIn/a\ + ide.droppedText(ide.getURL('$url')); " snap.html + else rm binary.js fi -- cgit v1.3.1 From 13eed946d223a5c46d8857c74fd41efd9052ba01 Mon Sep 17 00:00:00 2001 From: Gubolin Date: Sun, 22 Feb 2015 16:25:01 +0100 Subject: fix mobile.sh typo and add better info messages --- binary.sh | 2 +- mobile.sh | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'binary.sh') diff --git a/binary.sh b/binary.sh index 74a8d62..9de5fa0 100755 --- a/binary.sh +++ b/binary.sh @@ -80,7 +80,7 @@ else fi # compress all js files -find . -name '*.js' | xargs -I {} uglifyjs {} -o {} -c +find . -name '*.js' | xargs -I {} uglifyjs {} -o {} -c 2> /dev/null # return to the directory where the script was called from cd "$scriptdir" diff --git a/mobile.sh b/mobile.sh index 0be97e3..edbf020 100755 --- a/mobile.sh +++ b/mobile.sh @@ -41,16 +41,17 @@ fi # add mobile-specific library; it's made available at runtime sed -i '/link rel="shortcut icon"/a\ - ' snap.html + ' snap.html +echo "Adding cordova plugins" # add everything needed and build for $device -cordova platform add "$1" +cordova platform add "$1" > /dev/null cordova plugin add org.apache.cordova.plugin.softkeyboard \ org.apache.cordova.vibration \ org.apache.cordova.device-motion \ org.apache.cordova.device-orientation \ org.apache.cordova.geolocation \ - de.appplant.cordova.plugin.local-notification \ + de.appplant.cordova.plugin.local-notification 2> /dev/null if [[ $1 == "android" ]] then @@ -61,27 +62,29 @@ then if [[ $crosswalk != "" ]] then # adapted from https://crosswalk-project.org/documentation/cordova/migrate_an_application.html#migrate - echo "Building with Crosswalk" + echo "Preparing crosswalk" rm -Rf "$builddir/platforms/android/CordovaLib/*" cp -a $crosswalk/framework/* "$builddir/platforms/android/CordovaLib/" cp -a "$crosswalk/VERSION" "$builddir/platforms/android/" export ANDROID_HOME=$(dirname $(dirname $(which android))) cd "$builddir/platforms/android/CordovaLib/" - android update project --subprojects --target android-21 --path . - ant debug + android update project --subprojects --target android-21 --path . > /dev/null + ant debug > /dev/null cd "$builddir" # prepend permissions to end of manifest - sed -i "s,\,\ - \ - \ - \ + sed -i "s,,\ + \ + \ + \ ,g" \ "$builddir/platforms/android/AndroidManifest.xml" fi fi -cordova build "$1" +echo "Building application" +cordova build "$1" > /dev/null cd $builddir # TODO other platforms find -name '*.apk' | xargs -I {} mv {} $scriptdir +echo "Finished." -- cgit v1.3.1