Commit Graph

727 Commits

Author SHA1 Message Date
nobonobo 48c96a5e62 x/mobile/app: panic with palm touch on iOS app
improved a problem that continues to maintain a touch-ID
that must be discarded by 'touchesCanceled' event.

Fixes golang/go#13435

Change-Id: I13635255e5317bba2202bf7a8d2dd957f7824d0a
Reviewed-on: https://go-review.googlesource.com/18180
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-07 19:21:52 +00:00
Andrew Gerrand 441a9620b3 example/flappy: document texture issue, re-enable reset
Change-Id: I80ba6b4421e64c5470f7b88c92b89ca3686ebec4
Reviewed-on: https://go-review.googlesource.com/18352
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-07 03:28:10 +00:00
Andrew Gerrand 746653dcb3 example/flappy: add simple example game
This game was developed for and presented at GoCon Winter 2015 in Tokyo.

Change-Id: I08148e16a54355b79f634dce867b3c3c0a0153cb
Reviewed-on: https://go-review.googlesource.com/18245
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-07 03:14:55 +00:00
Andrew Gerrand 44f634ba28 exp/gl/glutil: set blend mode when drawing sprites
Change-Id: Ib8a3dc3b08c8d64f2d461f943c8ebab75578a127
Reviewed-on: https://go-review.googlesource.com/17320
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-07 02:45:44 +00:00
Shenghou Ma 0a85ca5e85 x/mobile/app: fix doc typo
Change-Id: I108b8d80eb1fee120e7b710ee7dcdbca7ff158c3
Reviewed-on: https://go-review.googlesource.com/18122
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-12-25 00:41:33 +00:00
Hyang-Ah (Hana) Kim 4f51fe273b cmd/gomobile: fix a bug in handling -target=ios flag value
When -target=ios, GOOS must be 'darwin'.

Fixes golang/go#13670

Change-Id: Ie20db14cf24d886e13d9fe2e70caa0308790ad87
Reviewed-on: https://go-review.googlesource.com/18042
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-20 01:26:56 +00:00
Daniel Skinner c897050410 cmd/gomobile: new binary resource implementation
Change-Id: I9708170ac2c5914bb8e978b4703f4e6f7415c737
Reviewed-on: https://go-review.googlesource.com/16553
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-19 16:02:19 +00:00
David Crawshaw 2f30cbe53f gl: regenerate gldebug.go
Change-Id: Ifbc2664ee531fc3894e1ccdca314a00aef247e9d
Reviewed-on: https://go-review.googlesource.com/17864
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-18 20:31:45 +00:00
Alex Brainman a91f1aade3 x/mobile/gl: include textflag.h in work_windows_amd64.s
Fixes golang/go#13649

Change-Id: Ic552c74489e6aa11c0d2316073f623e2936d608d
Reviewed-on: https://go-review.googlesource.com/17922
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-17 17:59:11 +00:00
Hyang-Ah Hana Kim da67c3e85b cmd/gomobile: extend -target to accept {android,ios}/{arch} pairs
Not updated the doc yet.

Not useful for iOS yet.

For golang/go#10743

Change-Id: Iaffc41af2c876aa5889c44aae459241af9ec206e
Reviewed-on: https://go-review.googlesource.com/17580
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-16 19:04:55 +00:00
David Crawshaw 6c7eb6c445 app: add shiny backend
Combined with the outstanding shiny CLs and prebuilt ANGLE dlls in the
right place, this makes it possible to run example/basic on a windows
machine.

Eventually this shiny backend will also replace the app package's
custom darwin_amd64 and linux_x11 backends.

For golang/go#9306

Change-Id: Ia4bf9a85b9d903d79cee36abb470a0ad57f09f36
Reviewed-on: https://go-review.googlesource.com/17777
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-15 18:31:03 +00:00
Hyang-Ah Hana Kim 1c29ae2e00 cmd/gomobile: fix bugs introduced by cl/17749
These bugs broke the example/audio app

1) Use of wrong index value for nmpkgs.
2) Must not use both armeabi-v7a and armeabi directories in an app.
   Only one of them will be scanned.

Change-Id: I0180405e35038db152058961a92c41bc39760a10
Reviewed-on: https://go-review.googlesource.com/17860
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-15 17:22:44 +00:00
David Crawshaw 6da7fa8e54 gl: download ANGLE if necessary
For golang/go#9306

Change-Id: Ibb469d843d2bddeaa3690c59bc9ad532ea3473f7
Reviewed-on: https://go-review.googlesource.com/17810
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-12-15 16:29:01 +00:00
Hyang-Ah Hana Kim ab5e5f68d8 cmd/gomobile: update init/bind/build for multiple android archs
init command installs std for all the architectures supported by the
current go tool version (as listed in androidEnv).

build and bind commands pass the list of architectures to the underlying
functions. The list is currently hard-coded []string{"arm"}. In a
separate CL, the list will be populated from the -target flag value.

Still targets arm devices only.

For golang/go#10743

Change-Id: I62b5899859e76ad78a2dc55111e87aa13a68a1f9
Reviewed-on: https://go-review.googlesource.com/17749
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-14 21:21:36 +00:00
Hyang-Ah Hana Kim 0a84d43930 cmd/gomobile: refactor android*Env to handle more architectures
This does not change the tool's behavior.

The global ndkConfig 'ndk' holds info on all supported architectures
with the latest Go and gomobile tools (tip), and provides Root and
Toolchain methods that returns the current NDK installation directory
and the toolchain info depending on the GOPATH and the current go
version.

The global androidEnv is a map from arch name to the env vars.

ndkccpath is replaced by ndk.Root.

For golang/go#10743

Change-Id: I70d8e7b3e9979836112eb82d50c468df4f4ab43f
Reviewed-on: https://go-review.googlesource.com/17720
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-14 21:18:57 +00:00
David Crawshaw 3abfce6c04 all: windows build tags
For golang/go#9306

Change-Id: Ia8778f5b371371d103c55c12606257ee7ca45fd4
Reviewed-on: https://go-review.googlesource.com/17778
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-14 17:43:10 +00:00
David Crawshaw 2fe199687c gl: fix build
Change-Id: If3888b1795ca4c701f99e2021bcac4e860f96b7b
Reviewed-on: https://go-review.googlesource.com/17774
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-14 15:28:16 +00:00
David Crawshaw 576c75e780 gl: remove data race on cStrings
Each GL context is used serially, so make the map context-specific.

For golang/go#9306

Change-Id: Ic8261795312bf404f765a9ae8969468f4d170dae
Reviewed-on: https://go-review.googlesource.com/17772
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-14 15:24:25 +00:00
David Crawshaw 8851c9af31 gl: add windows implementation based on ANGLE
ANGLE is an open source project that implements OpenGL ES on top of
DirectX. It is used by Chrome to implement WebGL:

	https://github.com/google/angle

It can be compiled into libGLESv2.dll/libEGL.dll and used directly
from Go. This CL includes the changes necessary to the gl package
to use ANGLE.

For the EGL changes, I intend to get x/exp/shiny/driver/gldriver
working, and then make x/mobile/app use it when compiling for
GOOS=windows. (The dependency on shiny's screen package will only
hold when building for desktop OSs.)

For golang/go#9306

Change-Id: I01cb39bc8b56547584b7992eab437bd7ed0312b5
Reviewed-on: https://go-review.googlesource.com/17675
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-12-14 15:00:07 +00:00
David Crawshaw 2b7eb78ade gl: factor cgo types out of gl.go
This allows a subsequent CL to introduce windows support by directly
calling an ANGLE dll.

For golang/go#9306

Change-Id: I7dbe8f2b77b9e2c744f0d848f716ee4448916fe7
Reviewed-on: https://go-review.googlesource.com/17674
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-14 14:29:55 +00:00
Hyang-Ah Hana Kim 563f2bdd3a cmd/gomobile: update hashes of gomobile-ndk-*
These tar.gz include x86, x86_64 tools and libraries.
This CL will be submitted once the files are available from dl servers.

Updates golang/go#10743

Change-Id: I4dd59221f392d6daf4d13ab7af38d01b8e6f4546
Reviewed-on: https://go-review.googlesource.com/17560
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-12 00:00:47 +00:00
Hyang-Ah Hana Kim cd12613973 cmd/gomobile/release.go: include x86, x86_64 toolchains
3x the stripped ndk size - still smaller than the full NDK archive
(400MB vs 120MB)

Update golang/go#10743

Change-Id: I38e2abb01c64d38adbb5de55347ad92a9031aba6
Reviewed-on: https://go-review.googlesource.com/17502
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-10 02:09:38 +00:00
Sridhar Venkatakrishnan 2b73c5f386 bind: iOS support for multiple packages.
As discussed in golang/go#12245

Usage: gomobile bind [options] a.b.c x.y.z

For ObjC, gomobile bind will generate GoC.{h,m} and GoZ.{h,m}. If
-prefix=App is specified it will generate AppC.{h,m} and AppZ.{h,m}.

Tested on Darwin.

Change-Id: I6af8539a0fb7ed6256f3773efc514eff436014b4
Reviewed-on: https://go-review.googlesource.com/17475
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-09 16:24:12 +00:00
David Crawshaw e154aff74e bind/java: custom int-keyed hashmap
This removes the last dependency on an Android class in the running
gobind code. (Tests still need some work before they will run on the
desktop.)

Change-Id: I49bfb545d4587c6f430c0938fa1ca4d513b56d77
Reviewed-on: https://go-review.googlesource.com/17252
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-02 14:48:43 +00:00
David Crawshaw 2454c829c1 bind/java: move android-specific context code
Change-Id: I7b1dfae97576c7bb2d45e6c2a5732e20df79a77b
Reviewed-on: https://go-review.googlesource.com/17251
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-02 14:44:46 +00:00
Hyang-Ah Hana Kim 0a581ceb1e bind/java: do not return null String for empty Go string
Fixes golang/go#13430

Change-Id: Ic018761af6a40f6b04ec4449110f54af8f543a53
Reviewed-on: https://go-review.googlesource.com/17273
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-01 20:12:01 +00:00
Hyang-Ah Hana Kim 01216d9779 cmd/gomobile: do not pass -i to 'go install' command
Fixes golang/go#13407

Also updates bind test.

'gomobile bind' currently runs 'go install' first and generates code
from the compiled object. This makes the -i option unnecessary.
Updated the bind command doc not to mention the -i option.

The use of -i option from Android Studio GoBind plugin will be removed
in a separate CL.

Change-Id: Ie48c00874219adb5169e01d3ba61930728cf2314
Reviewed-on: https://go-review.googlesource.com/17253
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-30 21:48:35 +00:00
Meir Fischer 9cdfd16af3 bind: use single Ref for null objects
The aim of the RefTracker is to "... pin Java objects so
they don't get GCed while the only reference to them is
held by Go code." But in the case of null objects there is
nothing to GC. Therefore we do return a single Ref which
contains a null object, but we ignore the logic that is used
to pin for GC purposes.

Change-Id: If3771ec0180d09485963c3297abccb39a1a8d9ab
Reviewed-on: https://go-review.googlesource.com/13647
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-30 20:03:33 +00:00
David Crawshaw 7b89485f3d bind/java: use standard Java Logger
Change-Id: I47c9ba45d3c366821856c1a28bb945ed11b6e18a
Reviewed-on: https://go-review.googlesource.com/17234
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-30 17:41:42 +00:00
Hyang-Ah Hana Kim 6295a61f59 cmd/gobind: delete unused parseFiles func
Change-Id: I1f9678671692becde0721347721bea65530146ee
Reviewed-on: https://go-review.googlesource.com/17190
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-24 15:52:38 +00:00
Sridhar Venkatakrishnan 71a0e8bda1 bind: Android support for multiple packages.
As discussed in golang/go#12245

Usage: gomobile bind [options] a.b.c x.y.z

For java gobind and gomobile  will generate go.c.C.java and go.z.Z.java.
If -javapkg=com.example is specified they will generate
com.example.C.java and com.example.Z.java.

Tested on Darwin.

Change-Id: Ia8e57c8fec7967131d55de71cc705d9e736ccca0
Reviewed-on: https://go-review.googlesource.com/17023
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-24 12:33:02 +00:00
David Crawshaw 0d55c986b8 cmd/gomobile: make -n work with bind
Fixes golang/go#13323.

Change-Id: Ica213b7d06581ac7a0492184a903752cfa15d889
Reviewed-on: https://go-review.googlesource.com/17090
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-20 17:04:45 +00:00
Hyang-Ah (Hana) Kim b39ed682d8 cmd/gomobile: sanitize android app package names
https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

"This can occur if the domain name contains a hyphen or other special
character, if the package name begins with a digit or other character
that is illegal to use as the beginning of a Java name, or if the
package name contains a reserved Java keyword, such as "int". In this
event, the suggested convention is to add an underscore."

The sanitized name is used for the app package name and the default apk
file name.

Update golang/go#12273

Change-Id: I76d7f423e87c54a5bb7ab71ec251fd3a26da9722
Reviewed-on: https://go-review.googlesource.com/16875
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-18 17:26:55 +00:00
David Crawshaw d95efb4572 internal/loader: delete
Change-Id: I1ffaf6139d43ef4b13665abc975f4482c327eb34
Reviewed-on: https://go-review.googlesource.com/16914
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 19:26:15 +00:00
David Crawshaw d4beed2e0a cmd/gomobile: load from export data, not source
Replace the vendored version of x/tools/go/loader with the standard
library's go/importer package. This reads the export data from
$GOPATH/pkg/pkgname.a instead of parsing and type checking the source
code. The "go install" subcommand is invoked just prior to reading
the export data to make sure the export data is up to date.

Not yet tested on darwin, but working for android builds.

Change-Id: I24aa60aa46b843d30bc5833e3035699900bf3df4
Reviewed-on: https://go-review.googlesource.com/16913
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 19:25:59 +00:00
David Crawshaw f8cb2f0e7e cmd/gomobile: expose goVersion to subcommands
Pulled out of golang.org/cl/16913.

Change-Id: I041aba4e8cefed95ee2935139571140164b5d677
Reviewed-on: https://go-review.googlesource.com/17001
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 18:51:34 +00:00
David Crawshaw a6a27b7fc9 cmd/gomobile: say why a version is unknown
Fixes golang/go#13238

Change-Id: Ib44f9833891d721843a0fa255d9a86f1c7d43902
Reviewed-on: https://go-review.googlesource.com/16929
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 12:58:04 +00:00
David Crawshaw 8835366576 cmd/gomobile: build android stdlib
Second attempt at the change reverted in golang.org/cl/16917.

The current code executes go install -buildmode=c-shared std, which
does nothing. (See golang/go#13234.)

Correctly compiling packages for android arm requires different
flags on Go 1.5 and 1.6, as we now build PIC. So we look for go1.5
in the output of "go version", and otherwise assume 1.6+.

Change-Id: If636f52be5019bd179483b8735630a98e6f8d201
Reviewed-on: https://go-review.googlesource.com/16928
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-16 15:38:01 +00:00
Hyang-Ah Hana Kim 4f9c718489 Revert "cmd/gomobile: avoid -buildmode for go install std"
This reverts commit b84795b494.

See golang/go#13246

Change-Id: Ie8b89a9ac6e5b6906b3a4de21122d694cf7a2d0a
Reviewed-on: https://go-review.googlesource.com/16917
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-14 03:18:11 +00:00
David Crawshaw daecc566fd cmd/gobind: load from export data, not source
Replace the vendored version of x/tools/go/loader with the standard
library's go/importer package. This reads the export data from
$GOPATH/pkg/pkgname.a instead of parsing and type checking the source
code. The "go install" subcommand is invoked just prior to reading the
export data to make sure the export data is up to date.

This has the advantage of relying entirely on the go tool for correctly
resolving and parsing dependencies of the package being bound. (For
example, a bound package can now depend on cgo.) It also removes a class
of bugs where the version of the loader we depend on can get out of sync
with the go tool. (For example, gobind now correctly handles vendor
dependencies.)

As a bonus, for packages with significant dependencies this approach
should also be noticeably faster as we do not need to parse and
typecheck all of the dependencies.

Change-Id: If9a431c137eae2071c1d89be88a4a6a61d6812fa
Reviewed-on: https://go-review.googlesource.com/16911
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 20:01:33 +00:00
David Crawshaw b84795b494 cmd/gomobile: avoid -buildmode for go install std
Turns out that go install -buildmode=c-shared std does nothing. The go
tool filters all non-main packages from c-shared builds, which for the
standard library is all packages.

This may be a bug in the go tool. I'm not sure yet. But either way, to
make the gomobile tool work with Go 1.5, work around it here.

Change-Id: Ica1e7eeb0f40a21a2c78b0c55bdc54f133a32ee5
Reviewed-on: https://go-review.googlesource.com/16912
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 20:00:04 +00:00
David Crawshaw e2a9091da2 bind: remove extra "package" from error string
Fixes golang/go#13064

Change-Id: I2cde12a831607cd37d9760d92c0ef0f53fd6dd8b
Reviewed-on: https://go-review.googlesource.com/16351
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 12:13:51 +00:00
Daniel Skinner 3b97f7024e cmd/gomobile: synthesize minSdkVersion for manifest
Fixes golang/go#13172

Change-Id: I16cab3f74f668ce3522a1a14c979aca5c988347c
Reviewed-on: https://go-review.googlesource.com/16843
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-13 09:00:34 +00:00
Hyang-Ah Hana Kim a54776c08a bind, internal/loader: fix errors reported by vet
Change-Id: Ia1c2e13cd093fec1c4d6c38828b057d1a38274e4
Reviewed-on: https://go-review.googlesource.com/16841
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-11 22:33:35 +00:00
Hyang-Ah (Hana) Kim 4eceb7296e bind: error on named basic types
error message example:

 gomobile: unsupported named type github.com/sridharv/bugreports/typealiasmissing.Alias

Objective-C and Java generation code currently panics, which need to be
fixed separately. (See TODO in bind/seq.go)

Fixes golang/go#13190

Change-Id: Ie46dc58ea800522b8ab7cb8ac662ad561e0ca82e
Reviewed-on: https://go-review.googlesource.com/16780
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-11-11 22:33:09 +00:00
Hyang-Ah Hana Kim 9c6db08f1d bind/objc/testpkg: delete accidentally committed files.
Change-Id: I9a2a83ef64cb9ee877db952ff6f8e050cd52873d
Reviewed-on: https://go-review.googlesource.com/16840
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-11 22:32:48 +00:00
Angelo Bulfone 8adb9ed3fb exp/sprite/portable: revert for /x/image/draw api
Fix broken build that was broke by "fix[ing] broken build"

Beaking change: http://golang.org/cl/13970
Reverting to state after http://golang/org/cl/12774

Change-Id: Ibb054467ca374d1f9ccff0ec1874a3e567d0c325
Reviewed-on: https://go-review.googlesource.com/16021
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-10 13:59:11 +00:00
Hyang-Ah Hana Kim 1452f035be cmd/gomobile, asset: specify vanity import paths
Change-Id: I3740f3be3d229c308e12f94bb88d8c8b8a411d19
Reviewed-on: https://go-review.googlesource.com/16636
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-05 15:43:03 +00:00
Burcu Dogan 3ca3fec8ee exp/audio/al: add Capability type, export distance model capability
Fixes golang/go#11298.

Change-Id: I3f103a2c1a63e96ca8c7367994179fb32d5ec7db
Reviewed-on: https://go-review.googlesource.com/16435
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 21:42:10 +00:00
Burcu Dogan c6f2181dba cmd/gomobile: don't override the build tags
Fixes golang/go#13082.

Change-Id: I0956efb1045cc04dcda5034e2ff6e3089be192e0
Reviewed-on: https://go-review.googlesource.com/16433
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-28 20:22:40 +00:00