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

279 Commits

Author SHA1 Message Date
Hyang-Ah (Hana) Kim
20544e603c bind/java/SeqTest: call Go.init from the test case constructor.
Go.init must be called once and from the main thread.
setUp is called from a non-main thread and once per each test.

Change-Id: I848a1461793463785b38141e077da5bf5e53cb4c
Reviewed-on: https://go-review.googlesource.com/6832
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-05 00:04:29 +00:00
Hyang-Ah (Hana) Kim
d6d776925d bind/java: use gomobile to build bind lib.
Change-Id: I3390ff0e59bec6414aed7645fb7b67c33263d798
Reviewed-on: https://go-review.googlesource.com/6664
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-04 22:37:44 +00:00
David Crawshaw
47a1495872 bind/java: fix build
Tested on darwin/amd64 with
	go build golang.org/x/mobile/...

Change-Id: Iec31ccb318913cea5acc7dcec1c6a858bf8654de
Reviewed-on: https://go-review.googlesource.com/5770
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-24 17:48:51 +00:00
Hyang-Ah Hana Kim
8fc47a26f1 bind/java/SeqTest: use AndroidTestCase for Context.
To exercise the code path that uses Context given to Go.init.

Change-Id: Ied1f9efff325c711275a1969c373011c59e1d08d
Reviewed-on: https://go-review.googlesource.com/5750
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-24 16:20:09 +00:00
Hyang-Ah Hana Kim
d267d4cb61 bind/seq: fix unaligned memory access in serialization.
Unaligned memory access caused SIGBUS when using ndk r10d.

Change-Id: Ic219873f1e2a30bf3a41cdf3c552d058e55db0cb
Reviewed-on: https://go-review.googlesource.com/5500
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-23 21:01:14 +00:00
David Crawshaw
b2dee7a880 app, cmd/gomobile: expose an app.State variable
The State can be used in the Start callback (and lazily-initialized
packages) instead of JavaInit. This stores a reference to the
android.context.Context for the (future) keyboard package and for
setting TMPDIR.

Second attempt at https://golang.org/cl/4400.

Change-Id: I673997b26ab25ce5140cb31950593d8c6dbd9c51
Reviewed-on: https://go-review.googlesource.com/5555
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-23 17:54:17 +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
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
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
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
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
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
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
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
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 Kim
404af530f0 mobile/bind/java: update the test.bash to build apk for test.
Requires gradle.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/180480043
2014-12-03 17:39:00 -05:00
David Crawshaw
551dbd1f07 go.mobile/bind/java: support JNI_EDETACHED
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/144780043
2014-12-03 15:24:48 -05:00
Hana Kim
50b4d219bf go.mobile: update bind/java/SeqTest.java to pass.
- Suppressed testJavaRefKeep for now.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/170000045
2014-11-11 09:55:39 -05:00
Hana Kim
32f2370535 go.mobile/bind: include the bind invocation command in generated files.
This change also updates bind/testdata/*.golden.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/167160043
2014-11-10 13:46:47 -05:00
Andrew Gerrand
9470e0ba58 go.mobile: use golang.org/x/... import paths
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/162710043
2014-11-10 08:55:57 +11:00
Hana Kim
d53d8c3f80 go.mobile/bind/java: update javatest.go to build.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/171850043
2014-11-05 13:09:06 -05:00
David Crawshaw
3b555d82f6 go.mobile/bind/java: fix build
I really need to sort out a builder story for end-to-end apps.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/136580043
2014-09-12 10:53:03 -04:00
David Crawshaw
3d312b5a2b go.mobile: break dependency on gobind
Preparation for NativeActivity-based apps.

LGTM=nigeltao
R=golang-codereviews, nigeltao
CC=golang-codereviews
https://golang.org/cl/126520043
2014-09-03 09:03:00 -04:00
David Crawshaw
9f144f9410 go.mobile/bind: language binding generator
Details: http://golang.org/s/gobind

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/118240044
2014-07-31 15:09:13 -04:00
David Crawshaw
5487fc8103 go.mobile/bind/java: tests of object reference tracking
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/112700044
2014-07-31 08:25:23 -04:00
David Crawshaw
6a88edec71 go.mobile/bind/java: cgo-JNI bridge using seq
Details: http://golang.org/s/gobind

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/110550044
2014-07-31 08:24:05 -04:00
David Crawshaw
2861ce3b89 go.mobile/bind/seq: Go implementation of parameter serialization
Details: http://golang.org/s/gobind

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/116800043
2014-07-28 15:47:26 -04:00