45 lines
1.4 KiB
Bash
Executable file
45 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
LOCK_BIND=642950227fb3dd9e9ec517d7630b10397f1d5e01
|
|
LOCK_EBITENGINE=b17ae6135eb635594e971bafabae8ad93d7d0bf1
|
|
|
|
export PROJECTPATH=$PWD
|
|
export GOPATH="$PROJECTPATH/go"
|
|
export GO111MODULE=on
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Usage: ./bind.sh <boxcars tag, commit hash or local path>"
|
|
exit 1
|
|
fi
|
|
|
|
go mod init com.rocket9labs.boxcars || true
|
|
|
|
echo "Downloading bind..."
|
|
go get golang.org/x/mobile/bind@$LOCK_BIND
|
|
|
|
echo "Downloading ebitengine..."
|
|
go get github.com/hajimehoshi/ebiten/v2@$LOCK_EBITENGINE
|
|
|
|
echo "Installing ebitenmobile..."
|
|
go install github.com/hajimehoshi/ebiten/v2/cmd/ebitenmobile@$LOCK_EBITENGINE
|
|
|
|
BOXCARSPATH=""
|
|
if [[ "$1" == *\/* ]]; then
|
|
BOXCARSPATH=$1/game/mobile
|
|
else
|
|
echo "Downloading boxcars $1..."
|
|
mkdir -p $GOPATH/src/code.rocket9labs.com/tslocum
|
|
if [ ! -d "$GOPATH/src/code.rocket9labs.com/tslocum/boxcars" ]; then
|
|
git clone https://code.rocket9labs.com/tslocum/boxcars $GOPATH/src/code.rocket9labs.com/tslocum/boxcars
|
|
fi
|
|
cd $GOPATH/src/code.rocket9labs.com/tslocum/boxcars && git fetch origin && git reset --hard `printf %q "$1"` && cd $PROJECTPATH
|
|
BOXCARSPATH=$GOPATH/src/code.rocket9labs.com/tslocum/boxcars/game/mobile
|
|
fi
|
|
|
|
echo "Binding boxcars..."
|
|
mkdir -p libs
|
|
PATH="$PROJECTPATH/go/bin:$PATH"
|
|
cd $BOXCARSPATH
|
|
ebitenmobile bind -target android -androidapi 21 -javapkg com.rocket9labs.boxcars -o $PROJECTPATH/libs/boxcars.aar .
|
|
|
|
echo "Finished."
|