Commit Graph

517 Commits

Author SHA1 Message Date
David Crawshaw 8602f76ecd Revert "app: repalce JavaInit with RegisterAndroidInit"
Not thought through. For gobind-based apps, JNI_OnLoad is called and there is never any NativeActivity.

This reverts commit b781b80ee8.

Change-Id: Ib076f30d144cbacb7926d54981ac86bbb8a5a4ff
Reviewed-on: https://go-review.googlesource.com/4440
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-10 19:28:17 +00:00
David Crawshaw b781b80ee8 app: repalce JavaInit with RegisterAndroidInit
I am working on a virtual keyboard package that needs access to the
*ANativeActivity. As the *ANativeActivity contains *JavaVM, this CL
deprecates JavaInit. I'll remove it in a subsequent CL that updates
gobind to use RegisterAndroidInit.

Change-Id: Ib1d60bbaac5de4583b368c93ab90b764c6081291
Reviewed-on: https://go-review.googlesource.com/4400
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-10 18:52:00 +00:00
David Crawshaw c55730db15 cmd/gomobile: add build subcommand
Change-Id: I879e51834726c8713c5befeb4be2e328d5295af4
Reviewed-on: https://go-review.googlesource.com/4110
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-09 12:49:49 +00:00
Shenghou Ma c44ea393d0 cmd/gomobile: remove temporary files used in tests
Change-Id: I792edeed6bf8309084281eebcdba7d4b6c6a0818
Reviewed-on: https://go-review.googlesource.com/4181
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-08 22:37:23 +00:00
David Crawshaw d0e75fc927 cmd/gomobile: add init subcommand
Running gomobile init downloads the appropriate Android NDK
compiler toolchain and builds a Go cross compiler.

Details: https://docs.google.com/document/d/1cePOQ35PNEb_QqxnPAmBv0cEnAm7AQSGuz9wVeJ-lBs/edit?usp=sharing

Change-Id: I279f6ff0753f8776ae7d98f33a85ee4d0bbf5390
Reviewed-on: https://go-review.googlesource.com/3971
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-06 23:24:46 +00:00
Michael Matloob 4c31c789d7 gl: fix func name in doc comment for GetRenderbufferParameteri
Also s/bufer/buffer/ in comment for VertexAttribPointer.

Change-Id: Icb2ce35e4fed91939ebd00012e5caf88453fcbbf
Reviewed-on: https://go-review.googlesource.com/3959
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 09:33:13 +00:00
Burcu Dogan c67709898b mobile/audio: adding OpenAL bindings
The bindings are not working on Android currently. We may require
the users to build their own OpenAL library that is targetting
Android or may distribute a shared object.

Change-Id: Ibcfa3482aa53e9b3ec9bfddf5dd1622ad07b7b7e
Reviewed-on: https://go-review.googlesource.com/3115
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-04 14:48:47 +00:00
Hyang-Ah Hana Kim 40f92f7d9f mobile: add go 1.4 for bootstrap & pin the revision of Go.
Use revision 34bc85f6f3b02ebcd490b40f4d32907ff2e69af3.

Change-Id: I63293b7155883ce8f89942ed05842697a33fffde
Reviewed-on: https://go-review.googlesource.com/3146
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-23 16:07:06 +00:00
David Crawshaw 2695ecabb5 cmd/gomobile: APK writer
Files go in, a .apk file comes out. Effective testing depends
on the aapt tool being installed.

Change-Id: I10daaabe9090c10181d9a83b876a934d540023d3
Reviewed-on: https://go-review.googlesource.com/3049
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-21 18:02:26 +00:00
Hyang-Ah Hana Kim 90d6854261 mobile: add extra build tags.
missing ones from https://go-review.googlesource.com/#/c/2902/

Change-Id: If42f9e53bdd7be468315ad746ba35d397a874ee6
Reviewed-on: https://go-review.googlesource.com/2965
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-20 15:15:48 +00:00
David Crawshaw 8cbd6a23e3 cmd/gomobile: PKCS#7 signing
Does the equivalent of jarsigner for APKs.

Change-Id: Ie55ddb22ef9f56062034b091c9477fd9e9196310
Reviewed-on: https://go-review.googlesource.com/2904
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-20 11:00:55 +00:00
Burcu Dogan 098109e687 mobile: use the fully qualified Docker image name
Change-Id: Id9875cd07d18f6ca96ac64fd0b4537d69457d72c
Reviewed-on: https://go-review.googlesource.com/2922
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-16 17:55:11 +00:00
Hyang-Ah Hana Kim a8fcf739b9 mobile: limit app/font/gl packages to linux/darwin.
They don't make sense for other platforms yet.

See golang/go#9603

Change-Id: I2ed269a00b1e1961aadf0a47fc95bbe3cd230113
Reviewed-on: https://go-review.googlesource.com/2902
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-15 20:16:28 +00:00
David Crawshaw bf371f421b cmd/gomobile: android binary XML encoder
Change-Id: Ibbdd19990ecb64535baa55f81bbe7f2abcf118fd
Reviewed-on: https://go-review.googlesource.com/2653
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-15 15:08:49 +00:00
Hyang-Ah (Hana) Kim 71e2276663 bind/java: pin java byte array elements until Seq send is done.
When passing a byte array from Java to Go, Seq.writeByteArray JNI
call encodes only the array size and the pointer to the array.
Go-side receives the (size, ptr) pair info during the subsequent
Seq.send JNI call, and copies the elements into a Go byte slice.
We must pin the array elements until Go-side completes copying
so that they are not moved or collected by Java runtime.

This change keeps track of the pinned array info in a 'pinned' linked
list, and unpin them as the Seq memory is freed.  The jbyteArray
argument passed to Seq.writeByteArray is needed to release the pinned
byte array elements, but that is a "local reference". It is not
guaranteed that the reference is valid after the method returns. Thus,
we stash its global reference in the 'pinned' list and delete it later
as well.

A similar problem can occur on the byte slice returned from a Go function.
This change does not address the case yet.

Fixes golang/go#9486

Change-Id: I1255aefbc80b21ccbe9b2bf37699faaf0c5f0bae
Reviewed-on: https://go-review.googlesource.com/2586
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-14 19:06:28 +00:00
Hyang-Ah (Hana) Kim d97f4d82bd mobile: docker run should require a $GOPATH/src volume mount.
If the volume is not accessible or -v option is not given,
docker run golang/mobile will fail with an error like:

finalize namespace chdir to /src/golang.org/x/mobile no such file or directory2015/01/13 20:14:19 Error response from daemon: Cannot start container dfe1dbc2bac3ea939e154eee13d20ecae4c473a595dbc1e6a0e5cf0be3963909: finalize namespace chdir to /src/golang.org/x/mobile no such file or directory

Change-Id: I4d56c044e9c7682e63da7170a546522230237b18
Reviewed-on: https://go-review.googlesource.com/2780
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-01-14 18:59:42 +00:00
David Crawshaw cf241b7ad2 mobile/cmd/gomobile: initial empty main function
Change-Id: Ieac721b486155679f3de2baa13c69d50d63dce3b
Reviewed-on: https://go-review.googlesource.com/2652
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-12 15:56:55 +00:00
David Crawshaw a5177c8172 mobile/font: access to system fonts
This initially supports reading two common system fonts. At some point
there should be a more general Open function, but first I need to work
out how to to turn font names into android file names.

Fixes golang/go#9419.

Change-Id: I8321df873315a5222c39dccf961f742f2e2a7a4c
Reviewed-on: https://go-review.googlesource.com/2059
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-10 22:16:05 +00:00
Hyang-Ah Hana Kim 2b3c96656c cmd/gobind: implement interface method binding.
This change makes gobind to generate proper Go-side proxy code to
handle interface methods that have parameters and return values.

It allows gobind to accept struct pointer types as parameters
or a return value of a method.

Fixes golang/go#9487, golang/go#9488.

Change-Id: Id243c42ee0701d40e3871e392140368c2f8f9bc6
Reviewed-on: https://go-review.googlesource.com/2348
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 18:26:42 +00:00
Hyang-Ah Hana Kim 8f449fffd2 bind/java/testpkg: use go generate to run gobind on testpkg.
Change-Id: I2426f3607120b7ce2da60bcb45d834b539d7dbb9
Reviewed-on: https://go-review.googlesource.com/2342
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 17:28:35 +00:00
Hyang-Ah Hana Kim 2be77e4ffc cmd/gobind: take -output option for output file.
Change-Id: Ie91223592474938cbfb9d7e4abe85867acdf69db
Reviewed-on: https://go-review.googlesource.com/2380
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 16:33:56 +00:00
Shenghou Ma bd50534d55 bind: remove temporary files used in tests
Fixes golang/go#9513

Change-Id: I19a14f6e8f24396e5a191258917e5ff9caf8928a
Reviewed-on: https://go-review.googlesource.com/2343
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-06 06:13:23 +00:00
Burcu Dogan 1e525d6eb2 mobile: cache debug.keystore to avoid adb install certificate errors
Otherwise, successive adb installs will require the existing apk to be
removed. If no android.keystore is generated during docker build, one
will be generated by the NDK toolchain during docker run.
It will end up the applications are being signed with different
certificates on each docker run.

Fixes #9498.

Change-Id: Ibac202b828224287ec6fdc3eaff659de5fce61c3
Reviewed-on: https://go-review.googlesource.com/2266
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-03 21:35:02 +00:00
Burcu Dogan 3d879bb1b3 mobile: modify instructions to pull the Docker image from the hub
Image is published at https://registry.hub.docker.com/u/golang/mobile/.

Fixes #9270

Change-Id: Ib5730a5f571bf42c53f223a6543219db3e34871d
Reviewed-on: https://go-review.googlesource.com/2158
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-30 04:05:25 +00:00
Alex Brainman 237eb3c606 mobile: copying .gitattributes to all subrepositories
Fixes #9281

Change-Id: I93741f5955afc4c3d0a519d9b441cd5add126182
Reviewed-on: https://go-review.googlesource.com/2079
Reviewed-by: Minux Ma <minux@golang.org>
2014-12-23 23:23:25 +00:00
Daniel Ortiz Pereira da Silva 696db895ff example/sprite: make example lives
Add necessary files to build and run example/sprite.
Change main.go to get image from assets.

Change-Id: Ic3065aab97f59c34f2c0446ab4b46840305b5864
Reviewed-on: https://go-review.googlesource.com/1882
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-22 13:10:48 +00:00
Daniel Ortiz Pereira da Silva 9c997eaee4 example: add windows batch files
Add windows batch files to build and run examples

Change-Id: I9102ceb5c47f692730a8b024648b1d10ff49b624
Reviewed-on: https://go-review.googlesource.com/1622
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-22 13:10:26 +00:00
Pierre Roullon 3bb5e71983 app: Remove 'from' duplication on Run doc
Change-Id: I97855989e32a09d0b0c3309579aa7965d3c72129
Reviewed-on: https://go-review.googlesource.com/1896
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-21 21:03:24 +00:00
Gordon Klaus f8e3bd5ba6 mobile: Deliver all touch events.
Android delivers events in a batch.  Previously, only the first event of the batch was passed to the Go callback, resulting in many events (typically corresponding to non-primary touches) being dropped.

Change-Id: I4b01bb6c4d1c88dec6c8fa379875043dfc0e9986
Reviewed-on: https://go-review.googlesource.com/1894
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-21 16:17:07 +00:00
David Crawshaw 93ef3562fa app: call Start on darwin
Still working on how/when to call Stop.

Change-Id: Ice56c4c71ba351765657bb86dc01649c8238859e
Reviewed-on: https://go-review.googlesource.com/1885
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-19 20:39:27 +00:00
Hyang-Ah Hana Kim b2e453e1cd bind/java: support byte arrays.
Fixes golang/go#9338.

Change-Id: I6e2af67cdf7f923963fa525b944613a91aac994e
Reviewed-on: https://go-review.googlesource.com/1884
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-19 20:07:11 +00:00
David Crawshaw 1aa04cf038 app: Start and Stop callbacks
Change-Id: If8ea6aaf2fb2c62eaf4119526a8bb46b8a84b982
Reviewed-on: https://go-review.googlesource.com/1881
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-19 19:01:54 +00:00
Hana (Hyang-Ah) Kim 8952e43db8 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>
2014-12-18 00:48:16 +00:00
David Crawshaw e8bfa872c4 gl: use Uniform type for consistency
Change-Id: I90a813c0823498297ff0bb7718bee6cd61b87581
Reviewed-on: https://go-review.googlesource.com/1517
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-15 17:53:49 +00:00
David Crawshaw e6e0a35f70 sprite/glsprite: add very basic package docs
Fixes golang/go#9286.

Change-Id: I231571e8a70e48ee9f8541fe710874f0086d3396
Reviewed-on: https://go-review.googlesource.com/1424
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-12 14:44:04 +00:00
David Crawshaw f19599ac73 seq, java: fix allocation bug in empty strings and test
Fixes golang/go#9271.

Change-Id: I57dcd11ae5afdc23bc9b1a0945d0789c9feeefb1
Reviewed-on: https://go-review.googlesource.com/1423
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-12 14:06:53 +00:00
David Crawshaw 4ab8f01b53 gl: fix documentation URL
Change-Id: I73a6d37ecc1827fa65c94cd6d743874785f7e93a
Reviewed-on: https://go-review.googlesource.com/1374
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-11 21:20:01 +00:00
David Crawshaw 6cf9d880ce bind/java: ensure there is enough capacity for writing seq
The new testLongString triggers the bug without this change.

Fixes golang/go#9251.

Change-Id: I463e2897b5b08f53801f151c7311d591546c0719
Reviewed-on: https://go-review.googlesource.com/1373
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-11 17:53:23 +00:00
David Crawshaw 96c0ef1480 all: update docs to remove code.google.com
Fixes golang/go#9259.

Change-Id: I4768ce0a2abc56100e6616bacdf6aad196639b10
Reviewed-on: https://go-review.googlesource.com/1370
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-11 14:15:30 +00:00
David Crawshaw 71604ab0e3 bind/java: give mktemp a template for darwin hosts
Change-Id: I4bf795cfe76daae9a922c671722db3e2fa44a0c0
Reviewed-on: https://go-review.googlesource.com/1320
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-10 21:53:24 +00:00
Hana (Hyang-Ah) Kim 748d0d3152 Dockerfile: update to download go from git and utilize volume mount.
Change-Id: Ib7d32298f6ee7f74e5c6e0da7e1022ed6a23283a
Reviewed-on: https://go-review.googlesource.com/1310
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-10 20:28:06 +00:00
David Crawshaw ce2d014f4a README.md: rewrite to describe Dockerfile builds
Change-Id: Ibfdd36f306d9a52f226904aa99653dc1b932410b
Reviewed-on: https://go-review.googlesource.com/1289
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-10 18:57:44 +00:00
David Crawshaw 32030f7750 app: build fake auxv
Some Android systems cannot read from /proc/self/auxv. Work around
this by creating a minimal fake auxv for the Go runtime.

Fixes #9229

Change-Id: Id2d743f43d91be23006aac708a5b5b5cd60a6dca
Reviewed-on: https://go-review.googlesource.com/1284
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-10 17:26:16 +00:00
David Symonds 7b659348a5 mobile: add import comments.
Change-Id: I0ff6d42a8e11f49df6fc3066e86be75015b93631
Reviewed-on: https://go-review.googlesource.com/1238
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-10 01:59:04 +00:00
Hana (Hyang-Ah) Kim 969a1bf7dd example/libhellojni: fix build and allow go get golang.org/x/mobile/...
Change-Id: Id0cd58705c882ea58cedbee5a6e9aff010c0ad4d
Reviewed-on: https://go-review.googlesource.com/1281
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-10 01:38:44 +00:00
Hana (Hyang-Ah) Kim daf6d8060b gl: use go generate to generate gldebug.go by invoking gendebug.go
Change-Id: I7d682d153da5b200f9dd5cea8d09d76935daa18c
Reviewed-on: https://go-review.googlesource.com/1225
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-09 17:31:03 +00:00
David Crawshaw 81f7d26930 gl: regen gldebug.go and stop logging on glBoolean
Change-Id: Icad6cb694b31924164483609e0fd9c7cce8e3f0d
Reviewed-on: https://go-review.googlesource.com/1185
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-08 23:39:28 +00:00
David Crawshaw 23d89f24b5 gl: merge gl_linux.go and gl_darwin.go
C changes the types silently, so there's no need for the code to be
different (beyond the standard header ifdef boilerplate).

Change-Id: I0eddb5fa050c083cdac9db499634bf3d1bb9bb04
Reviewed-on: https://go-review.googlesource.com/1184
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-08 21:38:56 +00:00
David Crawshaw 410ed12d25 gl: convert Glclampf to GLfloat in C to avoid variations between GL headers
Change-Id: I2ff85d2b4529fc12e08404c93266b827dd88b8ef
Reviewed-on: https://go-review.googlesource.com/1183
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-08 20:15:17 +00:00
David Symonds 25a2f7c74d remove codereview.cfg. 2014-12-08 10:59:03 +11:00