2
0
mirror of synced 2025-02-23 14:58:12 +00:00

688 Commits

Author SHA1 Message Date
Burcu Dogan
232ac8377e asset,exp/audio/al: cast context to jobject
Fixes golang/go#13823.

Change-Id: I13fc9234a2fb991312c148e7d779271454cb7b90
Reviewed-on: https://go-review.googlesource.com/18511
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-11 21:23:51 +00:00
David Crawshaw
b4e66eeef7 app: remove iOS system draw loop
Much like the recent change for OS X, this puts the Go paint loop in
control of drawing onto the screen.

Change-Id: I37321e4bb58869d4c7cafc51951ea64e540d536b
Reviewed-on: https://go-review.googlesource.com/15611
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-01-11 18:20:11 +00:00
David Crawshaw
ab6091a309 bind: do not generate unused Seq objects
Updates golang/go#12619

Change-Id: Ie851795580c82ade3ee70bdb3945b23ca72f57e0
Reviewed-on: https://go-review.googlesource.com/17866
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-01-11 18:08:22 +00:00
Daniel Skinner
f85352c0f7 binres: method for resolving name as tableref
Change-Id: If31bab76ccb5b03540d86356c74107fe5ec99be6
Reviewed-on: https://go-review.googlesource.com/18490
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-10 23:57:01 +00:00
David Crawshaw
e27aacb64e example/sprite: delete
Andrew's new example/flappy does a better job of demoing off these
packages, and I would like to keep our example count under contorl.

Change-Id: I77f4da78815055ab91510ce0cb97bbd7ac1bac3b
Reviewed-on: https://go-review.googlesource.com/18381
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-08 15:21:00 +00:00
Hyang-Ah Hana Kim
aebde7cd7d app/internal/callfn: allow android/386,amd64
For golang/go#10743

Change-Id: I374fae9d6e0a7926b26647fe462968df3c0e3298
Reviewed-on: https://go-review.googlesource.com/17679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-08 08:14:44 +00:00
Nigel Tao
2e06e2c92c event/lifecycle: add an Event.String method.
Change-Id: I5d648327cf39cd3b2cf97fa08a094744528221fe
Reviewed-on: https://go-review.googlesource.com/18400
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-08 07:36:36 +00:00
Nigel Tao
a103499a63 event/size: make methods take values, not pointers.
This makes the following program valid:

----
package main

import (
    "fmt"

    "golang.org/x/mobile/event/size"
)

func foo() size.Event { return size.Event{} }

func main() {
    fmt.Println(foo().Bounds())
}
----

Previously, you would get:
./main.go:12: cannot call pointer method on foo()
./main.go:12: cannot take the address of foo()

Change-Id: I2801d18a04d56d1c7496cb008531d078490ccf86
Reviewed-on: https://go-review.googlesource.com/18356
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-07 22:44:33 +00:00
Daniel Skinner
cc29d844e9 internal/binres: provide decoding of resources.arsc in platform sdk
This decodes enough information to allow validation of resource
names but not their values, though a simple method for querying
does not yet exist.

Change-Id: I32023f3de0eda390b12d5c1df6c06202ee4d0778
Reviewed-on: https://go-review.googlesource.com/18055
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-07 20:31:34 +00:00
Daniel Skinner
d6f00813f9 improve readability of Pool.UnmarshalBinary
Change-Id: If0a0ac668f910a8dd5a05b87e841403b8d390de1
Reviewed-on: https://go-review.googlesource.com/18121
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-07 20:28:16 +00:00
David Crawshaw
54b4a066d7 gl: add a comment for linux installation
OpenGL ES is not installed by default on linux distributions, which
can lead to a cryptic error. Add a comment after the #include
mentioning what packages contain OpenGL ES on Ubuntu, which is
helpfully printed in the error message. For example:

	$ go build golang.org/x/mobile/example/basic
	# golang.org/x/mobile/gl
	In file included from ../../mobile/gl/work.go:21:0:
	work.h:6:117: fatal error: GLES2/gl2.h: No such file or directory
	 #include <GLES2/gl2.h> // install on Ubuntu with: sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev libx11-dev

Change-Id: Ia7ba583cee4dfdeed408f582b29da90de9a4fab3
Reviewed-on: https://go-review.googlesource.com/18058
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-01-07 20:14:32 +00:00
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 b84795b4945bb0ca4d464ffff3cba37d2ff049c5.

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