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

583 Commits

Author SHA1 Message Date
David Crawshaw
23401e249d cmd/gomobile: skip test if keytool is bad
Looks like the binary is present on OS X even when Java is not
installed, and it returns an error when called.

Change-Id: Icbd42637f718a4fc05e65ea3973a584d1f24850e
Reviewed-on: https://go-review.googlesource.com/12743
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-28 16:36:02 +00:00
Hyang-Ah (Hana) Kim
b3bd3d29aa example: limit examples build to linux or darwin.
windows and other non-mobile os support is not there yet.

Change-Id: Ie9c456b646bfa0b0c489e1b6344b5afca4801c5f
Reviewed-on: https://go-review.googlesource.com/12744
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 16:32:30 +00:00
David Crawshaw
d691afa36e app: basic android app lifecycle test
Change-Id: I3db2d631e9be50b34ee9ac6df9615575cc1d6e33
Reviewed-on: https://go-review.googlesource.com/12642
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-28 15:24:53 +00:00
Hyang-Ah (Hana) Kim
af3e09ede0 cmd/gomobile: add -work flag.
In order to make the artifacts of go build command preserved under WORK
directory, this change modifies TMPDIR (TEMP/TMP for windows)
environment variables to point to gomobile's tmpdir if -work flag is set.

> gomobile init -work
WORK=/gopath/pkg/gomobile/work-276689736

> ls /gopath/pkg/gomobile/work-276689736
README			go-build823903592	openal
android-ndk-r10e	go-build858075903
go-build365743399	go-build921886344

> gomobile build -work golang.org/x/mobile/example/basic
WORK=/tmp/gomobile-work-863381843

> ls /tmp/gomobile-work-863381843
go-build102034516	libbasic.so

> gomobile bind -work github.com/hyangah/ivy
WORK=/tmp/gomobile-work-355100962

> ls /tmp/gomobile-work-355100962
android			go-build284034365	javac-output
androidlib		go_ivy

Change-Id: I2f467e0063bc1c8b8c636a8cd6d100e86a99a91a
Reviewed-on: https://go-review.googlesource.com/12720
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 13:37:12 +00:00
David Crawshaw
405d6233b3 cmd/gomobile: parameterize tests on NumCPU
Builders only have p=4.

Change-Id: I3e5d57579d26cb26f4ce29817a7bbdd8c34ad2ae
Reviewed-on: https://go-review.googlesource.com/12742
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-28 13:18:05 +00:00
Nigel Tao
cdc5281044 event/config: specify width and height in both pixels and points.
Change-Id: I494c17b2bad6c920ea20b22046d1d3fbc7b6b1d4
Reviewed-on: https://go-review.googlesource.com/12700
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 01:48:05 +00:00
Nigel Tao
f2f4efe74b event/mouse: new package.
Change-Id: Idd30a70bf62971ecea8ee9db905d4a0a8baf6525
Reviewed-on: https://go-review.googlesource.com/12667
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 01:28:46 +00:00
David Crawshaw
2928ad7782 cmd/gomobile: use nm to build list of packages
Today we only look at direct imports of package main for an import of
golang.org/x/mobile/app, which is unfortunate. We also do a complete
package tree load using go/build looking for the OpenAL import when
building for android, which involves reading a lot of files.

The compiler and linker have already done all of this work for us.
Run nm on the output binary and extract package names from it.

Change-Id: Ie4f07befede5017bbca7d24325062369d4b5c30d
Reviewed-on: https://go-review.googlesource.com/12645
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-27 23:32:43 +00:00
David Crawshaw
cf7179576b cmd/gomobile: consistent iteration order of paths
This deflakes the TestIOSBuild test, which relies on the iteration
order. While here, use the existing contents to shorten the test
output comparison.

Fixes golang/go#11889

Change-Id: Ib8c9592d07c53a12eee1f40267eaa2074b8d71cc
Reviewed-on: https://go-review.googlesource.com/12679
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-07-27 20:15:51 +00:00
Burcu Dogan
9072a8963f cmd/gomobile: init should honor -u flag
gomobile init should force download the NDK or the OpenAL package
if -u is set. -x should not print `curl` lines if cached archives
are being used.

Change-Id: I82ceb28540c22a0579ba9969bcf11477f1da81fb
Reviewed-on: https://go-review.googlesource.com/12701
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-27 19:00:49 +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
David Crawshaw
73db4d8b43 cmd/gomobile: -n implies -x, use runCmd in install
Change-Id: Ic03f1e4e49a80cf1000735a367534161bf3fe975
Reviewed-on: https://go-review.googlesource.com/12454
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-27 17:54:18 +00:00
David Crawshaw
460cd41ce2 cmd/gomobile: fix tests, add -p=8 from cl/12641
Change-Id: I96552800dc8e396592a073283ccf8949b7849439
Reviewed-on: https://go-review.googlesource.com/12677
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-25 16:35:55 +00:00
David Crawshaw
e85e05a453 cmd/gomobile: fix build
Change-Id: Ia4f09fbc56ca4f0c31ef075049b7854442b0155e
Reviewed-on: https://go-review.googlesource.com/12644
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-24 20:04:04 +00:00
David Crawshaw
ecc4253790 cmd/gomobile: set *build.Context GOOS
This lets `gomobile build` work on a package that contains files all
protected as '// +build android'.

Change-Id: I22915aecda8674597cfe18e1f75d30e6bfc4aab7
Reviewed-on: https://go-review.googlesource.com/12640
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-24 19:52:34 +00:00
David Crawshaw
58652d815d cmd/gomobile: init darwin/arm{,64} concurrently
Drops the time for `gomobile init` on my machine from 46s to 30s.

Change-Id: Iab89f2e1d1cee4b414dc2fb1c735b4167aef9036
Reviewed-on: https://go-review.googlesource.com/12641
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-24 19:48:49 +00:00
David Crawshaw
bd8a095b54 event/key: add Code type
Also add a few missing codes.

Change-Id: I26b6db31067c67107fe4db142ec9f48ff13cc53e
Reviewed-on: https://go-review.googlesource.com/12536
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-24 12:23:42 +00:00
Meir Fischer
a34303262d exp/audio: fix inability to use mono 8 format
There is no way to distinguish an unknown format from
Mono8 because Mono8 is zero. The current CL fixes this
issue by starting the format constants from iota + 1.

Change-Id: I8c709cdaff3bc46bcc15ab770cfcfd04c186034d
Reviewed-on: https://go-review.googlesource.com/12386
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-07-24 05:53:18 +00:00
Nigel Tao
e5bb9c1e6f exp/gl/glutil: don't embed the *image.RGBA.
Embedding is more trouble than it's worth. For example, the image/draw
package will pick the slow code paths for an embedded *image.RGBA.

Change-Id: I64bd20a80814b838850950c05dd8257e5901aef7
Reviewed-on: https://go-review.googlesource.com/12567
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-24 05:26:20 +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
354c023467 cmd/gomobile: version command
Finding the revision info from compiled binary (gomobile) built with
'go get' is not currently possible. What we can do instead is to check
if the current mobile repository found from GOPATH builds the same
binary by running 'go install -x -n' and checking if it outputs any
output. If so, this command prints out the revision info of the
repository. Otherwise, prints 'unknown'.

Sample output:

./gomobile version
gomobile version +27329c5 Wed Jul 22 19:29:08 2015 -0400 (android,ios);
androidSDK=/Users/hakim/Library/Android/sdk/platforms/android-22

./gomobile version
gomobile version unknown

Change-Id: Idc26c8a1dd3b43cc47a5c15ce130e2b97a460cec
Reviewed-on: https://go-review.googlesource.com/12455
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-23 15:25:54 +00:00
David Crawshaw
2341c96d9d app: use isARepeat method instead of ARepeat prop
The property was only introduced in 10.10, and doesn't offer us
anything more than what the method gives us.

Fixes golang/go#11827.

Change-Id: I5a9f9b068b9f18acc85a68a37dae11f19df686a1
Reviewed-on: https://go-review.googlesource.com/12552
Reviewed-by: Andrey Petrov <shazow@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-23 12:08:15 +00:00
Hyang-Ah (Hana) Kim
8c8ee830af misc/androidstudio: source code for gomobile bind gradle plugin.
Currently version 0.2.1

I messed up previous versions and plugins.gradle.org doesn't let me
remove the bad versions.

Change-Id: I9eef512633b461ff5a7fcbe11a3e104efb250d61
Reviewed-on: https://go-review.googlesource.com/12538
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-22 22:16:26 +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
David Crawshaw
de4ba64cf5 app, event/key: keyboard events
First cut of events from physical keyboards.
Simple darwin/amd64 implementation.

Change-Id: I6e9d0a253387c841864ca9845ee729ea4f7573c7
Reviewed-on: https://go-review.googlesource.com/11815
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-22 20:09:27 +00:00
David Crawshaw
34f7142b5a app: be more careful about android redraw events
EGL is a poor source of window dimensions. On some fraction of
rotations, it reported the old dimensions. Switch to extracting the
data from ANativeWindow, which appears to be more reliable.

While here, plumb through orientation, and follow the recommendation
in the Android platform docs to block onNativeWindowRedrawNeeded
until the draw is complete.

Fixes golang/go#11741.

Change-Id: I6b29b6a1e5743c612c9af2a8cce4260c5d7e9ca6
Reviewed-on: https://go-review.googlesource.com/12381
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-22 15:25:30 +00:00
Burcu Dogan
09206a7c58 cmd/gomobile: test ios builds
iOS builds have been broken due to missing main executable. Xcode
doesn't complain and buildling the target .app bundle even if a
referenced objects doesn't exist.

Fixing .app builds and adding a unit test.

Change-Id: Ie9aec6c8c982a96c10bf07344e44bd501fcabd19
Reviewed-on: https://go-review.googlesource.com/12492
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-21 22:09:02 +00:00
Burcu Dogan
a1efd1d6c6 cmd/gomobile: use package path as the app name
If the application main package is in

  golang.org/x/mobile/example/basic

the generated application will have "Basic" as its name.

Change-Id: Ic59fae6e18c26e406ab352265aa2d6b11619c102
Reviewed-on: https://go-review.googlesource.com/12435
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-21 21:11:27 +00:00
Florin Patan
6256dc3e64 example/network: use correct app event filter
This change allows the example/network from gomobile to compile
correctly.

Change-Id: Id0f722796e0224ec4a7c06b163a25a4f3a5fbcb3
Reviewed-on: https://go-review.googlesource.com/12471
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-21 14:54:22 +00:00
David Crawshaw
5f9cda1c8a cmd/gomobile: build .framework for iOS bind
Tested manually, I can bind github.com/hyangah/ivy and include it
in an Xcode project.

Change-Id: I7dfa7828da7288841bc930d3e506ee97bf2ca520
Reviewed-on: https://go-review.googlesource.com/12388
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-20 20:49:37 +00:00
David Crawshaw
bebbf49ba9 cmd/gomobile: consolidate os/exec Run calls
Tested:
	go test golang.org/x/mobile/bind/java
	gomobile bind -target={ios,android} github.com/hyangah/ivy
	gobuild build -target={ios,android} golang.org/x/mobile/example/basic

	(With various takes on -x and -v.)

Change-Id: I15c8f605490381feb6fefb482110f2a1c210529d
Reviewed-on: https://go-review.googlesource.com/12411
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-20 17:45:43 +00:00
David Crawshaw
c9adc5b29d cmd/gomobile: build for iOS with -tags=ios
Fixes golang/go#11782.

Change-Id: Ifa23a3cbe0032972f7c5c122ac1689441b63334e
Reviewed-on: https://go-review.googlesource.com/12387
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-19 20:54:12 +00:00
Nigel Tao
c4654583ad event/touch: rename TypeStart to TypeBegin.
Change-Id: Ie8392cd6167fca1c0a7f10192824300d7885151d
Reviewed-on: https://go-review.googlesource.com/12342
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-18 04:39:45 +00:00
Jae Kwon
96f72abd68 cmd/gomobile: expect GoNativeActivity in external manifests
gomobile expects GoNativeActivity, otherwise current_ctx_clazz stays
null.
Fixed cmd/gomobile/manifest.go to expect GoNativeActivity, and fixed the
network example app.

Change-Id: Idad6f9bec2fcbc876fbd6013009582868ad3e133
Reviewed-on: https://go-review.googlesource.com/12374
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-18 02:39:09 +00:00
Hyang-Ah (Hana) Kim
32ad533813 example/audio: use the latest config.Event in arranger func.
Change-Id: I452e9e7e37a983421acac23ab265b822fbc3db19
Reviewed-on: https://go-review.googlesource.com/12339
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-17 19:53:07 +00:00
David Crawshaw
9359647d9e app: remove Callbacks and Run
It has to go sometime.

Fixes golang/go#10896.

Change-Id: I2ac1437e1d5913c09060931454bf11c3f742ef87
Reviewed-on: https://go-review.googlesource.com/12337
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 17:58:59 +00:00
David Crawshaw
c8a8acd495 example/sprite: move to events
Change-Id: I5f5b2aee9edebc7b50ee98e23da5f0fa7e06112d
Reviewed-on: https://go-review.googlesource.com/12335
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 17:57:13 +00:00
David Crawshaw
3ee73d9a25 example/audio: move to events
Change-Id: Ib6971e48abfa16b995d815ab37077c83940b9096
Reviewed-on: https://go-review.googlesource.com/12336
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 17:42:28 +00:00
Hyang-Ah (Hana) Kim
4e8e86aef1 README.md: add caution. shorten the README.md.
Change-Id: I0af72721dcb6ef9115fde7fa2223f6884b6fe52e
Reviewed-on: https://go-review.googlesource.com/12334
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-17 17:06:14 +00:00
David Crawshaw
ea6f260cd0 cmd/gomobile: update tests and add bind tests
Change-Id: I9e2fdf179b1e07a8b0d9b612913814768f8284dc
Reviewed-on: https://go-review.googlesource.com/12331
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 16:18:56 +00:00
David Crawshaw
7d5958d761 cmd/gomobile: pass -gcflags and -ldflags
Allows the use of -X, and similar flags.

Fixes golang/go#11645.

Change-Id: I0ca097059f5f70c277c79eb89f2cbb10890db802
Reviewed-on: https://go-review.googlesource.com/12333
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 14:09:01 +00:00
Nigel Tao
0d322895cb exp/sprite/portable: use golang.org/x/image/draw.
Change-Id: Ib41fd6614e3a5504d0cebe9a84b23a675d0e88fd
Reviewed-on: https://go-review.googlesource.com/12289
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-17 04:52:29 +00:00
Nigel Tao
84f8e5edcc event: move event.Filter to app.Filter.
Change-Id: I11044a6e01b53e441c05fc1baec36718e783622f
Reviewed-on: https://go-review.googlesource.com/12288
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-17 01:18:36 +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
David Crawshaw
c6888a7bae example/network: rewrite to use event loop
Change-Id: Ibcf8fa9aec7327e98d4a0cdb5c37bb39bcc41bf8
Reviewed-on: https://go-review.googlesource.com/12278
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-16 20:19:15 +00:00
David Crawshaw
9300366e65 cmd/gomobile: use new -pkgdir flag
The go command now has a -pkgdir flag, which specifies a directory
for all install output, including the standard library. Use it to
build the mobile compilers under $GOMOBILE, so that targets like
the iOS simulator (darwin/386) do not conflict with system targets.
The result is we no longer need GOROOT to be writable.

The iOS simulator now works with gomobile bind.

Fixes golang/go#11342.

Change-Id: I0bc6378e0cb82e3175b2a1efe355e3ce39533649
Reviewed-on: https://go-review.googlesource.com/12303
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-16 20:10:22 +00:00
David Crawshaw
d709f21793 app: fix darwin/arm build
Change-Id: I5ce658362ff24c7ed16a269eab7a5fcdcb5ad019
Reviewed-on: https://go-review.googlesource.com/12302
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-16 18:09:48 +00:00
David Crawshaw
ec5d8df4c0 cmd/gomobile: bind -target=ios support
First pass at bind support, simply produces .a/.h files.

In future CLs:

- Take the type defintion from seq.h and place it directly in the
  generated header, breaking the user's dependency on seq.h.

Open question for future CLs:

- Should we create a framework directory?
  If we bundle assets in the directory, can the asset package
  find them automatically?

In 1.6: support multiple archives.

Change-Id: I7c3f655e7653018333e3ce3c89807edfcf62906d
Reviewed-on: https://go-review.googlesource.com/12199
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-16 17:25:44 +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