Commit Graph

828 Commits

Author SHA1 Message Date
Elias Naur 7f64fd241f bind: fix compiler warnings
CL 29298 got rid of error type wrappers, but failed to update a
variable type accordingly.

Exposed by CL 31517 that enables -Werror.

Change-Id: I2c2b75dcd43b89ffa7fb008150b1aee09ec25229
Reviewed-on: https://go-review.googlesource.com/31518
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-21 09:24:50 +00:00
Péter Szilágyi 2ea7e2cc92 bind, bind/java: support generating exceptional constructors
In Go type constructors can often return an error type too
beside an instance of the type being created. This is useful
in cases where the parameters might be wrong and instantiaion
cannot succeed. This CL extends the Java generator so that
these methods are also converted into class constructors that
also can throw.

Change-Id: I5e531eec126904a026767a8503968255b9fd833b
Reviewed-on: https://go-review.googlesource.com/31184
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2016-10-17 14:21:52 +00:00
Elias Naur 4cb3e7f634 bind: accept implicit `self` parameters in all methods
This is the ObjC equiivalent to CL 30276. It expands support for
implicit `self` parameters to every exported method.

Change-Id: Iff8a956b38448213866a93dc02ca59cac592feef
Reviewed-on: https://go-review.googlesource.com/30277
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-17 10:37:36 +00:00
Elias Naur 1c49d29d1c bind,cmd: accept ObjC wrapper types in bound packages
Accept ObjC API wrapper types as arguments and return values from
bound Go package functions and methods. Also, allow Go structs
to extend ObjC classes and implement ObjC protocols as well as override
and implement methods.

This is the third and final part of the implementation of the golang/go#17102
proposal.

Fixes golang/go#17102

Change-Id: I601d90fb6d22b8d6f8b7d5fe0130daa1a4dd4734
Reviewed-on: https://go-review.googlesource.com/29175
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-17 10:37:16 +00:00
Elias Naur 63993740dd bind: fix field accessors for Go implemented Java classes
The go_seq_to_refnum function handles its argument object as a Java
object if it doesn't implement Seq.Proxy. Java classes implemented in
Go does not implement Seq.Proxy, but when passing "this" references to
Go, instances must be treated as a Go object.

Use go_seq_to_refnum_go everywhere "this" is passed to Go, which fixes
field accessors and simplifies the method call case.

Change-Id: I3d01c63d7b2081e6344ece431f5e5021a9dd7662
Reviewed-on: https://go-review.googlesource.com/31171
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-17 10:26:22 +00:00
Alex Brainman eb6d6dca20 cmd/gomobile: use correct version of clang on windows/386
Fixes golang/go#16823
Fixes golang/go#17376

Change-Id: Ia9c15242cce66eca1d36a5e1dc6106b3549c251d
Reviewed-on: https://go-review.googlesource.com/31110
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2016-10-17 00:13:54 +00:00
Elias Naur 6ecf8eedb8 bind,cmd: add generator for ObjC API wrappers
Using the new ObjC type analyzer API, scan the bound packages for
references to ObjC classes and protocols and generate Go wrappers for them.

This is the second part of the implementation of proposal golang/go#17102.

For golang/go#17102

Change-Id: I773db7b0362a7ff526d0a0fd6da5b2fa33301144
Reviewed-on: https://go-review.googlesource.com/29174
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-16 10:25:40 +00:00
Elias Naur a82bb3c8ba cmd/gobind,bind: generate complete Java interface with gobind
Output every Java class, including the support classes, from gobind
-lang=java. In addition, replace Go package export data parsing with
converting from go/ast to go/types. That way, gobind can tolerate
unknown imports as long as the exported Go API doesn't use them.

In a follow-up CL, the gobind gradle plugin will use gobind for a first
pass to expose the generated Java classes to the android plugin.

Change-Id: I8134899ec818c7fee79e4d9df8afcae9dd679add
Reviewed-on: https://go-review.googlesource.com/30093
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-14 13:14:45 +00:00
Egon Elbre 91c29e2bb7 x/mobile/gl: fix windows context3 and dlls
Add missing context3 for Windows.
Add missing d3dcompiler_47.dll loading.
Check whether dll architecture matches.
Search ANGLE from Chrome path.

Fixes golang/go#16991

Change-Id: Ia042f75241c2398fabda03bb2d0e683eb34545c7
Reviewed-on: https://go-review.googlesource.com/28814
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-10-13 20:58:55 +00:00
Russ Cox a4f0a77f2f bind: param name replacement for invalid unicode names
The are three generators that currently call this method:
    A  -> B
(1) go -> java
(2) go -> objective-c
(3) go -> go

As discussed below, we only substitute for invalid unicode characters
in case (1).

**Case 1**
Go:
From golang.org/ref/spec:
Identifiers name program entities such as variables and types.
An identifier is a sequence of one or more letters and digits(unicode_digit).
The first character in an identifier must be a letter(unicode_letter | "_" ).

Java:
From https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8
`The "Java letters" include uppercase and lowercase ASCII Latin letters
A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons,
the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $
character should be used only in mechanically generated source code or,
rarely, to access pre-existing names on legacy systems.`

Therefore, Go's identifiers are checked in case they break these Java rules.

**Case 2**
There is no objective-c standard specification for valid identifiers.
From some testing it seems that Go and objective-c have identical
valid identifier rules.

**Case 3**
Requires no checking.

Change-Id: I881810eb9355af6a418727ace32cb6ce4266b2a0
Reviewed-on: https://go-review.googlesource.com/14044
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-12 18:37:41 +00:00
Elias Naur 6ea0bb5370 internal/importers: introduce package to analyze ObjC types
The objc package adds a parser that uses the clang -cc1 -ast-dump
command to extract type information about ObjC classes and protocol.

The resulting type information is needed to generate ObjC API wrappers
in Go.

This is the first part of the implementation of proposal golang/go#17102.

For golang/go#17102

Change-Id: I8382b54c0bd315703ec5a62cc177e1a2ace061e9
Reviewed-on: https://go-review.googlesource.com/29173
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-05 13:16:13 +00:00
Elias Naur 4db6347e33 misc/androidstudio: add support for the android gradle plugin
The gobind plugin exposes a set of Go packages as a AAR file ready to be
used by and Android project. Unfortunately, being a library project
limits the Go packages to access only the Java API from the standard
library and the Android SDK.

This CL tightens the integration with the Android plugin to support access
to project dependencies such as the Android Support Library, to the generated
R.* resource classes and finally to the Android databinding classes.

When the gradle project has loaded the Android plugin, the generation of
the Go library is split in two.
First, the gobind tool generates the Java classes for the bound Go
packages. In this step, Go packages can access the standard Java and Android
libraries as well as project dependencies. After this step, Android
databinding layout files can refer to Go classes.
In step two, the gomobile tool generates the JNI libraries
with the Go implementation of the generated Java classes. In this
step, Go can access the standard Java and Android libraries,
dependencies as well as R.* and generated databinding classes.

Change-Id: If853ecabdbd01eec5f89d064a6bc715cb20a4d83
Reviewed-on: https://go-review.googlesource.com/30094
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-05 13:08:54 +00:00
Elias Naur e76ec53021 bind: support casting of Java objects
Generate Cast functions that take a proxy for a Java class or interface,
and return a new proxy with the same reference. The Cast functions
panic if the underlying Java object is not an instance of the expected
type.

Change-Id: I08a5bf9a79139f0fac5dd102c7b028c8c989fc6d
Reviewed-on: https://go-review.googlesource.com/30095
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-05 08:40:06 +00:00
Elias Naur 69dc8e1c38 bind: allow implicit `this` argument on every exported method
Before this CL, the implicit `this` arguments to methods on Java classes
implemented in Go was only supported on overriding methods, because
their parameter count are known. This CL expands support for the `this`
parameter to every exported method. It only recognizes parameters named
`this` declared with a Java wrapper type.

Change-Id: I8a9d3417d259bdfcc28512a72f07d6a05f483adc
Reviewed-on: https://go-review.googlesource.com/30276
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-05 07:49:55 +00:00
Elias Naur 3f7b83ffd4 bind: generate Java constructors for every exported struct
A recent CL added Java constructors to generated classes that extends
or implements other Java classes and interfaces. Constructors for a
struct S are Go functions on the form

func NewS...(...) *S

If no such constructors exists, a default empty constructor is
generated.

Expand that to cover every exported Go struct.

Fixes golang/go#17086

Change-Id: I910aba13d5884c3f67c946c62a8ac4a3db8e2ea7
Reviewed-on: https://go-review.googlesource.com/29710
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-05 07:47:24 +00:00
Elias Naur 89b8360218 bind: remove error wrappers to preserve error instance identity
CL 24800 changed the error representation from strings to objects.
However, since native errors types are not immediately compatible
across languages, wrapper types were introduced to bridge the gap.

This CL remove those wrappers and instead special case the error
proxy types to conform to their language error protocol.

Specifically:

 - The ObjC proxy for Go errors now extends NSError and calls
   initWithDomain to store the error message.
 - The Go proxy for ObjC NSError return the localizedDescription
    property for calls to Error.
 - The Java proxy for Go errors ow extends Exception and
   overrides getMessage() to return the error message.
 - The Go proxy for Java Exceptions returns getMessage whenever
   Error is called.

The end result is that error values behave more like normal objects
across the language boundary. In particular, instance identity is
now preserved: an error passed across the boundary and back will
result in the same instance.

There are two semantic changes that followed this change:

 - The domain for wrapped Go errors is now always "go".
   The domain wasn't useful before this CL: the domains were set to
   the package name of function or method where the error happened
   to cross the language boundary.
 - If a Go method that returns an error is implemented in ObjC, the
   implementation must now both return NO _and_ set the error result
   for the calling Go code to receive a non-nil error.
   Before this CL, because errors were always wrapped, a nil ObjC
   could be represented with a non-nil wrapper.

Change-Id: Idb415b6b13ecf79ccceb60f675059942bfc48fec
Reviewed-on: https://go-review.googlesource.com/29298
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-04 09:11:42 +00:00
Elias Naur 84d710de20 bind: don't throw away result values with unknown type
The Java API wrapper generator use interface{} for Java classes
that no Go code references. Return values of unknown types are thrown
away, since they're effectively useless. Since the return values can
be used for nil checks and since casting of Java instances are
supported in CL 30095, this CL returns the naked *seq.Ref results
values instead.

Change-Id: I821b1c344a4c68c57fd34e2b655404e449de4c03
Reviewed-on: https://go-review.googlesource.com/30097
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-04 08:12:22 +00:00
Elias Naur 16fd47fa04 bind: don't inherit java.lang.Object methods to Java interfaces
Before, the Java generator let Java interfaces inherit java.lang.Object
methods. However, interfaces strictly doesn't inherit Object and since
the JNI GetMethodID returns NULL for Object methods on interface classes,
stop making Object a super class to interfaces.

Change-Id: I3757c1ed02c07ccffab74a30132d5197742c6513
Reviewed-on: https://go-review.googlesource.com/30096
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-10-01 18:55:04 +00:00
Elias Naur e04a76eb64 cmd/gomobile,internal: add bootclasspath and classpath flags to gomobile
Add -bootclasspath and -classpath flags to the gomobile tool. In a
follow-up CL, the gobind gradle plugin will use them to support R and
databinding classes from Go.

Change-Id: Id33acf0c3fe1ec3908740b2a736ed241fa6391c2
Reviewed-on: https://go-review.googlesource.com/30092
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-09-30 20:31:20 +00:00
Elias Naur 9d5f7955ff bind: correctly generate methods with implicit this and parameters
Change-Id: I885a21876d9f639bc0996c9279fd0afefa93cef6
Reviewed-on: https://go-review.googlesource.com/29877
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-09-30 14:05:34 +00:00
Elias Naur 2dcaa053a0 bind: preserve no-arg Java constructors
When the Java class parser began culling unused constructors, the
logic for determining whether a given Java class has a no-arg
constructor broke when the no-arg constructor is culled. Add
an explicit field for tracking the no-arg constructor property.

Change-Id: Ib68929ae1108bd6fa1fd23de1d134332eb0d97a2
Reviewed-on: https://go-review.googlesource.com/29875
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-09-30 14:00:14 +00:00
Péter Szilágyi 1663ffa95c bind: initialize JNI library on any class load
With the introduction of constructors Java side, all types
become entry points into the library. However the library
was only initialized by the main class until now, resulting
in all other constructors hitting linker errors until an
interaction with the main library class.

This CL fixes that by changing each generated type to touch
the main library class, ensuring that the underlying native
library is loaded.

Change-Id: I640d1dc329e072f8d0753f74ccce87cd9e5aaea8
Reviewed-on: https://go-review.googlesource.com/29994
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2016-09-29 11:31:45 +00:00
Elias Naur 9640137a86 bind: add missing unsafe import in generated code
The ClassGen.genGo function always uses unsafe, contrary to what
the check in GenGo says. With this CL, generated code always
imports unsafe if there are any classes to be generated.

Change-Id: Ic807111a26e494b4941790830b1950bb8b1f73d5
Reviewed-on: https://go-review.googlesource.com/29873
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-09-27 16:37:51 +00:00
Elias Naur 8b28d19931 example: fix Android examples
The Java methods names were recently changed to lowercase, but the
examples weren't updated. Fix that.

While we're here, comment out the GOPATH and GO settings from
the Go build.gradle file. They're confusing for the newcomer and only
needed in the rare case where GOPATH is wrong or missing or if go is
not in PATH.

Change-Id: Ib795b440a0127c402e56b70529f6bd71c6f1322b
Reviewed-on: https://go-review.googlesource.com/29594
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-09-22 17:09:31 +00:00
Elias Naur bdf873ed8f bind,cmd: accept Java API in bound packages
Accept Java API interface types as arguments and return values from
bound Go package functions and methods. Also, allow Go structs
to extend Java classes and implement Java interfaces as well as override
and implement methods.

This is the third and final part of the implementation of the golang/go#16876
proposal.

Fixes golang/go#16876

Change-Id: I6951dd87235553ce09abe5117a39a503466163c0
Reviewed-on: https://go-review.googlesource.com/28597
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-22 10:16:33 +00:00
Elias Naur 08c3b2f4a5 bind: fix generated declaration of GoUniverseerror
GoUniverseerror is a (generated) protocol type, and variables of
protocol types use id<> notation.

Change-Id: I3d36b3ba634c10f0e59424faf71809c94df52cc6
Reviewed-on: https://go-review.googlesource.com/29052
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-21 06:52:53 +00:00
Elias Naur bf31dd1a5e bind,cmd/gomobile: add a new generator for Java API wrappers
Using the new Java class analyzer API, scan the bound packages
for references to Java classes and interfaces and generate Go
wrappers for them.

This is the second part of the implementation of proposal golang/go#16876.

For golang/go#16876

Change-Id: I59ec0ebdae0081a615dc34d450f344c20c03f871
Reviewed-on: https://go-review.googlesource.com/28596
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-16 17:25:25 +00:00
Elias Naur e4531be66f internal/importers: introduce package to analyze Java classes
The importers package adds functions to traverse the AST of a Go
file or set of packages and extract references to Java packages and
types.

The java package adds a parser that uses the javap command to extract
type information about Java classes and interfaces.

The resulting type information is needed to generate Java API wrappers
in Go.

This is the first part of the implementation of proposal golang/go#16876.

For golang/go#16876

Change-Id: Ic844472a1101354d61401d9e8c120acdee2519df
Reviewed-on: https://go-review.googlesource.com/28595
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-16 17:24:51 +00:00
Elias Naur 61011ba584 bind: fix error type
Errors was recently converted to use objects as representation instead
of strings. Issue golang/go#17073 exposed a few places that wasn't properly
updated. Fix them and add the test case from the the issue.

Fixes golang/go#17073

Change-Id: I0191993a8427d930540716407fc09032f282fc66
Reviewed-on: https://go-review.googlesource.com/29176
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-16 13:52:19 +00:00
Elias Naur e99a906c3a bind: avoid ObjC reserved names
The new tests in CL 28494 exposed a bug: the ObjC generator does
not avoid reserved names and names with special meaning ("init").
Generalize the name sanitizer from the Java generator and use that.

Also, move the lowerFirst function to gen.go since it is now used
by both generators.

Change-Id: I25b7af2594b2ea136f05d2bab1cfdc66ba169859
Reviewed-on: https://go-review.googlesource.com/28592
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-07 14:13:50 +00:00
Elias Naur 7f59993615 bind/objc: fix tests
CL 24792 changed Go's int type to be represented in ObjC as long.
Change SeqTest.m accordingly.

Change-Id: Ifd34787db713444fc729b497ed72b62688384bc8
Reviewed-on: https://go-review.googlesource.com/28591
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-07 12:53:58 +00:00
Elias Naur f52baf9a56 mobile/cmd/gomobile: fix test
Change-Id: I4c790d2156e6b167244ce3e4f5a37c1253e6e152
Reviewed-on: https://go-review.googlesource.com/28590
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-07 12:53:10 +00:00
Péter Szilágyi 2f75be449f bind: use lowercase method names for Java binds
There was a discussion a year ago about making methods and types
lowercase in ObjC (https://github.com/golang/go/issues/12889),
which was done (https://go-review.googlesource.com/#/c/15780/),
alas the suggested Java lower casing was never addressed.

This CL converts all generated Java methods to lower case.

Change-Id: Ia2f28519bc59362877881636109ddfc651b24960
Reviewed-on: https://go-review.googlesource.com/28494
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-07 12:52:06 +00:00
Péter Szilágyi f7e06c9519 exp/font: droid->noto fallback in tests
The Droid font has been superseeded by the Noto family upstream in
Android. This resulted in Debian and inherently Ubuntu too dropping
support for the first in favor of the latter. This CL ensures that
tests will pass on both older and newer debian based distros.

Refs:
 * https://github.com/googlei18n/noto-fonts/blob/master/FAQ.md#how-does-noto-relate-to-droid
 * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804683

Fixes golang/go#16990

Change-Id: Id0820d6c3bfde7822984fac58054f7dcc4625685
Reviewed-on: https://go-review.googlesource.com/28495
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2016-09-06 08:36:09 +00:00
Jaana Burcu Dogan 7573efae75 exp/audio: remove the high-level player
Since nothing about this high-level player will stay the same after
the audio work core types are finalized, there is no good point in
keeping the naive implementation around.

Removing also the audio example.

Updates golang/go#9551.

Change-Id: I5a7666c77e043aeacf44356e20e8d90822fd78e7
Reviewed-on: https://go-review.googlesource.com/27671
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Jaana Burcu Dogan <jbd@google.com>
2016-08-24 22:21:38 +00:00
Elias Naur ed036a869f mobile/bind: fix comment
Change-Id: I100d1a32da7ec4f6b29f3590f23ca0a9ddbf230a
Reviewed-on: https://go-review.googlesource.com/27442
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Sebastien Binet <seb.binet@gmail.com>
2016-08-22 14:31:51 +00:00
Elias Naur 80e11ad074 mobile/bind: move generated Java classes to package level
Before this CL, generated Java classes or interfaces were inner
classes to the top package class. That is both unnecessary and creates
ugly class names. Instead, move every generated class and interface to its
own package level class.

NOTE: This is a backwards incompatible change and requires every client
of gomobile APIs to be updated to leave out the package class in the
type names. For example, the Go type

package pkg

type S struct {
}

now generates (with the default java package name go) a Java class named
go.pkg.S. The name before this CL was go.pkg.Pkg.S.

Also, change the custom java package to specify the package prefix and
not the full package as before. This is an unfortunate change needed
to avoid name clashes between two bound packages. On the plus side,
the change brings the custom package case closer to the default behaviour,
which is a commen prefix, "go.", and a distinct java package for every
Go package bound.

Change-Id: Iadfaad56e101d1caf7e2a05006f4d384859a20fe
Reviewed-on: https://go-review.googlesource.com/27436
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-22 07:41:35 +00:00
Elias Naur 0ba4e6463d mobile/cmd/gomobile: remove explicit -p argument to the go cmd
Now that darwin/arm no longer use an explicit -p=1 in the go command
remove the explicit -p=<num cpus> from gomobile as well.

While we're here, fix the init test templates to reflect the new
clang based build.

Fixes golang/go#10477

Change-Id: I29a179e628466ae0c591620f485194b80e310811
Reviewed-on: https://go-review.googlesource.com/21186
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-16 10:53:25 +00:00
Daniel Skinner 8ab5dbbea1 event/size: document size pt approximation
Fixes golang/go#13366

Change-Id: I2af5e2492450ab5b5996fa5926460b62ce9d9bf5
Reviewed-on: https://go-review.googlesource.com/24865
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-08-04 01:15:58 +00:00
Hana Kim f58d095fc5 exp/audio: add instruction for installing required package
The error message from cgo will print the line, which now
includes the instruction as a comment.

Change-Id: I208365b5b1e4da0bd6df89882586fe438f7391b4
Reviewed-on: https://go-review.googlesource.com/25384
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-01 16:20:48 +00:00
Alessandro Arzilli cf96d36e8f event/key: add Compose key
Fixes #16332

Change-Id: I4fcd9c4c60fb5c32abaab5b68d3036d536ab2b69
Reviewed-on: https://go-review.googlesource.com/24880
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-07-21 02:17:49 +00:00
Elias Naur efd7eed289 mobile/cmd/gomobile: upgrade to NDK r12b and add nm
gomobile build uses the nm tool which was missing from the NDK r12
upgrade. I missed it because gomobile bind works without it.

Make release.go include nm and upgrade to NDK r12b to make avoid
name clashes with the already released, but inadequate, NDK r12
files.

Finally, update the cmd/gomobile tests to match the new clang
reality.

Fixes golang/go#16268

Change-Id: Ic0cbf75785baace1fe6e88c8dc72d83ce2e13b35
Reviewed-on: https://go-review.googlesource.com/24724
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-07-11 14:34:23 +00:00
Hana Kim f229b06003 cmd/gomobile: update doc and specify the min android API level
Change-Id: Ia065722ba3f6c793d19ecd05953f840beb0bdafb
Reviewed-on: https://go-review.googlesource.com/24791
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2016-07-07 16:20:36 +00:00
Hana Kim d38f5ba53d bind: map Go's int type to Objective-C's long type
https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/Major64-BitChanges/Major64-BitChanges.html

Fixes golang/go#16182

Change-Id: I312749e8a7113bf9231eb3896f801e450f46a410
Reviewed-on: https://go-review.googlesource.com/24792
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2016-07-07 16:20:08 +00:00
Elias Naur 44ce26ee94 mobile/bind: fix gomobile bind with custom Java package
The change from using strings to objects for passing errors across
the language barrier broke the custom java package mode of gombile
bind. Fix it and add a runtime test to make sure it won't happen
again.

Fixes golang/go#16262

Change-Id: Ia7f8afb79556798056f0755758052190081a2dbb
Reviewed-on: https://go-review.googlesource.com/24800
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-07-07 16:08:17 +00:00
Elias Naur 8d3035464e mobile/cmd/gomobile: fix gomobile init on Windows
My previous CL, 24490, broke gomobile init for Windows users because
it failed to take the Windows ".exe" postfix into account everywhere.
Fix it by copying the entire "bin" directory from the llvm toolchain
instead of picking out certain named binaries.

Also, symlink (or, in Windows, copy) the clang lib64 directory into
each target platform where clang expects it.

Fixes golang/go#16233

Change-Id: I8d966ca76bd22403ac2eacef3da7aae59e698059
Reviewed-on: https://go-review.googlesource.com/24720
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2016-07-07 08:58:53 +00:00
Nigel Tao 204c03cc80 event/mouse: add Button.IsWheel, ButtonWheelLeft and ButtonWheelRight.
Horizontal wheel events can come from some tilting scroll wheels, as
well as trackpoints (pointing sticks).

Change-Id: I02be43d44a65123e2d58539e291e9e6ac7e6bff4
Reviewed-on: https://go-review.googlesource.com/24633
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-07-02 00:00:04 +00:00
Nigel Tao 2d0a4d3322 event/mouse: add DirStep.
Change-Id: I4f9295ac2855928ecd43a5888ed776195c3129a5
Reviewed-on: https://go-review.googlesource.com/24639
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-07-01 22:50:24 +00:00
Elias Naur 34d472ecb6 mobile/cmd/gomobile: use NDK r12
Also:

- Replace GCC with Clang. GCC is slated for removal in future NDK
releases.
- Replace the deprecated obsoleted make-standalone-toolchain.sh
script with the new make_standalone_toolchain.py script.
- Add the NDK version to OpenAL tarball name, to avoid name clashes
with previous builds of the same OpenAL version.
- Removed obsolete workaround for a linker problem with NDK r10c.
- Update the URLs and unpack logic for the full NDK mode.

Change-Id: Ifeec6fee624862ba2ff2d4520dab42f800414f7b
Reviewed-on: https://go-review.googlesource.com/24490
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-29 15:33:04 +00:00
Elias Naur d5b8fb1623 mobile/bind/java: fix compiler warnings
Add a missing #include to declare the exported Go function
setContext, and replace old GNU-style struct initializers.

Change-Id: Id1660559236c39505a47368a700c8e0ad834cf6c
Reviewed-on: https://go-review.googlesource.com/24491
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-28 17:54:14 +00:00