Update bind script
This commit is contained in:
parent
637320804d
commit
6fba29c695
3 changed files with 39 additions and 28 deletions
36
app/bind.sh
Executable file
36
app/bind.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PROJECTPATH=$PWD
|
||||
export GOPATH="$PROJECTPATH/go"
|
||||
export GO111MODULE=on
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ./bind.sh <boxcars commit hash or tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
go mod init com.rocket9labs.boxcars || true
|
||||
|
||||
echo "Downloading bind..."
|
||||
go get golang.org/x/mobile/bind
|
||||
|
||||
echo "Downloading ebiten..."
|
||||
go get github.com/hajimehoshi/ebiten/v2@latest
|
||||
|
||||
echo "Installing ebitenmobile..."
|
||||
go install github.com/hajimehoshi/ebiten/v2/cmd/ebitenmobile@latest
|
||||
|
||||
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
|
||||
|
||||
echo "Binding boxcars..."
|
||||
mkdir -p libs
|
||||
PATH="$PROJECTPATH/go/bin:$PATH"
|
||||
cd $GOPATH/src/code.rocket9labs.com/tslocum/boxcars/game/mobile
|
||||
ebitenmobile bind -target android -androidapi 21 -javapkg com.rocket9labs.boxcars -o $PROJECTPATH/libs/boxcars.aar .
|
||||
|
||||
echo "Finished."
|
|
@ -39,11 +39,10 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs/boxcars', include: ['*.jar', '*.aar'])
|
||||
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
}
|
||||
|
||||
task bindBoxcars(type: Exec) {
|
||||
task bindLibrary(type: Exec) {
|
||||
workingDir "$projectDir"
|
||||
commandLine 'sh', '-c', './bind.sh v' + project.ext.boxcarsVersion
|
||||
commandLine 'sh', '-c', './bind.sh ' + project.ext.boxcarsVersion
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Specify the path to the game/mobile sub-package of boxcars."
|
||||
echo "Note: This script must be executed within \$GOPATH."
|
||||
exit
|
||||
fi
|
||||
|
||||
cwd=$(pwd)
|
||||
|
||||
go mod init com.rocket9labs.boxcars || true
|
||||
|
||||
echo "Downloading bind..."
|
||||
go get golang.org/x/mobile/bind
|
||||
echo "Downloading ebiten..."
|
||||
go get github.com/hajimehoshi/ebiten/v2@latest
|
||||
echo "Installing ebitenmobile..."
|
||||
go install github.com/hajimehoshi/ebiten/v2/cmd/ebitenmobile@latest
|
||||
echo "Binding application..."
|
||||
|
||||
cd "$1"
|
||||
ebitenmobile bind -target android -androidapi 21 -javapkg com.rocket9labs.boxcars -o boxcars.aar .
|
||||
mv boxcars.aar $cwd && mv boxcars-sources.jar $cwd
|
||||
echo "Finished"
|
Loading…
Reference in a new issue