Created
March 24, 2015 14:35
-
-
Save fadookie/a6f47da4bad601190e78 to your computer and use it in GitHub Desktop.
A script to build the SOOMLA Store Android plugin from source and install it into a Unity project. Read comments in the file header for setup instructions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is designed to build the SOOMLA Store android plugin, and install it into a Unity game. | |
# Update the variables in the config section below to customize for your environment. | |
# | |
# Copyright (c) 2014 Eliot Lash | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. | |
########## BEGIN CONFIG ########## | |
# Make sure to point this to your Unity project root, one level above the Assets directory: | |
YOUR_UNITY_PROJECT_PATH='PATH_TO_MY_UNITY_PROJECT' | |
# If you put this script in a directory containing all of the following SOOMLA git repositories, it should just work. Otherwise, update the paths below to point to all of these repos. | |
UNITY_STORE_PATH='unity3d-store' | |
ANDROID_STORE_PATH='unity3d-store/submodules/android-store' | |
UNITY_ANDROID_STORE_PATH='unity3d-store/soomla-native/projects/unity-android-store' | |
GOOGLEPLAY_STORE_PATH='android-store-google-play' | |
AMAZON_STORE_PATH='android-store-amazon' | |
########## END CONFIG ########## | |
set -o nounset #disallow unset vars | |
set -o errexit #strict error checking | |
set -o pipefail #commands in pipes can cause fatal errors | |
#Build core store jars | |
pushd "${ANDROID_STORE_PATH}/SoomlaAndroidStore" | |
./build_all | |
popd | |
pushd "${UNITY_ANDROID_STORE_PATH}" | |
./build_all | |
popd | |
ANDROID_STORE_JAR="${ANDROID_STORE_PATH}/build/AndroidStore.jar" | |
echo -e "\nANDROID STORE BUILD DONE. Copy jars to store implementations:" | |
cp -v "$ANDROID_STORE_JAR" "${GOOGLEPLAY_STORE_PATH}/libs/" | |
cp -v "$ANDROID_STORE_JAR" "${AMAZON_STORE_PATH}/libs/" | |
echo | |
#Build platform-specific store implementation jars | |
#Build Google Play | |
pushd "$GOOGLEPLAY_STORE_PATH" | |
set +o errexit #Temporarily disable error checking so we can print a help message if the build fails | |
./build_all | |
if [ "$?" -ne "0" ]; then | |
echo -e "\nCheck android-store-google-play/android-store-google-play.properties to make sure it's pointed at the right android SDK version(s) you have installed." | |
exit 1 | |
fi | |
set -o errexit | |
popd | |
#Build Amazon | |
pushd "$AMAZON_STORE_PATH" | |
./build_all | |
popd | |
echo -e "\nBUILD DONE. Copy final jars:" | |
UNITY_PLUGINS_PATH="${YOUR_UNITY_PROJECT_PATH}/Assets/Plugins/Android" | |
#Copy to active plugins folder | |
cp -v "$ANDROID_STORE_JAR" "$UNITY_PLUGINS_PATH" | |
cp -v "${AMAZON_STORE_PATH}/build/AndroidStoreAmazon.jar" "$UNITY_PLUGINS_PATH" | |
cp -v "${GOOGLEPLAY_STORE_PATH}/build/AndroidStoreGooglePlay.jar" "$UNITY_PLUGINS_PATH" | |
cp -v "${UNITY_STORE_PATH}/Soomla/Assets/Plugins/Android/UnityAndroidStore.jar" "$UNITY_PLUGINS_PATH" | |
#Copy to backup plugins folder (where SOOMLA copies out jars from when switching platforms) | |
cp -v "${AMAZON_STORE_PATH}/build/AndroidStoreAmazon.jar" "${YOUR_UNITY_PROJECT_PATH}/Assets/Soomla/compilations/android/android-billing-services/amazon/" | |
cp -v "${GOOGLEPLAY_STORE_PATH}/build/AndroidStoreGooglePlay.jar" "${YOUR_UNITY_PROJECT_PATH}/Assets/Soomla/compilations/android/android-billing-services/google-play/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment