Граф коммитов

616 Коммитов

Автор SHA1 Сообщение Дата
David Crawshaw ec91477003 app: mention wiki docs in app package docs
Change-Id: I5fc7fe86f47e117e2b09dd16d7a588374b32dd66
Reviewed-on: https://go-review.googlesource.com/13611
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-12 16:21:36 +00:00
Nigel Tao 4ee6e2bd6d app: fix s/spaces/tabs/.
Change-Id: I795a82a8549d250fb9ca33134248fb4ff12bd0a0
Reviewed-on: https://go-review.googlesource.com/13491
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-12 04:16:58 +00:00
David Crawshaw c2f4676407 app: fix X11 build
Change-Id: Ida7cd57eefac66bcff89720ac5c82015d1d37f00
Reviewed-on: https://go-review.googlesource.com/13540
Reviewed-by: Jeffrey Regan <jregan@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 19:16:57 +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 73792b1db2 bind: update doc to include objective-C interface type support.
Also mention the current limitation in byte slice binding.
golang/go#12113.

Change-Id: Ie75780c2d203431ca26a188dfdb8f000f6805c18
Reviewed-on: https://go-review.googlesource.com/13531
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 16:37:26 +00:00
David Crawshaw 0f9ce16152 app: plumb through android orientation
While I'm here, make pixelsPerPt local on android and darwin/amd64.
The one place where it's global is darwin/arm, which has another
similar global (screenScale).

Change-Id: I5897e7e5341afca1976fdf0215fb4f6fe2f411be
Reviewed-on: https://go-review.googlesource.com/13446
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-11 15:19:09 +00:00
David Crawshaw 354679495a app: always send paint event when bumping gen
When the generation number is bumped, the <-endPaint case will drop
any old paints. So if a new paint isn't sent to replace it, the app
locks up.

This is a bug that looks like it crept into cl/12533 just before it
was submitted. (Sorry.) I'm working on tests as part of adding
android orientation support.

Change-Id: I6b62bdc6774e090b67a5577c3eae7355e3937894
Reviewed-on: https://go-review.googlesource.com/13445
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-11 14:52:42 +00:00
Hyang-Ah (Hana) Kim 2a7a6f0949 cmd/gomobile: use the app names as bundle id in ios.
This fixes the bug - all apps built with gomobile build had the same
bundle id (org.golang.todo.main).

As part of this fix, rfc1034Label function is used to sanitize the app
name (in a similar way of 'rfc1034identifier' formatter). We use this
for Android app package name as well.

Change-Id: Iae1985614a55771bf1849fe66180c4ac736497d7
Reviewed-on: https://go-review.googlesource.com/13041
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 14:39:38 +00:00
Hyang-Ah (Hana) Kim 9e2563f3e7 asset: warn asset.Open must not be called from init.
Currently there is no easy way to fix golang/go#12077
so we document it.

Fixes golang/go#12077

Change-Id: I6b37ae375673c055152dad5b93e180d9831aef76
Reviewed-on: https://go-review.googlesource.com/13430
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-10 19:12:52 +00:00
David Crawshaw ea3ef0580c gl: handle zero length in GetAttachedShaders
Fixes golang/go#11980

Change-Id: I914234bfd3c39e2832db49d8f389305d919e6045
Reviewed-on: https://go-review.googlesource.com/13090
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-10 17:41:14 +00:00
David Crawshaw d382b23901 app: plumb through iOS orientation
Change-Id: I9cfaf23219a8e7e15727bd7338503b9fbc4634a2
Reviewed-on: https://go-review.googlesource.com/13444
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-10 17:11:20 +00:00
David Crawshaw a1723d5d95 cmd/gomobile: add SHA256 hashes for downloads
Change-Id: I063870b65be136f95d44c5c00c3be89015717c08
Reviewed-on: https://go-review.googlesource.com/13443
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-10 17:06:08 +00:00
David Crawshaw 51384a9898 event/config: add Orientation
There are several variations on orientation. iOS expposes a little
more orientation information through its basic enum than Android
does, but the more powerful Android API gives you degrees around a
circle, which while strictly more powerful, doesn't tell you easily
where the status bar is.

What I'm thinking with this is the primary use of an orientation
concept is to decide whether or not to lay out a UI for a wide screen.
This gives you that.

Later I hope the sensor API will give far more information about the
physical orientation of the device.

Change-Id: I00ff598853c7ed618cde266729d8d05e1a02a601
Reviewed-on: https://go-review.googlesource.com/13361
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-10 12:46:05 +00:00
David Crawshaw fa69a4e270 cmd/gomobile: better AndroidManifest errors
Before:
	gomobile: EOF
After:
	gomobile: error parsing /Users/crawshaw/src/golang.org/x/mobile/example/basic/AndroidManifest.xml: EOF

Change-Id: I5e890e3ede5eef04c0a9f26a894bf450da19b3d9
Reviewed-on: https://go-review.googlesource.com/13442
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-10 12:29:32 +00:00
Nigel Tao 1df827c65a app: merge android.go with loop_android.go.
There's no need for more than one Android .go file.

Change-Id: I75f5ced5680088b0ddbe5c700981b9a595d9e321
Reviewed-on: https://go-review.googlesource.com/13343
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-07 12:48:53 +00:00
Nigel Tao fa181effb8 event/config: add a Bounds method.
This is analogous to the image.Image's Bounds method.

Change-Id: I2be927f21008107b535cb79e231149cb8d4e8e36
Reviewed-on: https://go-review.googlesource.com/13152
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-07 00:14:21 +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
Nigel Tao 8fffdfa9fd event/{mouse,touch}: work in float32 pixels, not geom.Pt.
Higher-level widget or animation libraries should probably work in
geom.Pt, but pixels instead of (1/72s of) inches seems a better fit for
lower-level event libraries. Needlessly converting from (float32) pixels
to (float32) points and back can be lossy and lead to off-by-one errors.

Change-Id: I68102e36f2574b07b44c6a1b7281f4f27f9174cf
Reviewed-on: https://go-review.googlesource.com/13002
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-04 07:35:09 +00:00
Burcu Dogan 1f62208640 example/bind/android: GOMOBILE gradle setting is optional
Fixes golang/go#11998.

Change-Id: I418a7cd5507c59244eef2be39e0074a82adb4c97
Reviewed-on: https://go-review.googlesource.com/13067
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-03 18:28:18 +00:00
Burcu Dogan 99196c8691 example/bind/ios: remove the failing build step
Regenerating the package from Xcode is not required, demo
should focus on building with a .framework bundle.

Removing the genhello.bash invoking build step to fix the Xcode
builds.

Change-Id: I793b7e1f5373a287432a0a605df0bde54b1daa84
Reviewed-on: https://go-review.googlesource.com/13036
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-01 23:05:44 +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
Hyang-Ah (Hana) Kim e0b154b34c example/bind: Android studio example.
Change-Id: I4729e47a4a3c4474f4ad53704e7fec337583d9e2
Reviewed-on: https://go-review.googlesource.com/12800
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-31 20:10:44 +00:00
Hyang-Ah (Hana) Kim 8217477ff5 example/bind: iOS Objective-C @ xcode example
Change-Id: I10afa0961953e5a67f31479b564923b95ae5439f
Reviewed-on: https://go-review.googlesource.com/12821
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-31 20:00:56 +00:00
Hyang-Ah (Hana) Kim dc0c746bbb misc/androidstudio: change GobindPlugin parameters
Plugin version 0.2.2:

While debugging golang/go#11895 I noticed the PATH param is less
intuitive that I hoped for. This change makes the plugin requires
instead:

   pkg: the package to compile
   GOMOBILE: absolute path to gomobile
   GO: absolute path to go
   GOPATH: gopath.

GOMOBILE/GO params are optional if Android Studio is configured
to include right paths in its environment.

Additional changes included in this cl:
  - GOMOBILEFLAGS param for users to optionally specify gomobile
    options e.g. -v -x which will be useful for debugging.
  - Set src/target java version to 1.7. Previous versions of plugins
    were compiled with JDK8 by accident, which prevented use of
    the android studio recommended JDK7.

Change-Id: Ie7818eb20c5220b16ed0ebccfb91520fe03e6ccd
Reviewed-on: https://go-review.googlesource.com/12923
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-31 19:59:48 +00:00
David Crawshaw 92213082f9 app: update EndPaint in test and documentation
Change-Id: I7c9e6edc2d50dca3c2d15426370d218d0c4dfe09
Reviewed-on: https://go-review.googlesource.com/13021
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-31 16:28:29 +00:00
Hyang-Ah Hana Kim 18a718a447 cmd/gomobile: fix init test (linux)
Change-Id: I069991176c91e73255a3c92c19bb9f5eff94d681
Reviewed-on: https://go-review.googlesource.com/12980
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-31 14:47:41 +00:00
David Crawshaw 0c8ff9f648 app, event/paint: plumb through paint Generation
Change-Id: I82bac0dc24943c64560a0bac4687cbbbb8b5c328
Reviewed-on: https://go-review.googlesource.com/12841
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-30 16:09:38 +00:00
David Crawshaw dbb9fceceb cmd/gomobile: update docs, remove iOS warning
This is not to say that iOS support in the gomobile tool is "ready",
but it is working well enough to qualify as the same level of
experimental as the rest of the tool.

Change-Id: I7aab7a5072b23f051501bbb6bbecdb9c449296a5
Reviewed-on: https://go-review.googlesource.com/12892
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-30 14:59:13 +00:00
Hyang-Ah (Hana) Kim 68f31e14ae mobile: limit build to linux/darwin.
Change-Id: I99f3841742e8f2ea098cfb08e8f5575c84f7cf75
Reviewed-on: https://go-review.googlesource.com/12850
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-29 20:28:35 +00:00
David Crawshaw 5c91e60c93 app: android activity lifecycle awareness
This CL fixes two bugs in the existing app implementation on android.
The first, is it assumed a single NativeActivity instance is created
per process. This is not true. If you open an app, hit the back
button, then open it again, the original activity is destroyed and a
new one is created. So only call main.main in the first onCreate.

The second bug has to do with window lifetimes. Previously we only
processed GL work while the window existed, as part of a paint cycle.
This missed GL events called as part of a lifecycle downgrade when
the window was destroyed. (I.e. the contents of onStop.) This CL
fixes this by making the main android event processing loop last for
the life of the process, not the window.

Fixes golang/go#11804.

Change-Id: Ia03e464aab5bc10ba75564b7ca11054515cda011
Reviewed-on: https://go-review.googlesource.com/12533
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-29 14:29:11 +00:00
Nigel Tao 723de9f813 exp/sprite/portable: update for x/image/draw API change.
The API change is http://golang.org/cl/12669

Change-Id: Ia34bb2efae808c45e9c0cfd4d3f510fdad549444
Reviewed-on: https://go-review.googlesource.com/12774
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-29 01:18:55 +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
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