2
0
mirror of synced 2025-02-22 14:28:14 +00:00

88 Commits

Author SHA1 Message Date
David Crawshaw
7a70f37cf6 bind/objc: remove a constructor and retain blocks
A framework generated with gomobile bind -target=ios has two global
constructors: one initializing a data structure and another using it.
These constructors are defined in different translation units, which
(I believe, reasoning from C++ global constructors) means their order
of initialization is undefined.

A capturing block is stack allocated. Its memory is invalid after the
function returns. Make a copy of the interface initializer blocks so
they can be saved to the heap.

Block implementation background:
http://www.cocoawithlove.com/2009/10/how-blocks-are-implemented-and.html

Updates golang/go#12590

Change-Id: Ia7ae9f4bbd8df6e6e79949de54b3e6c48148c700
Reviewed-on: https://go-review.googlesource.com/14549
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-09-15 17:38:26 +00:00
Meir Fischer
00865a642f bind: improve readability for float default values
To improve readability for default numeric types
represented as strings, use 0.0 for floating point types.
(No tests make use of this change so golden update
not necessary; not significant enough for new test/test mod.)
Fix spelling on error statement; this was the only
instance of that spelling error in the repository.

Change-Id: I373890725b33da11c6780ba93674d89541bf758c
Reviewed-on: https://go-review.googlesource.com/13645
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-09-01 18:16:37 +00:00
Hyang-Ah (Hana) Kim
671f57b233 bind: fix interface methods' multiple return values handling.
Fixes golang/go#12403

Change-Id: I9b8e6d69beb1ceb27e991348212acb5054497e47
Reviewed-on: https://go-review.googlesource.com/14077
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-31 16:32:47 +00:00
Hyang-Ah (Hana) Kim
c384607ef3 bind: support for custom java package name and objective-c prefix.
Introduce options -javapkg and -prefix for gobind command.

The following generates java class Testpkg with package name com.example.

gobind -lang=java -javapkg=com.example testpkg

The following generates objective-c files where function and type names
are prefixed with ExampleTestpkg.

gobind -lang=objc -prefix=Example testpkg

As discussed in golang/go#9660 and golang/go#12245.

Gomobile support is not yet implemented.

Change-Id: Ib9e39997ce915580a5a2e25643c0c28373f27ee1
Reviewed-on: https://go-review.googlesource.com/13969
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-28 13:57:06 +00:00
David Crawshaw
4628c38e0f bind: handle unimplementable interfaces
Fixes golang/go#12330

Change-Id: I1568d04b7e48242105a7028ca471e2138f684eeb
Reviewed-on: https://go-review.googlesource.com/13946
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-27 21:36:14 +00:00
David Crawshaw
11fe695b54 bind: support fields with type error
Fixes golang/go#12328

Change-Id: I42872d26acb1c44522a64405cfa2d0f10fb24485
Reviewed-on: https://go-review.googlesource.com/13919
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-26 20:25:55 +00:00
Hyang-Ah (Hana) Kim
da28dd9045 bind/objc: fix error return type handling
Fixes golang/go#12307.

Change-Id: I5560b616a3cd51c536d9e5529745681effe26e9a
Reviewed-on: https://go-review.googlesource.com/13913
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-25 15:22:55 +00:00
Hana Kim
49a82fefe3 all: support go get golang.org/x/mobile/... on Windows
Fixes golang/go#12212
Workaround for golang/go#12261 until golang/go#9306 is fixed.

Change-Id: I51c1bcfc92c1553fe2132586a0234b1c1af6aeb1
Reviewed-on: https://go-review.googlesource.com/13745
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-24 21:09:04 +00:00
David Crawshaw
48bd7cbbc7 bind: adjust invalid java package names
Updates golang/go#12273

Change-Id: I8eac3e84d5a473e9ffe45705cea88537573aef61
Reviewed-on: https://go-review.googlesource.com/13873
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-24 21:08:09 +00:00
David Crawshaw
da78c710f3 bind/testdata: update golden files
Tests now pass on OS X.

Change-Id: Id2e6c5bd9ddd4070962ff9bc121d7902e8c9a647
Reviewed-on: https://go-review.googlesource.com/13694
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-18 17:57:47 +00:00
Hyang-Ah (Hana) Kim
5c55c26446 bind/objc: don't expose internal class types mapped to Go interface.
For interface binding, we need only protocols.

Change-Id: I377ec9c8de0a3414d48272892b169fb94823e8ff
Reviewed-on: https://go-review.googlesource.com/13541
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 19:16:10 +00:00
Hyang-Ah (Hana) Kim
50f2c0f60e bind/objc: update test.bash to run gobind.
Change-Id: I38379d6f1a6bbaa13234060b52edc8206b750644
Reviewed-on: https://go-review.googlesource.com/13028
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-05 20:02:56 +00:00
Hyang-Ah (Hana) Kim
9865dd0755 bind: implement objective-C interface binding code generation.
Depends on cl/12389 progress.

Change-Id: I044b0cf7c4df1d84b9ee158a4ceb3fdb13bf7645
Reviewed-on: https://go-review.googlesource.com/12410
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-31 20:12:37 +00:00
Hyang-Ah (Hana) Kim
926122382b bind/objc: Interface binding support
Given a Go package defining an interface,

  package testpkg
  type I interface {
      Fn()
  }

I is mapped to an objective-c protocol and a proxy interface
that implements the routing of method calls from Go.

  @protocol GoTestpkgI
  -(void)Fn;
  @end

Users implement a class conforming the generated protocol. For example,

  @interface MyI <GoTestpkgI> {
  }
  @end

  @implementation MyI {
  }
  - (void)Fn { .... }
  @end

Gobind will also create a proxy interface to handle Go objects
implementing the interface and passed to Objective-C, but that will
be hidden from users.

  @interface GoTestpkgI : NSObject <GoTestpkgI> {
  ...
  -(void)Fn;
  @end

The gobind code to generate the objective-c binding is in a separate CL.

Change-Id: I6a72d34fe3a5b8d2774d2d53913229c1e71f2d60
Reviewed-on: https://go-review.googlesource.com/12389
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2015-07-31 20:12:03 +00:00
David Crawshaw
b780379135 bind: vendor x/tools/go/loader
This breaks our dependency on the x/tools repository, which has a
tendency to change in unexpected ways. It also means we can use the
version of go/types that ships with Go 1.5.

Along the way, it appears that cgo processing has changed slightly.
The old check for cgo files apparently wasn't working, so I removed
it.

Change-Id: I14378e9df9cd65c5ab61b47728ba0d56f31cdf76
Reviewed-on: https://go-review.googlesource.com/12680
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-28 18:02:47 +00:00
Hyang-Ah (Hana) Kim
c261c465a9 bind: seq.Transact requires interface descriptor.
seq.Transact is called when Go calls a method of a foreign object
that implements a Go interface. Currently, we assume that the foreign
object has an instance method that can conduct the message routing,
so the object id and the method code is sufficient for transact.

Passing the interface descriptor (e.g.  go.testpkg.I) however allows
the bind internal to use non-instance methods to implement the routing.

Change-Id: I1f61a04f919fbd09117ea332d678cd50e4861e46
Reviewed-on: https://go-review.googlesource.com/12685
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-27 18:08:41 +00:00
Hyang-Ah (Hana) Kim
4755f4ad8f bind/objc: fixes miscalculation of string length.
Also, fixes the memory allocation bug - misuse of mem_ensure that caused
to allocate 72 bytes of memory to carry 16 bytes of data for instance.

Fixes golang/go#11842.

Change-Id: I21798be2ec7adfb68cc2897bb46a924f05f3478c
Reviewed-on: https://go-review.googlesource.com/12577
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-23 22:35:14 +00:00
Hyang-Ah (Hana) Kim
c039090cf1 bind/java: fix misuse of mem_ensure.
mem_ensure is to ensure the remaining space in buffer
is large enough to hold extra size bytes. We've been passing
the target capacity instead of the number of extra bytes we
need.

Change-Id: Ic6f6ddb4ad22cbcdbc44eb4a58e6a415ae771fb2
Reviewed-on: https://go-review.googlesource.com/12578
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-23 22:34:55 +00:00
Hyang-Ah (Hana) Kim
103c0611a8 bind/java: suppress compiler warning
non-varargs call of varargs method with inexact argument type for last
parameter

Change-Id: I7623951c365b8cf899a17ee784c8d4f3b4bdb198
Reviewed-on: https://go-review.googlesource.com/12528
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-22 21:01:20 +00:00
Hyang-Ah (Hana) Kim
136fa9bbbb bind/java: reenable asset access.
This is done by moving app.Context to internal/mobileinit,
introducing mobileinit.SetCurrentContext and,
making bind/java depend on it.

TODO: check gomobile bind's proguard rule - context lookup
was implemented through reflection on android.app.AppGlobals class.

Change-Id: Ieb6ad503eeef8c2c1c5836a21c667938c5a701a2
Reviewed-on: https://go-review.googlesource.com/12279
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-16 21:15:37 +00:00
Hyang-Ah (Hana) Kim
6fb2670129 bind/objc: Remove reference of seq.h from generated header file.
This allows gomobile bind to stop copying seq.h to the destination.

Change-Id: I4a23613fe0407500ad483ae9d8f6bb823d82f082
Reviewed-on: https://go-review.googlesource.com/12300
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-16 14:02:16 +00:00
David Crawshaw
e5193c59b3 cmd/gomobile: reorganize build logic
The goal here is to remove several inconsistencies between
-target=android and -target=ios support, along with making the flow
of the command follow the path you might expect given a certain set
of flags, and preparing for `gomobile bind` support of ios. In
particular, building non-main packages now works with both targets
and the initialization of global build state is clearer.

The reorg also is designed around an nm trick I thought of
yesterday to do better package import scanning without a slow
all-file scan. This will give better detection of x/mobile/app and
x/mobile/exp/audio/al packages. There's a TODO about it, and I'll do
it in a future CL.

Tested with:

	go test golang.org/x/mobile/cmd/gomobile
	gomobile init
	gomobile bind golang.org/x/mobile/asset
	go test golang.org/x/mobile/bind/java
	gomobile build -target=ios golang.org/x/mobile/example/basic
	gomobile build -target=ios golang.org/x/mobile/gl
	gomobile build -target=android golang.org/x/mobile/gl
	gomobile build -target=android golang.org/x/mobile/example/basic
	(Along with manual testing of basic on an android device.)

That might make a pretty good _test.go.

Change-Id: I41230008c3c15db25a11c33b9eaca4abada9f411
Reviewed-on: https://go-review.googlesource.com/12051
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-13 18:54:16 +00:00
Elias Naur
5aee943213 x/mobile/bind: remove debug print
Android support has advanced to the point where this logging statement
adds very little information.

Change-Id: I3c8c9d60be8c0b52a519f9e44711bd211b5bfe67
Reviewed-on: https://go-review.googlesource.com/11990
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-10 17:08:45 +00:00
David Crawshaw
960fedd178 internal/mobileinit: new package for shared logic
Package app contains some logic that we want to share with
gobind-based libraries. So move it to a new internal package
that both can import.

Long term the log changes should be in the standard library,
but the Go tree is currently frozen.

Fixes golang/go#11630.

Change-Id: I9ff622fc499bf255bce18df23cb68b03f667947f
Reviewed-on: https://go-review.googlesource.com/11981
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-08 21:29:11 +00:00
Hyang-Ah (Hana) Kim
a922dd97b1 bind/objc: remove '_' after Go<pkgname> prefix from names.
Before this change, func Hello() of mypkg package generated a function
GoMypkg_Hello to distinguish the prefix from the function name.
It seems the use of '_' is very rare in Objective-C though.
After this change, it generates GoMypkgHello.

Change-Id: Ic7aa2b667363a447a5ff3500262502d3137d6853
Reviewed-on: https://go-review.googlesource.com/11893
Reviewed-by: Damien Neil <dneil@google.com>
2015-07-07 03:29:17 +00:00
David Crawshaw
5ced61ace7 cmd/gomobile: call System.loadLibrary for .aar
Change-Id: I3fd099910cfb1fe112ded4386905d370acfea002
Reviewed-on: https://go-review.googlesource.com/11816
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-06 22:21:32 +00:00
Alan Donovan
616f82b347 bind: fix build broken by API change to golang.org/x/tools/go/types
Fixes golang/go#11509.

Change-Id: Ia54febfa3ef9b589befb09b8f5d79cb6d7f6c4da
Reviewed-on: https://go-review.googlesource.com/11841
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-07-02 12:24:20 +00:00
David Crawshaw
8144405762 app, bind: separate the app package from gobind
Historically, the app package implemented Go runtime initialization.
This was convoluted, so the package was used both by all-Go apps
(currently based on Android's NativeActivity) and bind-based apps.

With Go 1.5 we have -buildmode=c-shared, which does a lot of the work
of the old app package. That code was removed a while back, but both
all-Go and gobind-based apps still used package app. The intermingled
initialization processes led to some strange states.

This CL separates gobind-based apps completely from the app package.
As part of that users are now expected to use System.loadLibrary
themselves. (A future CL may want to make the loadLibrary call part
of the .aar generated by gomobile bind.)

Delete the libhello example, which has been replaced by gomobile bind,
which could do with its own example at some point. Also delete the
libhellojni example, which now has nothing to do with the x/mobile
repository.

Change-Id: I444397f246dbafe81e5c53532eb482c197d26f70
Reviewed-on: https://go-review.googlesource.com/11654
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 11:40:40 +00:00
James Schofield
5878957524 mobile/bind: Fix objc bindings for multiple return vals.
The existing implementation generates uncompilable objc code for
functions returning two results.

Change-Id: I13f7329596d8fa6103c4b7827c26c5461e16a925
Reviewed-on: https://go-review.googlesource.com/11364
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-24 18:25:43 +00:00
Hyang-Ah (Hana) Kim
3a9b5b50ac bind: correct methods' return arg type mapping in obj-c binding.
Change-Id: Ieda05982c7f894c5603103b8890658e682e97423
Reviewed-on: https://go-review.googlesource.com/11307
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 13:13:31 +00:00
Hyang-Ah (Hana) Kim
d7fb1ce757 bind: fix a bug in handling func returning a struct.
Change-Id: I63963c20c283638cfdc86b037f6aff70a115a78c
Reviewed-on: https://go-review.googlesource.com/10893
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-11 17:32:32 +00:00
Hyang-Ah (Hana) Kim
9c7482eec9 bind/objc: use gobind -lang=objc,go to generate code.
Removed checked-in version of go, objective-c proxy code.

Change-Id: Iac2c6ba3156def680746b5ae1fe02d6e712532a7
Reviewed-on: https://go-review.googlesource.com/10842
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-10 00:17:26 +00:00
Hyang-Ah (Hana) Kim
8f4eb9eb49 bind: add objective-c code generator.
Translate error type to NSError.
Interface type is not supported yet.

Change-Id: I54abba2360cff41ef8ca08063b0120e7edd65a47
Reviewed-on: https://go-review.googlesource.com/10793
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2015-06-09 20:58:21 +00:00
Hyang-Ah (Hana) Kim
343eae7dd2 bind/objc: simplify reference counting of Go objects.
With https://go-review.googlesource.com/10638, the reference counting
of Go objects can be simplified. Everytime a Go object is passed into
Objective-C side, a new proxy object with GoSeqRef is created.
Deallocation of a GoSeqRef decrements the reference counter of the
corresponding Go object.

Test the Go object is collected.

Note: It's possible to reduce the number of GoSeqRef
allocations by maintaining a map of weak references to the existing
GoSeqRef, but for now, we allocate a new GoSeqRef instance.

Change-Id: I57a5a4b249c5800d9eba95d128a2cdf74bbef566
Reviewed-on: https://go-review.googlesource.com/10639
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2015-06-04 23:02:01 +00:00
Hyang-Ah (Hana) Kim
b24fa8f869 bind/objc: add read/write Int and BOOL values.
Change-Id: I9e1d0c62acfa43cfc1b0dd79ff25b89b43a891cb
Reviewed-on: https://go-review.googlesource.com/10710
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-04 20:31:20 +00:00
David Crawshaw
f373bd373c bind: rename parameter p
Fixes golang/go#11064.

Change-Id: Idb4376f0143b0d1c8e87e7ccc54aae343b504e4a
Reviewed-on: https://go-review.googlesource.com/10689
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-04 17:29:43 +00:00
Hyang-Ah (Hana) Kim
c533dca65f bind/java: manage Java object lifetime based on reference count.
The gobind framework is supposed to use reference counting to
keep track of objects (e.g. pointer to a Go struct, interface
values) crossing the language boundary. This change fixes two bugs:

1) no reference counting on Java object: Previously, the lifetime
of a Java object was manages in the following way.

 a. The Java object is pinned in an internal map (javaObjs) when it's
constructed.
 b. When Go receives the reference to the Java object, it creates a
proxy object and sets a finalizer on it. The finalizer signals Java
to unpin the Java object (remove from the javaObjs map).
 c. The javaObjs map is also used to identify the Java object when
Go asks to invoke a method on it later.

When the same Java object is sent to Java more than once, and the
finalizer (b) runs after the first use, the second use of the Java
object can cause the crash described in golang/go#10933.

This change fixes the bug by reference counting the Java object.
Java side pins the Java object and increments the refcount whenever it
sees the object sent to Go (in Seq.writeRef). When the Go proxy
object's finalizer runs, the refcount is decremented. When the refcount
becomes 0, the object gets unpined.

2) race in Go object lifetime management: Pinning on a Go object
has been done when the Go object is sent to Java but the Go object
is not in the pinned object map yet. (bind/seq.WriteGoRef).
Unpinning the object occurs when Java finds there are no proxy objects
on its side. For this, Java maintains a reference count map (goObjs).
When the refcount becomes zero, Java notifies Go so the object is
unpinned. Here is a race case:

 a. Java has a proxy object for a Go object.
 b. Go is preparing for sending the same Go object. seq.WriteGoRef
notices the corresponding entry in the pinned object map already,
and returns. The remaining work for sending the object continues.
 c. The proxy object in Java finalizes and triggers deletion of the
object from the pinned object map.
 d. The remaining work for (b) completes and Java creates a new proxy
object. When a method is called for the Go object, the Go object is
already removed from the object map on Go side and maybe already GC'd.

This change fixes it by converting the pinned object map to reference
counter map maintained in Go. The counter increments for each
seq.WriteGoRef call. The finalizer of the proxy object in Java causes
a decrement of the counter.

Fixes golang/go#10933.

Renables the skipped testJavaRefGC.

Change-Id: I0992e002b1050b6183689e5ab821e058adbb420f
Reviewed-on: https://go-review.googlesource.com/10638
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-04 16:53:15 +00:00
Hyang-Ah (Hana) Kim
d8725953a1 bind: remove an unused field from javaGen.
Change-Id: If1eab27d334c38288fb0c7cec3e4bf2143ddaf91
Reviewed-on: https://go-review.googlesource.com/10637
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-03 14:31:32 +00:00
Hyang-Ah (Hana) Kim
a7e5f659df bind/objc: allow passing Go objects to objective-C.
Change-Id: I2aa3971cd8800485f2934d5efb89cea8042e7d88
Reviewed-on: https://go-review.googlesource.com/10632
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-02 16:03:04 +00:00
Hyang-Ah (Hana) Kim
cc98479faf bind: make generated names less go-like to avoid name collision.
Change-Id: Ib3f27ceb38ae0d2416e8aef6f3ffe81c7f6c9044
Reviewed-on: https://go-review.googlesource.com/10550
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-29 19:58:06 +00:00
Elias Naur
e241db99d5 bind/java: revert byte array class workaround from CL 9783
After CL 10296 the workaround from CL 9783 is no longer necessary.
Revert the workaround but keep the global reference, just in case.

Change-Id: I3fdd580e4122c36508beb9d328739b910dbbe2e2
Reviewed-on: https://go-review.googlesource.com/10483
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-29 10:36:48 +00:00
David Crawshaw
64c20ce93d bind/java: initialize seq machinery from Java
This ensures that the java bindings are ready before any calls are
made by user code. As a bonus, the JNIEnv* is from the Seq class so I
believe no tricks are required to find the right class loader.

Fixes golang/go#10903.

Change-Id: I33b3b39cef6cc2da36e271de882ba8d26610ea34
Reviewed-on: https://go-review.googlesource.com/10296
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 18:37:54 +00:00
Hyang-Ah (Hana) Kim
6e800237e4 bind/objc: simplify GoSeq.
Change-Id: I86e5409d5e09794108cdf5ef1b4c80155d8874cf
Reviewed-on: https://go-review.googlesource.com/10049
Reviewed-by: Damien Neil <dneil@google.com>
2015-05-14 22:26:19 +00:00
Hyang-Ah (Hana) Kim
6d80e5a85f bind: support Bool types.
Also add missing int8/int16 handling in bind/seq.

Fixes golang/go#10855.

Change-Id: I326ada44df10fc3c22628bdd2ae4ee2c3dc7902e
Reviewed-on: https://go-review.googlesource.com/10046
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-05-14 22:17:57 +00:00
Hyang-Ah (Hana) Kim
b658bfdf39 bind: support reference types as struct fields.
Reference types here mean pointers to struct types and
exported interface types. Previously, gobind generated invalid
go/java sources.

Change-Id: Icd666ebbb8edb70c613311798d602fd88cb4479c
Reviewed-on: https://go-review.googlesource.com/9997
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-05-14 19:48:46 +00:00
Hyang-Ah (Hana) Kim
fd342d15ab bind/objc: implement byte array read/write support.
Change-Id: I01ff7369c653bc7d57a3357c8f936d30ca5c0beb
Reviewed-on: https://go-review.googlesource.com/9922
Reviewed-by: Damien Neil <dneil@google.com>
2015-05-13 22:32:52 +00:00
Hyang-Ah (Hana) Kim
5c3e18f08f bind/objc: obj-c binding for functions using numeric, string types.
test.bash is a simple script that builds the c-shared library from
test_main.go, compiles SeqTest.m and the objective-c bindings of testpkg
(testpkg/objc_testpkg/GoTestpkg.*), and runs the output. Eventually this
will be replaced with coed that runs gomobile bind & xcodebuild.

The code under testpkg/go_testpkg and testpkg/objc_testpkg is the output
of gobind (now manually-generated). I am adding it to repo now in order
to get the testpkg/objc_tstpkg reviewed. Eventually, this will be
removed from the repo.

Change-Id: I8d6af3732337992af922cb4615a63f385e19d489
Reviewed-on: https://go-review.googlesource.com/9826
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-13 22:28:22 +00:00
Hyang-Ah (Hana) Kim
ec112d8787 bind: mention the supported binding rules.
Change-Id: I4760042871b2ccb7b24ee79ef9adef54cfb9303b
Reviewed-on: https://go-review.googlesource.com/9996
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-05-13 21:10:50 +00:00
Hyang-Ah (Hana) Kim
4f4272d70b bind: fix Java code generation that takes reference type params.
Also fixes a parameter name handling problem when processing a
function signature that omits parameter names.

Fixes golang/go#10788.

Change-Id: I65273d330bbf3a836ec9e4ffb691927970d795d8
Reviewed-on: https://go-review.googlesource.com/9926
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-05-12 22:05:40 +00:00
Hyang-Ah (Hana) Kim
910c3fc64e bind/java: find jbytearray class info using jbytearray object.
The previous way (JNIEnv's FindClass with "[B") does not work
in Android-L for some reason.

Change-Id: I5cccb7bbf651df981a923ecade863302521d5c5c
Reviewed-on: https://go-review.googlesource.com/9783
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-12 17:43:40 +00:00