diff options
| author | Gubolin <gubolin@fantasymail.de> | 2015-02-22 15:37:06 +0100 |
|---|---|---|
| committer | Gubolin <gubolin@fantasymail.de> | 2015-02-22 15:37:06 +0100 |
| commit | 50f99d2d2eb68f812ad65ab7e717698bf5b95556 (patch) | |
| tree | 036d302e1ac62d3bb033404dd04e4c023336b4ee | |
| parent | 253c841a79c101db982731c9e56f953a8120ffc3 (diff) | |
| download | snap-50f99d2d2eb68f812ad65ab7e717698bf5b95556.tar.gz snap-50f99d2d2eb68f812ad65ab7e717698bf5b95556.zip | |
update to allow building with crosswalk
| -rwxr-xr-x | binary.sh | 10 | ||||
| -rwxr-xr-x | mobile.sh | 34 |
2 files changed, 37 insertions, 7 deletions
@@ -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 @@ -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,\</manifest\>,\ + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />\ + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />\ + <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />\ + </manifest>,g" \ + "$builddir/platforms/android/AndroidManifest.xml" + fi fi cordova build "$1" |
