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

451 Commits

Author SHA1 Message Date
Nigel Tao
c0c696a96d sprite: move to exp/sprite.
Change-Id: Idfdc0c192d7e6d50e1063b2eb582bbe05294643a
Reviewed-on: https://go-review.googlesource.com/11230
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-21 03:08:52 +00:00
Burcu Dogan
df4a6521ad cmd/gomobile: improve error message if gomobile hasn't inited
gomobile init builds and install the toolchain for iOS builds now.
The error message shouldn't exclude the darwin/arm and darwin/arm64
related initialization.

Change-Id: Iebd5d7fb1466d9be694d8848c0fd8fa782850c79
Reviewed-on: https://go-review.googlesource.com/11239
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-20 22:31:06 +00:00
Burcu Dogan
8fff803af0 mobile/cmd/gomobile: install darwin/arm and darwin/arm64 compilers
Change-Id: I16fe8db9ac9e22c7ba9c821b4d8bf858ab28f5f8
Reviewed-on: https://go-review.googlesource.com/11237
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-20 18:09:14 +00:00
Hyang-Ah (Hana) Kim
7319e3567c cmd/gomobile: use package dir basename as app name.
Fixes golang/go#11218

Change-Id: I5faee5853170b7a53543d950801ccbf9265e60b1
Reviewed-on: https://go-review.googlesource.com/11251
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 19:39:56 +00:00
Hyang-Ah (Hana) Kim
1edfb833a0 cmd/gomobile: fix the use of diff function.
The params order matters in diff function's output.
Related to the confusing error report seen in golang/go#11297

Change-Id: Ibde615dbe43a4393232b72230fb21d7b577c0812
Reviewed-on: https://go-review.googlesource.com/11258
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-19 18:47:43 +00:00
Hyang-Ah (Hana) Kim
b97afd068d cmd/gomobile: fix the broken build test.
The golden output for build test was generated assuming GOPATH == HOME.

Change-Id: I7dbf292b66e2ba999cbdc1e288ddb60767b0835b
Reviewed-on: https://go-review.googlesource.com/11257
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 18:15:02 +00:00
David Crawshaw
fb3a660302 cmd/gomobile: fix test broken in cl/11265
Change-Id: Ia431f061fd10aad17b53e2b0ef12fd15eaf8795d
Reviewed-on: https://go-review.googlesource.com/11255
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-19 17:38:45 +00:00
David Crawshaw
10a37afdaf cmd/gomobile: add -target flag
Also add a very simple test for gomobile build, some
documentation cleanup, and the -o flag for bind.

Change-Id: I719b92010ba2a5813049827c99502828788611ef
Reviewed-on: https://go-review.googlesource.com/11253
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-19 17:31:29 +00:00
Burcu Dogan
6490f64aef mobile/cmd/gomobile: build darwin/arm and darwin/arm64 cross compilers
Change-Id: If79c591ba81319947cd4073bacf009d3a5a7bf4a
Reviewed-on: https://go-review.googlesource.com/11265
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 17:22:34 +00:00
Burcu Dogan
090698ee2b mobile/cmd/gomobile: remove the temp iOS work directory
Change-Id: I1ceb859fb35d1069ed4d3835f74f7ec082bfefb8
Reviewed-on: https://go-review.googlesource.com/11264
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 16:33:59 +00:00
Burcu Dogan
2813ddb570 mobile/cmd/gomobile: add the assets to the iOS Release build
Updates golang/go#11043.

Change-Id: Ied1a2a4842dc0078dc34da1266c11eec9acba114
Reviewed-on: https://go-review.googlesource.com/11263
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-18 22:13:25 +00:00
Nigel Tao
981e383923 font: move to exp/font.
Change-Id: I62d5bcd829cb35e13843586b25829938778c79f5
Reviewed-on: https://go-review.googlesource.com/11133
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-16 21:35:30 +00:00
Nigel Tao
93e2526d55 exp: add a new directory for experimental packages.
Change-Id: I80ebfa6c7e79c1985262fe1572a927ce60df6946
Reviewed-on: https://go-review.googlesource.com/11118
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-16 21:06:44 +00:00
Nigel Tao
f88f8237ec build: delete obsolete files.
Change-Id: If7e24f3d363e66856f2fbc068615fa95d2e33b04
Reviewed-on: https://go-review.googlesource.com/11005
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-13 04:52:19 +00:00
Burcu Dogan
addf80de0c mobile/cmd/gomobile: invoke Xcode toolchain to build an iOS app
Currently, we don't allow user to override xcodebuild args, we may
introdude a new go build flag such as `xcodebuildargs` to pass
additional flags.

Updates #11043.

Change-Id: I776b332c2af3d9640a7c5f23ab7bc7b19a5e408a
Reviewed-on: https://go-review.googlesource.com/10990
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-13 01:48:29 +00:00
Burcu Dogan
428b72be66 mobile/cmd/gomobile: create boilerplate Xcode project
This CL adds the generation of a boilerplate Xcode project
to make it possible to shell out to xcodebuild to make a
release build.

In order to support multiple architectures, we are using lipo tool to
create fat binaries that target both darwin/arm and darwin/arm64.

This build strategy will require a darwin host with Xcode CLI tools
installed.

Updates #11043.

Change-Id: I741b05f5e34bf2a90103b1efdfa2db97a743e2a6
Reviewed-on: https://go-review.googlesource.com/10813
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-12 17:06:52 +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
David Crawshaw
31aaa72f51 cmd/gomobile: add x86
Change-Id: I080182bf6d32c18e9713eefcf67930b44ee3b83b
Reviewed-on: https://go-review.googlesource.com/10914
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-11 17:07:53 +00:00
Jihyun Yu
df8025159b app: move x11 API calls to GL thread
x11/gl is not thread-safe, so all x11/gl related API should be called
from one thread. There's already a dedicated thread for GL calls, so
move all x11 API calls to GL thread using gl.Do(...)

Fixes golang/go#11066

Change-Id: If84a8d56e978ce30d7fbbc310740fcc794ce61d7
Reviewed-on: https://go-review.googlesource.com/10744
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-11 16:42:09 +00:00
David Crawshaw
4ad40f4216 cmd/gomobile: use -buildmode=c-shared
Change-Id: I427a076a8064be0a73830a37aa40f4eca8bdfda6
Reviewed-on: https://go-review.googlesource.com/10894
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-10 19:38:36 +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
26f6ffe0b5 cmd/gobind: add experimental, objective-C code generation option.
Change-Id: Ia0e66ee0964bd40d868261994f7cb70260f3cbe9
Reviewed-on: https://go-review.googlesource.com/10841
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-10 00:14:20 +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
1f1d6efd3f app: use more obscure names for objective-c classes.
Change AppDelegate, AppController to GoAppAppDelegate,
GoAppAppController - which are ugly enough so gobind users
is unlikely to use in their objective-c code.

Change-Id: I69305994a83405a1d8499df661bd5f63757a7fd6
Reviewed-on: https://go-review.googlesource.com/10852
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-09 20:50:37 +00:00
Hyang-Ah (Hana) Kim
b6fda3dde1 app: fix broken build for armx.
Change-Id: I8cebd1fc3bd4cbc3113ea032d6d28177a1f31362
Reviewed-on: https://go-review.googlesource.com/10804
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-08 20:57:53 +00:00
Burcu Dogan
10cf0275e0 mobile/app: remove the callbacks declaration in the darwin/arm backend
Change-Id: I3dc03f63b9bb7ed0bd6f771bad8ac75f0cddbe35
Reviewed-on: https://go-review.googlesource.com/10127
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-08 06:10:58 +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
1927b21e90 app: add sync import
Fixes golang/go#11054.

Change-Id: If915f67d35639fc31cbe220872186a69c34710b5
Reviewed-on: https://go-review.googlesource.com/10700
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-04 18:00:18 +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
Jihyun Yu
019f8eb658 app: fix bug on linux/x11
- Fix hangs on linux/x11. x11-related code remains outdated since
   068a51c19, which seperates GL calls to dedicated thread.  Update x11
   code to work with GL thread.
 - Fix bug on coordinate system. x11 has same coordinate system with
   android, (0,0) on top-left.

Change-Id: I0b3ab97fd4842b1c9f730e1c90a5840f540fcb7a
Reviewed-on: https://go-review.googlesource.com/10623
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-03 14:42:55 +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
David Crawshaw
068a51c195 gl: batch calls onto a dedicated context thread
All GL function calls fill out a C.struct_fnargs and drop it on the
work queue. The Start function drains the work queue and hands
over a batch of calls to C.process which runs them. This allows
multiple GL calls to be executed in a single cgo call.

A GL call is marked as blocking if it returns a value, or if it
takes a Go pointer. In this case the call will not return until
C.process sends a value on the retvalue channel.

Change-Id: I4c76b2a8ad55f57b0c98d200d0fb708d4634e042
Reviewed-on: https://go-review.googlesource.com/10452
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-01 15:35:03 +00:00
Nigel Tao
0d468be861 app: fix onInputQueueDestroyed shadowing bug.
Change-Id: Ia225c944e76c9ccd3f9ab16d7d13afbcbf41fd16
Reviewed-on: https://go-review.googlesource.com/10560
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-06-01 04:35:06 +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
David Crawshaw
d2248246f7 app: add iPad Mini 3, and a fallback PPI
Change-Id: I46cde56fe7f9a13de71bbb8c80b81cd273dd020f
Reviewed-on: https://go-review.googlesource.com/10540
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-29 19:22:41 +00:00
David Crawshaw
6391ccb644 app: don't panic on iOS touch
Change-Id: Ie19da493d78433170f13577c92e08e539f64aa24
Reviewed-on: https://go-review.googlesource.com/10486
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-29 14:14:32 +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
c73f3e75b6 app: support iOS touch events
Change-Id: I6e8effb1da24e9073454dd2643efdd3c3b3a5ded
Reviewed-on: https://go-review.googlesource.com/10480
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 21:07:47 +00:00
David Crawshaw
6c1c490379 cmd/gomobile: set tmpdir when calling cmd/dist
Fixes #10928

Change-Id: I7c842c9f0e812a31d0fe84fd6a2ea5f1259cb125
Reviewed-on: https://go-review.googlesource.com/10401
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 21:03:30 +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
David Crawshaw
d2634ce9c5 gl: darwin/arm64 support
Conflicts with cl/10396. I'll submit this first and update the it.

Change-Id: Ibc873b3fe896ecd2415a42676614807788a8d1c6
Reviewed-on: https://go-review.googlesource.com/10399
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 18:21:31 +00:00
David Crawshaw
730f563fbc app: set timezone on app initialization
This trusts bionic's reading of the system clock.

Future work should address the fact we cannot read the Android
zoneinfo file.

Fixes golang/go#10857.

Change-Id: I5a684fecc920dce5ab8f624658e91d9e2d71738d
Reviewed-on: https://go-review.googlesource.com/10299
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 18:11:00 +00:00
David Crawshaw
8f15a83bc0 cmd/gomobile: do not run make.bash with user env
The user may have set GOBIN, in which case the existing go command is
overwritten. I cannot think of any relevant environment variables the
user would set, so the easiest thing is not to use them at all.

While here, fix the unit test I broke in cl/10319.

Change-Id: I8cef353b5a0e4aabae97169ff553b53f7973ff8b
Reviewed-on: https://go-review.googlesource.com/10397
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 17:26:45 +00:00
David Crawshaw
305154cb90 app: darwin/arm64 support
Change-Id: Ic3d132f9b18e8308b2fb056e5a43adff804524d2
Reviewed-on: https://go-review.googlesource.com/10398
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 17:26:25 +00:00
Nigel Tao
7c723a6596 gl/glutil: fix TestImage.
The start/stop functions were introduced in
https://go-review.googlesource.com/#/c/9879/

Change-Id: I7aafadcbe78b60bb512c2de05f3f992e47f0df6e
Reviewed-on: https://go-review.googlesource.com/10372
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-22 11:30:56 +00:00
David Crawshaw
c95aae96ba cmd/gomobile: update init with new compiler name
Change-Id: Id01a628ca4cb70a936a0aa19b9ffc037f92c933d
Reviewed-on: https://go-review.googlesource.com/10319
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-22 09:04:17 +00:00
David Crawshaw
73e04c3da0 gl/glutil: manage GL textures across start/stop
Change-Id: I574f9ea8ab8138c769be19df8b1e86a7fbe544a8
Reviewed-on: https://go-review.googlesource.com/9879
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-05-20 12:05:26 +00:00