commit | 8952e43db88c785b10fba66c5c013335fcf89d1d | [log] [tgz] |
---|---|---|
author | Hana (Hyang-Ah) Kim <hyangah@gmail.com> | Tue Dec 16 15:55:37 2014 -0500 |
committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | Thu Dec 18 00:48:16 2014 +0000 |
tree | 628fc8c1d8e7b7ef3db5f40e8dc63d4aa37c29e5 | |
parent | e8bfa872c44da2295e976eaaf5ee597fec952961 [diff] |
build/androidtest.bash: script to run all tests in a repository on an android device. It assumes it runs in golang.org/x/mobile repository. This script copies the repository source tree into the connected device and invokes go test that runs using the binary compiled from go_android_exec.go. go_android_exec arranges to push and run the test binary to the right place in the android device. Change-Id: I4ac24bcfd8e26e01cccd3d7c2dddaf6b3c14951e Reviewed-on: https://go-review.googlesource.com/1680 Reviewed-by: David Crawshaw <crawshaw@golang.org>
The Go mobile repository holds packages and build tools for using Go on Android.
This is early work and the build system is a bumpy ride. Building a binary for Android requires using a Go cross compiler and an external linker from the NDK.
For now, the easiest way to setup a build environment is using the provided Dockerfile:
go get -d golang.org/x/mobile/... docker build -t mobile $GOPATH/src/golang.org/x/mobile
In your app directory under your $GOPATH
, copy the following files from either the golang.org/x/mobile/basic or golang.org/x/mobile/libhello apps:
AndroidManifest.xml all.bash build.xml jni/Android.mk make.bash
Start with basic
if you are writing an all-Go application (that is, an OpenGL game) or libhello if you are building a .so
file for use from Java via gobind. Edit the files to change the name of your app.
To build, run:
docker run -v $GOPATH/src:/src mobile /bin/bash -c 'cd /src/your/project && ./make.bash'
When working with an all-Go application, this will produce a binary at $GOPATH/src/your/project/bin/name-debug.apk
. You can use the adb tool to install and run this app. See all.bash for an example.
APIs are currently very limited, but under active development. Package documentation serves as a starting point:
Contributions to Go are appreciated. See https://golang.org/doc/contribute.html.