forked from gree/unity-webview
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request gree#340 from gree/feature/android_build_steps
Feature/android build steps
- Loading branch information
Showing
7 changed files
with
92 additions
and
195 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,71 @@ | ||
#!/bin/sh | ||
|
||
# OS specific support. $var _must_ be set to either true or false. | ||
cygwin=false | ||
case "`uname`" in | ||
CYGWIN*) cygwin=true;; | ||
esac | ||
|
||
# For Cygwin, ensure paths are in UNIX format | ||
if $cygwin; then | ||
[ -n "$ANT_HOME" ] && ANT_HOME=`cygpath --unix "$ANT_HOME"` | ||
fi | ||
# required command | ||
JAR_CMD=`which jar` | ||
|
||
# directories | ||
CWD=`dirname $0` | ||
CWD=`cd $CWD && pwd -P` | ||
|
||
BUILD_DIR="${CWD}/gradle_build" | ||
LIBS_DIR="${BUILD_DIR}/libs" | ||
JAVA_DIR="${BUILD_DIR}/src/main/java" | ||
BIN_DIR="${CWD}/bin" | ||
|
||
# options | ||
MODE="Release" | ||
SCRIPTING_BACKEND="il2cpp" | ||
UNITY="/Applications/Unity" | ||
|
||
for OPT in $*; do | ||
case $OPT in | ||
'--release' ) | ||
MODE="Release";; | ||
'--develop' ) | ||
MODE="Develop";; | ||
'--il2cpp' ) | ||
SCRIPTING_BACKEND="il2cpp";; | ||
'--mono' ) | ||
SCRIPTING_BACKEND="mono";; | ||
'--unity' ) | ||
UNITY=$2 | ||
shift 2 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
UNITY_JAVA_LIB="${UNITY}/PlaybackEngines/AndroidPlayer/Variations/${SCRIPTING_BACKEND}/${MODE}/Classes/classes.jar" | ||
|
||
# clean | ||
rm -rf ${JAVA_DIR}/* | ||
rm -rf ${LIB_DIR} | ||
rm -f ${BUILD_DIR}/src/main/AndroidManifest.xml | ||
|
||
if $cygwin; then | ||
UNITYLIBS=`find -L "/cygdrive/c/Program Files/Unity5" | grep classes.jar | tail -1` | ||
pushd $CWD | ||
|
||
# copy unity library | ||
DEST_DIR='../../build/Packager/Assets/Plugins/Android' | ||
|
||
mkdir -p ${LIBS_DIR} | ||
mkdir -p ${BIN_DIR} | ||
mkdir -p ${DEST_DIR} | ||
mkdir -p ${JAVA_DIR} | ||
|
||
cp ${UNITY_JAVA_LIB} ${LIBS_DIR} | ||
cp -r src/net ${JAVA_DIR} | ||
cp AndroidManifest.xml ${BUILD_DIR}/src/main | ||
|
||
# build | ||
./gradlew assembleRelease | ||
|
||
if [ ${JAR_CMD} = "" ];then | ||
echo "jar command does not exist" | ||
else | ||
UNITYLIBS=`find -L /Applications/Unity | grep classes.jar | tail -1` | ||
jar cvf ${CWD}/bin/WebViewPlugin.jar -C ${BUILD_DIR}/build/intermediates/classes/release net | ||
cp -a ${BIN_DIR}/WebViewPlugin.jar ${DEST_DIR} | ||
fi | ||
|
||
DSTDIR="../../build/Packager/Assets/Plugins/Android" | ||
export ANT_OPTS=-Dfile.encoding=UTF8 | ||
android update project -t android-23 -p . | ||
mkdir -p libs | ||
cp "$UNITYLIBS" libs | ||
ant "-Djava.compilerargs=-Xlint:deprecation" release | ||
mkdir -p "$DSTDIR" | ||
cp -a bin/classes.jar "$DSTDIR/WebViewPlugin.jar" | ||
ant clean | ||
rm -rf libs res proguard-project.txt | ||
./gradlew clean | ||
|
||
popd # $BUILD_DIR |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.