diff --git a/example/sprite/AndroidManifest.xml b/example/sprite/AndroidManifest.xml deleted file mode 100644 index ac1c005..0000000 --- a/example/sprite/AndroidManifest.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/example/sprite/all.bash b/example/sprite/all.bash deleted file mode 100644 index 9ee4a54..0000000 --- a/example/sprite/all.bash +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2014 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# Script to build and launch the app on an android device. - -set -e - -./make.bash - -adb install -r bin/nativeactivity-debug.apk - -adb shell am start -a android.intent.action.MAIN \ - -n com.example.sprite/android.app.NativeActivity diff --git a/example/sprite/all.bat b/example/sprite/all.bat deleted file mode 100644 index 18d9974..0000000 --- a/example/sprite/all.bat +++ /dev/null @@ -1,16 +0,0 @@ -:: Copyright 2014 The Go Authors. All rights reserved. -:: Use of this source code is governed by a BSD-style -:: license that can be found in the LICENSE file. - -@echo off - -setlocal - -echo # building sprite -call make.bat - -echo # installing bin/nativeactivity-debug.apk -adb install -r bin/nativeactivity-debug.apk >nul - -echo # starting android.app.NativeActivity -adb shell am start -a android.intent.action.MAIN -n com.example.sprite/android.app.NativeActivity >nul \ No newline at end of file diff --git a/example/sprite/build.xml b/example/sprite/build.xml deleted file mode 100644 index 6bfc783..0000000 --- a/example/sprite/build.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/example/sprite/jni/Android.mk b/example/sprite/jni/Android.mk deleted file mode 100644 index b0bf948..0000000 --- a/example/sprite/jni/Android.mk +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2014 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := sprite -LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libsprite.so - -include $(PREBUILT_SHARED_LIBRARY) diff --git a/example/sprite/main.go b/example/sprite/main.go index 8cd2857..e081367 100644 --- a/example/sprite/main.go +++ b/example/sprite/main.go @@ -2,6 +2,65 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// TODO(jbd): Refer to http://golang.org/doc/install/source +// once Go 1.5 instructions are complete. + +// An app that demonstrates the sprite package. +// +// Note: This demo is an early preview of Go 1.5. In order to build this +// program as an Android APK using the gomobile tool, you need to install +// Go 1.5 from the source. +// +// Clone the source from the tip under $HOME/go directory. On Windows, +// you may like to clone the repo to your user folder, %USERPROFILE%\go. +// +// $ git clone https://go.googlesource.com/go $HOME/go +// +// Go 1.5 requires Go 1.4. Read more about this requirement at +// http://golang.org/s/go15bootstrap. +// Set GOROOT_BOOTSTRAP to the GOROOT of your existing 1.4 installation or +// follow the steps below to checkout go1.4 from the source and build. +// +// $ git clone https://go.googlesource.com/go $HOME/go1.4 +// $ cd $HOME/go1.4 +// $ git checkout go1.4.1 +// $ cd src && ./make.bash +// +// If you clone Go 1.4 to a different destination, set GOROOT_BOOTSTRAP +// environmental variable accordingly. +// +// Build Go 1.5 and add Go 1.5 bin to your path. +// +// $ cd $HOME/go/src && ./make.bash +// $ export PATH=$PATH:$HOME/go/bin +// +// Set a GOPATH if no GOPATH is set, add $GOPATH/bin to your path. +// +// $ export GOPATH=$HOME +// $ export PATH=$PATH:$GOPATH/bin +// +// Get the gomobile tool and initialize. +// +// $ go get golang.org/x/mobile/cmd/gomobile +// $ gomobile init +// +// It may take a while to initialize gomobile, please wait. +// +// Get the sprite example and use gomobile to build or install it on your device. +// +// $ go get -d golang.org/x/mobile/example/sprite +// $ gomobile build golang.org/x/mobile/example/sprite # will build an APK +// +// # plug your Android device to your computer or start an Android emulator. +// # if you have adb installed on your machine, use gomobile install to +// # build and deploy the APK to an Android target. +// $ gomobile install golang.org/x/mobile/example/sprite +// +// Switch to your device or emulator to start the Basic application from +// the launcher. +// You can also run the application on your desktop by running the command +// below. (Note: It currently doesn't work on Windows.) +// $ go install golang.org/x/mobile/example/sprite && sprite package main import ( diff --git a/example/sprite/make.bash b/example/sprite/make.bash deleted file mode 100644 index f45ae8d..0000000 --- a/example/sprite/make.bash +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2014 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -set -e - -if [ ! -f make.bash ]; then - echo 'make.bash must be run from $GOPATH/src/golang.org/x/mobile/example/sprite' - exit 1 -fi - -mkdir -p jni/armeabi -CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 \ - go build -ldflags="-shared" -o jni/armeabi/libsprite.so . -ndk-build NDK_DEBUG=1 -ant debug diff --git a/example/sprite/make.bat b/example/sprite/make.bat deleted file mode 100644 index 5dab3f9..0000000 --- a/example/sprite/make.bat +++ /dev/null @@ -1,44 +0,0 @@ -:: Copyright 2014 The Go Authors. All rights reserved. -:: Use of this source code is governed by a BSD-style -:: license that can be found in the LICENSE file. - -@echo off - -setlocal - -if not exist make.bat goto error-invalid-path - -if not exist jni\armeabi mkdir jni\armeabi - -set CGO_ENABLED=1 -set GOOS=android -set GOARCH=arm -set GOARM=7 - -go build -ldflags="-shared" -o jni/armeabi/libsprite.so . -if errorlevel 1 goto error-go-build - -if defined NDK_ROOT goto ndk-build -echo NDK_ROOT path not defined -goto end - -:ndk-build -call %NDK_ROOT%\ndk-build.cmd NDK_DEBUG=1 >nul - -if defined ANT_HOME goto ant-build -echo ANT_HOME path not defined -goto end - -:ant-build -call %ANT_HOME%\bin\ant.bat debug >nul -goto end - -:error-invalid-path -echo make.bat must be run from %%GOPATH%%\src\golang.org\x\mobile\example\sprite -goto end - -:error-go-build -echo Error building go lib -goto end - -:end \ No newline at end of file