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 +++++++++- mobile.sh | 34 ++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 7 deletions(-) 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 diff --git a/mobile.sh b/mobile.sh index 6ec8a0e..0be97e3 100755 --- a/mobile.sh +++ b/mobile.sh @@ -16,6 +16,7 @@ scriptdir=$(readlink -e ".") # Requirements: # git, nodejs, android SDK / other platform(s) # cordova (https://cordova.apache.org/) +# optional: crosswalk-cordova (https://github.com/crosswalk-project/crosswalk-cordova-android) if [[ $2 != "" ]] then @@ -44,18 +45,39 @@ sed -i '/link rel="shortcut icon"/a\ # add everything needed and build for $device cordova platform add "$1" -cordova plugin add org.apache.cordova.plugin.softkeyboard -cordova plugin add org.apache.cordova.vibration -cordova plugin add org.apache.cordova.device-motion -cordova plugin add org.apache.cordova.device-orientation -cordova plugin add org.apache.cordova.geolocation -cordova plugin add de.appplant.cordova.plugin.local-notification +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 \ if [[ $1 == "android" ]] then # Remove default icons cd "$builddir/platforms/android" find -name '*.png' | xargs rm + + if [[ $crosswalk != "" ]] + then + # adapted from https://crosswalk-project.org/documentation/cordova/migrate_an_application.html#migrate + echo "Building with 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 + cd "$builddir" + # prepend permissions to end of manifest + sed -i "s,\,\ + \ + \ + \ + ,g" \ + "$builddir/platforms/android/AndroidManifest.xml" + fi fi cordova build "$1" -- cgit v1.3.1