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

658 Commits

Author SHA1 Message Date
David Crawshaw
2b7eb78ade gl: factor cgo types out of gl.go
This allows a subsequent CL to introduce windows support by directly
calling an ANGLE dll.

For golang/go#9306

Change-Id: I7dbe8f2b77b9e2c744f0d848f716ee4448916fe7
Reviewed-on: https://go-review.googlesource.com/17674
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-14 14:29:55 +00:00
Hyang-Ah Hana Kim
563f2bdd3a cmd/gomobile: update hashes of gomobile-ndk-*
These tar.gz include x86, x86_64 tools and libraries.
This CL will be submitted once the files are available from dl servers.

Updates golang/go#10743

Change-Id: I4dd59221f392d6daf4d13ab7af38d01b8e6f4546
Reviewed-on: https://go-review.googlesource.com/17560
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-12 00:00:47 +00:00
Hyang-Ah Hana Kim
cd12613973 cmd/gomobile/release.go: include x86, x86_64 toolchains
3x the stripped ndk size - still smaller than the full NDK archive
(400MB vs 120MB)

Update golang/go#10743

Change-Id: I38e2abb01c64d38adbb5de55347ad92a9031aba6
Reviewed-on: https://go-review.googlesource.com/17502
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-10 02:09:38 +00:00
Sridhar Venkatakrishnan
2b73c5f386 bind: iOS support for multiple packages.
As discussed in golang/go#12245

Usage: gomobile bind [options] a.b.c x.y.z

For ObjC, gomobile bind will generate GoC.{h,m} and GoZ.{h,m}. If
-prefix=App is specified it will generate AppC.{h,m} and AppZ.{h,m}.

Tested on Darwin.

Change-Id: I6af8539a0fb7ed6256f3773efc514eff436014b4
Reviewed-on: https://go-review.googlesource.com/17475
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-09 16:24:12 +00:00
David Crawshaw
e154aff74e bind/java: custom int-keyed hashmap
This removes the last dependency on an Android class in the running
gobind code. (Tests still need some work before they will run on the
desktop.)

Change-Id: I49bfb545d4587c6f430c0938fa1ca4d513b56d77
Reviewed-on: https://go-review.googlesource.com/17252
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-02 14:48:43 +00:00
David Crawshaw
2454c829c1 bind/java: move android-specific context code
Change-Id: I7b1dfae97576c7bb2d45e6c2a5732e20df79a77b
Reviewed-on: https://go-review.googlesource.com/17251
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-12-02 14:44:46 +00:00
Hyang-Ah Hana Kim
0a581ceb1e bind/java: do not return null String for empty Go string
Fixes golang/go#13430

Change-Id: Ic018761af6a40f6b04ec4449110f54af8f543a53
Reviewed-on: https://go-review.googlesource.com/17273
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-01 20:12:01 +00:00
Hyang-Ah Hana Kim
01216d9779 cmd/gomobile: do not pass -i to 'go install' command
Fixes golang/go#13407

Also updates bind test.

'gomobile bind' currently runs 'go install' first and generates code
from the compiled object. This makes the -i option unnecessary.
Updated the bind command doc not to mention the -i option.

The use of -i option from Android Studio GoBind plugin will be removed
in a separate CL.

Change-Id: Ie48c00874219adb5169e01d3ba61930728cf2314
Reviewed-on: https://go-review.googlesource.com/17253
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-30 21:48:35 +00:00
Meir Fischer
9cdfd16af3 bind: use single Ref for null objects
The aim of the RefTracker is to "... pin Java objects so
they don't get GCed while the only reference to them is
held by Go code." But in the case of null objects there is
nothing to GC. Therefore we do return a single Ref which
contains a null object, but we ignore the logic that is used
to pin for GC purposes.

Change-Id: If3771ec0180d09485963c3297abccb39a1a8d9ab
Reviewed-on: https://go-review.googlesource.com/13647
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-30 20:03:33 +00:00
David Crawshaw
7b89485f3d bind/java: use standard Java Logger
Change-Id: I47c9ba45d3c366821856c1a28bb945ed11b6e18a
Reviewed-on: https://go-review.googlesource.com/17234
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-30 17:41:42 +00:00
Hyang-Ah Hana Kim
6295a61f59 cmd/gobind: delete unused parseFiles func
Change-Id: I1f9678671692becde0721347721bea65530146ee
Reviewed-on: https://go-review.googlesource.com/17190
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-24 15:52:38 +00:00
Sridhar Venkatakrishnan
71a0e8bda1 bind: Android support for multiple packages.
As discussed in golang/go#12245

Usage: gomobile bind [options] a.b.c x.y.z

For java gobind and gomobile  will generate go.c.C.java and go.z.Z.java.
If -javapkg=com.example is specified they will generate
com.example.C.java and com.example.Z.java.

Tested on Darwin.

Change-Id: Ia8e57c8fec7967131d55de71cc705d9e736ccca0
Reviewed-on: https://go-review.googlesource.com/17023
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-24 12:33:02 +00:00
David Crawshaw
0d55c986b8 cmd/gomobile: make -n work with bind
Fixes golang/go#13323.

Change-Id: Ica213b7d06581ac7a0492184a903752cfa15d889
Reviewed-on: https://go-review.googlesource.com/17090
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-20 17:04:45 +00:00
Hyang-Ah (Hana) Kim
b39ed682d8 cmd/gomobile: sanitize android app package names
https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

"This can occur if the domain name contains a hyphen or other special
character, if the package name begins with a digit or other character
that is illegal to use as the beginning of a Java name, or if the
package name contains a reserved Java keyword, such as "int". In this
event, the suggested convention is to add an underscore."

The sanitized name is used for the app package name and the default apk
file name.

Update golang/go#12273

Change-Id: I76d7f423e87c54a5bb7ab71ec251fd3a26da9722
Reviewed-on: https://go-review.googlesource.com/16875
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-18 17:26:55 +00:00
David Crawshaw
d95efb4572 internal/loader: delete
Change-Id: I1ffaf6139d43ef4b13665abc975f4482c327eb34
Reviewed-on: https://go-review.googlesource.com/16914
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 19:26:15 +00:00
David Crawshaw
d4beed2e0a cmd/gomobile: load from export data, not source
Replace the vendored version of x/tools/go/loader with the standard
library's go/importer package. This reads the export data from
$GOPATH/pkg/pkgname.a instead of parsing and type checking the source
code. The "go install" subcommand is invoked just prior to reading
the export data to make sure the export data is up to date.

Not yet tested on darwin, but working for android builds.

Change-Id: I24aa60aa46b843d30bc5833e3035699900bf3df4
Reviewed-on: https://go-review.googlesource.com/16913
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 19:25:59 +00:00
David Crawshaw
f8cb2f0e7e cmd/gomobile: expose goVersion to subcommands
Pulled out of golang.org/cl/16913.

Change-Id: I041aba4e8cefed95ee2935139571140164b5d677
Reviewed-on: https://go-review.googlesource.com/17001
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 18:51:34 +00:00
David Crawshaw
a6a27b7fc9 cmd/gomobile: say why a version is unknown
Fixes golang/go#13238

Change-Id: Ib44f9833891d721843a0fa255d9a86f1c7d43902
Reviewed-on: https://go-review.googlesource.com/16929
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 12:58:04 +00:00
David Crawshaw
8835366576 cmd/gomobile: build android stdlib
Second attempt at the change reverted in golang.org/cl/16917.

The current code executes go install -buildmode=c-shared std, which
does nothing. (See golang/go#13234.)

Correctly compiling packages for android arm requires different
flags on Go 1.5 and 1.6, as we now build PIC. So we look for go1.5
in the output of "go version", and otherwise assume 1.6+.

Change-Id: If636f52be5019bd179483b8735630a98e6f8d201
Reviewed-on: https://go-review.googlesource.com/16928
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-16 15:38:01 +00:00
Hyang-Ah Hana Kim
4f9c718489 Revert "cmd/gomobile: avoid -buildmode for go install std"
This reverts commit b84795b4945bb0ca4d464ffff3cba37d2ff049c5.

See golang/go#13246

Change-Id: Ie8b89a9ac6e5b6906b3a4de21122d694cf7a2d0a
Reviewed-on: https://go-review.googlesource.com/16917
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-14 03:18:11 +00:00
David Crawshaw
daecc566fd cmd/gobind: load from export data, not source
Replace the vendored version of x/tools/go/loader with the standard
library's go/importer package. This reads the export data from
$GOPATH/pkg/pkgname.a instead of parsing and type checking the source
code. The "go install" subcommand is invoked just prior to reading the
export data to make sure the export data is up to date.

This has the advantage of relying entirely on the go tool for correctly
resolving and parsing dependencies of the package being bound. (For
example, a bound package can now depend on cgo.) It also removes a class
of bugs where the version of the loader we depend on can get out of sync
with the go tool. (For example, gobind now correctly handles vendor
dependencies.)

As a bonus, for packages with significant dependencies this approach
should also be noticeably faster as we do not need to parse and
typecheck all of the dependencies.

Change-Id: If9a431c137eae2071c1d89be88a4a6a61d6812fa
Reviewed-on: https://go-review.googlesource.com/16911
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 20:01:33 +00:00
David Crawshaw
b84795b494 cmd/gomobile: avoid -buildmode for go install std
Turns out that go install -buildmode=c-shared std does nothing. The go
tool filters all non-main packages from c-shared builds, which for the
standard library is all packages.

This may be a bug in the go tool. I'm not sure yet. But either way, to
make the gomobile tool work with Go 1.5, work around it here.

Change-Id: Ica1e7eeb0f40a21a2c78b0c55bdc54f133a32ee5
Reviewed-on: https://go-review.googlesource.com/16912
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 20:00:04 +00:00
David Crawshaw
e2a9091da2 bind: remove extra "package" from error string
Fixes golang/go#13064

Change-Id: I2cde12a831607cd37d9760d92c0ef0f53fd6dd8b
Reviewed-on: https://go-review.googlesource.com/16351
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 12:13:51 +00:00
Daniel Skinner
3b97f7024e cmd/gomobile: synthesize minSdkVersion for manifest
Fixes golang/go#13172

Change-Id: I16cab3f74f668ce3522a1a14c979aca5c988347c
Reviewed-on: https://go-review.googlesource.com/16843
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-13 09:00:34 +00:00
Hyang-Ah Hana Kim
a54776c08a bind, internal/loader: fix errors reported by vet
Change-Id: Ia1c2e13cd093fec1c4d6c38828b057d1a38274e4
Reviewed-on: https://go-review.googlesource.com/16841
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-11 22:33:35 +00:00
Hyang-Ah (Hana) Kim
4eceb7296e bind: error on named basic types
error message example:

 gomobile: unsupported named type github.com/sridharv/bugreports/typealiasmissing.Alias

Objective-C and Java generation code currently panics, which need to be
fixed separately. (See TODO in bind/seq.go)

Fixes golang/go#13190

Change-Id: Ie46dc58ea800522b8ab7cb8ac662ad561e0ca82e
Reviewed-on: https://go-review.googlesource.com/16780
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-11-11 22:33:09 +00:00
Hyang-Ah Hana Kim
9c6db08f1d bind/objc/testpkg: delete accidentally committed files.
Change-Id: I9a2a83ef64cb9ee877db952ff6f8e050cd52873d
Reviewed-on: https://go-review.googlesource.com/16840
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-11 22:32:48 +00:00
Angelo Bulfone
8adb9ed3fb exp/sprite/portable: revert for /x/image/draw api
Fix broken build that was broke by "fix[ing] broken build"

Beaking change: http://golang.org/cl/13970
Reverting to state after http://golang/org/cl/12774

Change-Id: Ibb054467ca374d1f9ccff0ec1874a3e567d0c325
Reviewed-on: https://go-review.googlesource.com/16021
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-10 13:59:11 +00:00
Hyang-Ah Hana Kim
1452f035be cmd/gomobile, asset: specify vanity import paths
Change-Id: I3740f3be3d229c308e12f94bb88d8c8b8a411d19
Reviewed-on: https://go-review.googlesource.com/16636
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-05 15:43:03 +00:00
Burcu Dogan
3ca3fec8ee exp/audio/al: add Capability type, export distance model capability
Fixes golang/go#11298.

Change-Id: I3f103a2c1a63e96ca8c7367994179fb32d5ec7db
Reviewed-on: https://go-review.googlesource.com/16435
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 21:42:10 +00:00
Burcu Dogan
c6f2181dba cmd/gomobile: don't override the build tags
Fixes golang/go#13082.

Change-Id: I0956efb1045cc04dcda5034e2ff6e3089be192e0
Reviewed-on: https://go-review.googlesource.com/16433
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-28 20:22:40 +00:00
Burcu Dogan
7c674f7f33 exp/audio/al: use variadic functions everywhere
Change-Id: I827bca98398b2fabd9dfb8970452d8968555487b
Reviewed-on: https://go-review.googlesource.com/16402
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 20:20:45 +00:00
Hyang-Ah (Hana) Kim
9868458844 bind/objc: correct handling of empty string return value.
Fixes golang/go#13087

Change-Id: I9d7319d9ed3eee73e6479510911f796ab0607bd2
Reviewed-on: https://go-review.googlesource.com/16452
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 19:30:01 +00:00
Burcu Dogan
5785cf5e17 cmd/gomobile: remove the unused Debug configuration
Change-Id: Ic55a3dd91d2b3baccf22de532d98a3d29f799df9
Reviewed-on: https://go-review.googlesource.com/16414
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 17:00:43 +00:00
Hyang-Ah (Hana) Kim
8a59fd3f45 bind: correctly lowercasing all caps names
Fixes golang/go#13031

Change-Id: I6cae8e303d0d929e26c44cbdf1c243e98dabb766
Reviewed-on: https://go-review.googlesource.com/16270
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-23 16:10:33 +00:00
Burcu Dogan
b7734b1851 exp/audio: document the package being designed for small media files
Change-Id: Icbe531369920f0a4b80c37622fb66d1bc4221377
Reviewed-on: https://go-review.googlesource.com/16230
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-22 22:24:15 +00:00
Hyang-Ah (Hana) Kim
bf2ca7a93b x/mobile/bind: forward declare protocol/class for interface types
Fixes golang/go#13004

Change-Id: I114cf3d7d970485d0609b1d7b497e232010e64df
Reviewed-on: https://go-review.googlesource.com/16155
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-22 17:03:04 +00:00
Daniel Skinner
38a56c4998 cmd/gomobile: support manifest theme with new reference type
Style identifiers for included themes were selected based on
api level <= 9.

Fixes golang/go#13018

Change-Id: I6be19a90b65ad5cbd78ff73fe2d9a71b8e3908ca
Reviewed-on: https://go-review.googlesource.com/16159
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-22 15:26:47 +00:00
Daniel Skinner
103b3cfae8 cmd/gomobile: support manifest screenOrientation
Testing BinaryXML for the change was non-trivial as the first 4 bytes
of gomobile output did not match the latest version of aapt's output.
A new approach to testing compatibility was added based on how the
aapt tool pretty prints xmltree of manifest's contents.

Fixes golang/go#10943

Change-Id: I5c60af10931d9693dbeaff66f23a69042a78e8fa
Reviewed-on: https://go-review.googlesource.com/16150
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-21 22:56:52 +00:00
Burcu Dogan
1b12574c99 exp/sensor: don't enable a sensor on a sender
The underlying implementation was not enabling the sensors on a
particular sender even though the Enable signature accepts different
instances of Sender to enable.

Consider the following program:

  type A struct{}
  func (a A) Send(ev interface{}) {}

  type B struct{}
  func (b B) Send(ev interface{}) {}

  sensor.Enable(A{}, sensor.Gyroscope, time.Millisecond)
  sensor.Enable(B{}, sensor.Accelerometer, time.Millisecond)

is going to compile but only A will be notified when there are new
gyroscope and accelerometer events.

In order to improve the misleading APIs, this CL introduces a
Notify function that users can register a Sender implementation to
listen the changes. If set nil, the sensor package will keep
reading the events but will won't notify.

  sensor.Notify(A{})
  sensor.Enable(sensor.Gyroscope, time.Millisecond)
  sensor.Enable(sensor.Accelerometer, time.Millisecond)

Change-Id: I25e43349e4ae682930baa2d32430f46f24b588b7
Reviewed-on: https://go-review.googlesource.com/15650
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-19 21:21:50 +00:00
Burcu Dogan
f1034a4131 cmd/gomobile: use the proper prefix when generating a bundle
Fixes golang/go#12960.

Change-Id: I97abdc3219e857a83908a360aa619089086795ac
Reviewed-on: https://go-review.googlesource.com/16026
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-19 16:14:39 +00:00
Burcu Dogan
319b6ff544 bind: use the prefix in the include guards
Fixes golang/go#12984.

Change-Id: I485e6071ff136eb3f475d03ebebf8d306f24c931
Reviewed-on: https://go-review.googlesource.com/16027
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-19 16:13:27 +00:00
David Crawshaw
0303da803c cmd/gomobile: fix test for buildmode=c-shared
Added recently, but I forgot to update the test.

Fixes golang/go#12983

Change-Id: I668b20d74c6b91d9588e6f252939d36ae780bd77
Reviewed-on: https://go-review.googlesource.com/16052
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-19 14:40:54 +00:00
David Crawshaw
82d11f2f29 cmd/gomobile: build android stdlib as PIC
Fixes golang/go#12581

Change-Id: I9e462b76037f0f89f1d3e59b9aef899d21de925a
Reviewed-on: https://go-review.googlesource.com/15803
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-13 19:59:19 +00:00
Hyang-Ah (Hana) Kim
51389df416 bind/objc: use lowercase for method names.
Fixes golang/go#12889.

Change-Id: I4b8f5e4b2c4fe53146fc351889664cbeb5a1860b
Reviewed-on: https://go-review.googlesource.com/15780
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-13 18:34:52 +00:00
Hyang-Ah (Hana) Kim
090457ac45 bind/objc: change exported var accessors to class methods.
for example,

package testpkg
var AnInt int64

will be mapped to

@interface GoTestpkg: NSObject
+ (int64_t) AnInt;
+ (void) setAnInt:(int64_t)v;
@end

Followup of cl/15340

Update golang/go#12475

Change-Id: Ie26c92af977fc3dd62dcad2b10c6a5c1c1b8941b
Reviewed-on: https://go-review.googlesource.com/15770
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-13 18:34:32 +00:00
Hyang-Ah Hana Kim
5c6636dcb9 app: fix x11.go broken after cl/15460.
Fixes golang/go#12911

Note: the x11 support seems outdated in general compared to
android, darwin versions.

Change-Id: I2a80215c62b8c3cf87c5eb054184fea10819abc9
Reviewed-on: https://go-review.googlesource.com/15790
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-12 22:02:50 +00:00
Burcu Dogan
d19d328d7b exp/sensor: avoid using naked returns
Naked returns must be used for self-documentary reasons. In this
unexported package, it is not useful to name return values.

The change has been contributed on a previous CL but I don't know
what happened, it should have been lost on a bad merge.

Change-Id: I6cb9c3a58ad397aeb646f3e57e482628fe31ca31
Reviewed-on: https://go-review.googlesource.com/15658
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-12 17:03:38 +00:00
Burcu Dogan
83be1bf497 exp/sensor: remove the unpopulated error from the readSignal
readEvents never return an error, readSignal should not have an
error field.

Change-Id: I9566a6905ee678599fdad18f85ae55d1fdc16cc1
Reviewed-on: https://go-review.googlesource.com/15550
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-08 21:24:20 +00:00
Burcu Dogan
6db2cde289 exp/sensor: remove obsolete TODOs
Several notices, notes and questions have become obsolete when
CL/15438 is merged. Removing the TODOs pointing to the bug explained
in CL/15438's description.

Change-Id: I8a94507a6d0aa507a58be451336eba36dd383d64
Reviewed-on: https://go-review.googlesource.com/15551
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-07 21:08:13 +00:00