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

982 Commits

Author SHA1 Message Date
Elias Naur
756a47a9b9 bind: fix generated JNI name for Go packages with underscores
Fixes golang/go#27669

Change-Id: Id4071e14fe2a35b2b54801af9d0161f08f3e9e9c
Reviewed-on: https://go-review.googlesource.com/135755
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-09-17 20:17:38 +00:00
Tadas
3409effab8 bind: pass correct arguments to fromSlice and toSlice
Fixes golang/go#27705

Change-Id: I6d26b02b49a9904a4d949e5ca5a9d234f6092ea4
GitHub-Last-Rev: 9b9314fed184247f69a5f7e567f502b22aa5b135
GitHub-Pull-Request: golang/mobile#22
Reviewed-on: https://go-review.googlesource.com/135423
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-09-17 19:10:04 +00:00
Tadas
18ac050e90 cmd/gomobile: make the minimum iOS sdk version configurable
Fixes #27680

Change-Id: I8af5c120aaa2ddbf03fc8832b60c293aca77b1e6
GitHub-Last-Rev: 22f5d033fc29b94b4fea8c4b77f4cdcd2f66226c
GitHub-Pull-Request: golang/mobile#21
Reviewed-on: https://go-review.googlesource.com/135415
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-09-15 07:57:13 +00:00
Elias Naur
9bd09ef1cf cmd/gomobile: remove note about incomplete support on iOS
While the gomobile project itself is experimental, the iOS support
is just as "complete" as the Android ditto. Remove the special note
for iOS.

Change-Id: I624a29340ee453f3a54e6f8dc75203a03681df66
Reviewed-on: https://go-review.googlesource.com/135435
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-09-14 15:40:29 +00:00
Elias Naur
6d4b718bf3 app: make GoNativeActivity.getKey static
The input queue runs concurrent with the native activity lifecycle,
and so the getKey helper Java method might be called after the
app has been destroyed. This is particularly likely for "back"
key presses that destroys activities.

Change the getKey method to be static so that it can be called
outside the app lifecycle.

Run `go generate ./cmd/gomobile` to update the compiled dex file that
contains GoNativeActivity.

Fixes golang/go#27652

Change-Id: Id2c863ee07e5447f033e67d6948fbfe746916ffa
Reviewed-on: https://go-review.googlesource.com/135215
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-09-13 17:01:46 +00:00
Tadas
6c7f9eaa5c cmd/gomobile: specify clang++ compiler for C++ compilation, setup CGO_CXXFLAGS
Fixes #27508, #17343

Change-Id: I3e50ae781012a093254f7f8d6d719d89426f04a9
GitHub-Last-Rev: 7c3232d8eeb76cb79e8b0a232ccf80569c1e50de
GitHub-Pull-Request: golang/mobile#20
Reviewed-on: https://go-review.googlesource.com/134975
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-09-13 07:56:01 +00:00
Elias Naur
0ff817254b gl: add internalFormat to TexImage2D
The OpenGL C function glTexImage2D has the following signature:

void glTexImage2D(GLenum target,
 	GLint level,
 	GLint internalFormat,
 	GLsizei width,
 	GLsizei height,
 	GLint border,
 	GLenum format,
 	GLenum type,
 	const GLvoid * data);

However, the corresponding Context.TexImage2D method in package gl
does not include the internalFormat parameter, and use the format
argument instead. That's ok for many texture formats; for example,
RGBA textures have both format and internalFormat set to GL_RGBA.
But not always. In particular, OpenGL ES 3 allows the use of sRGB
encoded textures by specifying GL_SRGB8_ALPHA8 as internalFormat,
but keeping GL_RGBA as format.

Add the internalFormat to the Context package. This is unfortunately
a breaking change, but adding a new function ("glTexImage2D2"?) to
Context is too ugly for a parameter that should have been there all
along. (Adding a new method to the Context interface is technically
also a breaking change, but I don't expect that there are any
external implementers of the interface).

Change-Id: I12a45a34f604e51cb1be26aed906025ccfac533a
Reviewed-on: https://go-review.googlesource.com/133155
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-09-07 22:41:11 +00:00
Maarten Bezemer
fe88d27767 app: fix hang when application is closed
Events are Send() after the pump is being stopped (src is not read any more).
This blocks a critical go routine, resulting in the application not properly being stopped.

By continue reading the src channel during shutting down the pump, the block is removed and the application is able to stop.

Fixes golang/go#20256

Change-Id: I1536e8697cd4a0e504e7359e48acce04088e5760
Reviewed-on: https://go-review.googlesource.com/42811
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-08-29 07:49:04 +00:00
Elias Naur
bceb7ef27c app: fix cgo exported function signature
Fixes a build warning:

android.c:102:44: warning: incompatible pointer types assigning to 'void (*)(ANativeActivity *, int)' (aka 'void (*)(struct ANativeActivity *, int)') from 'void (ANativeActivity *, GoInt)' (aka 'void (struct ANativeActivity *, long long)') [-Wincompatible-pointer-types]

Change-Id: Ib70bcf8a8e32bb1885ec809d239199fccb1dc4fa
Reviewed-on: https://go-review.googlesource.com/128235
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-08-08 22:10:59 +00:00
Elias Naur
507816974b app: add RunOnJVM to allow Cgo access to the Android JVM and context
CL 122897 changed the visibility of the global JavaVM, JNIEnv and
android.context.Context variables to be internal to gomobile.
However, users of gomobile build programs used those internal
variables to access Java API through Cgo and JNI without Java code.

Make an exported version of mobileinit.RunOnJVM available. This is
quite possibly not the right API for this, but I don't have the
bandwidth to design a better solution. On the other hand, without
access to Java APIs, gomobile build programs are unfairly forced to
add Java code where before there were no need.

Fixes golang/go#26815

Change-Id: I655fb858ffff03a0d542aa9bf97eefc7a22dd5d0
Reviewed-on: https://go-review.googlesource.com/127758
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-08-06 14:06:43 +00:00
Elias Naur
371a4e8cb7 bind: use 0 instead of nil for the jclass zero value
Go 1.10 was supposed to change the jclass JNI type to map to Go
uintptr, but failed to map the Android NDK definition until
recently.

There was a single instance in the reverse binding generator that
compared jclass values to nil. Change it to use 0 and cast the
jclass value to uintptr to ensure compatibility with older Go
releases.

Change-Id: Ifa22ed2db556220b7dfd0076b004bd8930219e08
Reviewed-on: https://go-review.googlesource.com/124915
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-07-19 12:32:16 +00:00
Elias Naur
c7f1239863 asset: hoist global variable to Go and make C function static
Change-Id: I19d933bb49eba462371451ac3b258744c69b0aad
Reviewed-on: https://go-review.googlesource.com/124916
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-07-19 12:22:12 +00:00
Elias Naur
56e3592fa7 internal/mobileinit,app: declare C symbols static
The changes to internal/mobileinit fixes golang/go#26298; the
changes to the app package are only the easy pickings.

Fixes golang/go#26298

Change-Id: I1ac49c57e417b852cb5ab1bdcb18c73db8c4475a
Reviewed-on: https://go-review.googlesource.com/122897
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-10 17:43:32 +00:00
Elias Naur
6621de06e1 cmd/gomobile: fix gomobile build of non-main packages for iOS
Non-main packages are built in an earlier code path than main
packages. Add the ios build tag before that early code path to
ensure packages that expect that tag successfully compiles.

Fixes golang/go#25944

Change-Id: Ida15475109373127dde024037e9787c76b32ee0b
Reviewed-on: https://go-review.googlesource.com/119555
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-06-18 22:25:54 +00:00
Elias Naur
c37eee03d4 bind/objc: fix comment
The implemented Go interface is I2, not I.

Change-Id: I41c3ac8aeb0da535626c1634cef48ca7a0839580
Reviewed-on: https://go-review.googlesource.com/118619
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 14:23:41 +00:00
Elias Naur
5665cf3762 bind/java: bump android plugin version to 3.0.1
The examples were updated recently; this CL updates the version
used for the gomobile integration tests. The old version didn't
support newer versions of the gradle command.

Change-Id: I7ea9b3f9be37e9c96df96c5a81e90354da2ecd10
Reviewed-on: https://go-review.googlesource.com/114057
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-22 19:36:31 +00:00
Elias Naur
002e3c5c61 cmd/gobind: copy documentation to generated source
CL 99316 moved generation of bindings from the the gomobile command
to the gobind command. In the process, the ability to copy over
documentation from the Go source to the derived Java and ObjC was
lost. The relevant test didn't fail because it tests the generator
itself, not gobind.

Re-add support and add a gobind test for it.

Fixes golang/go#25473

Change-Id: I6eee3e79173f37d3e3e65eabc0bad59e4252da64
Reviewed-on: https://go-review.googlesource.com/114056
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-22 19:36:14 +00:00
Jean-André Santoni
269a7ef90d exp/audio/al: add windows support
Tested on Win64 with mingw-w64 and http://kcat.strangesoft.net/openal-binaries/openal-soft-1.18.2-bin.zip

Change-Id: Iec1bf3c0898310878133dc6d9ecfb8781b410347
GitHub-Last-Rev: a71e8eb2b9046b499e1a1911e55cc2534aff8e71
GitHub-Pull-Request: golang/mobile#18
Reviewed-on: https://go-review.googlesource.com/114003
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-05-22 19:29:39 +00:00
Elias Naur
9b0d538505 bind: copy documentation for interface methods to ObjC
Updates golang/go#25473

Change-Id: I63bf8dde15b0f108eabdc653b59039607b47a0aa
Reviewed-on: https://go-review.googlesource.com/114055
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-22 18:53:59 +00:00
Hana Kim
274da16109 misc/androidstudio: release 0.2.13
$ docker run --rm -u root -v "$PWD":/home/gradle/project \
   -w /home/gradle/project gradle:latest gradle publishPlugins

gradle version 4.7

Change-Id: I5c86fed85c0e9896a413011fd04ce600743b8f54
Reviewed-on: https://go-review.googlesource.com/112616
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-10 18:31:09 +00:00
Elias Naur
5a56f36813 misc/androidstudio: drop the clean task to fix Android Studio gradle sync
Suggestion from

https://github.com/golang/go/issues/23307#issuecomment-368162189

I've manually verified in Android Studio that removing the clean task
does fix the issue reported in golang/go#25290.

Fixes golang/go#25290.
Fixes golang/go#23307.

Change-Id: Ic1a8c240fc8e4c4aaf59977fd559dd221ff605b1
Reviewed-on: https://go-review.googlesource.com/112455
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-09 17:20:40 +00:00
Elias Naur
c909788f99 cmd/gobind: fix build of ObjC bindings with a custom prefix
Also add a test. The corresponding Java custom package option
already have one.

Fixes golang/go#24986

Change-Id: I095d97022beb0a57df784fe0a12bc42a66bb8a07
Reviewed-on: https://go-review.googlesource.com/110058
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-01 17:35:30 +00:00
Elias Naur
58fd324ce7 bind/objc: generate Xcode test files for iOS tests
Before, a set of Xcode project files were needed for each ObjC test.
With this change, new iOS tests can be added by simply adding an .m
source file.

Change-Id: Icefb00cfa1d98c5e3cd1ed073b0ec5234061e6c3
Reviewed-on: https://go-review.googlesource.com/110057
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-01 17:35:12 +00:00
Elias Naur
3fc6e854bd bind/objc: fix benchmark test
Running the benchmark is very slow so I don't do it often. As
could be expected, the benchmark driver didn't compile anymore.

Change-Id: I59475042b7fca63328a96d769e77b8a7a6bbbb06
Reviewed-on: https://go-review.googlesource.com/110056
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-05-01 17:34:32 +00:00
Elias Naur
721e99406c internal/mobileinit,bind/java,app: don't treat jobject as a pointer
On Android, the JNI jobject type doesn't always contain a pointer.
Treating a non-pointer as a pointer can crash the runtime. Use
the more appropriate type uintptr instead.

Change-Id: I2b2049918d60226c4d23d6df0b10e68248d54bc2
Reviewed-on: https://go-review.googlesource.com/110256
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-30 16:43:58 +00:00
Elias Naur
bf2d30a68a cmd/gomobile: disable DWARF in gomobile builds
DWARF doesn't work for buildmode exe binaries; see
golang.org/issues/25148.

Fixes golang/go#25148.

Change-Id: I511599f3d1963ff0b3e48ac5c8cce50ee6aa54de
Reviewed-on: https://go-review.googlesource.com/110059
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-29 17:04:17 +00:00
Hana (Hyang-Ah) Kim
60c2e06dc4 misc/androidstudio: publish 0.2.12
$ docker run --rm -u root -v "$PWD":/home/gradle/project \
   -w /home/gradle/project gradle:latest gradle publishPlugins

gradle version 4.7

Change-Id: Ib91807b88bf204122afa1296498492026894b153
Reviewed-on: https://go-review.googlesource.com/109435
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-26 14:24:15 +00:00
Elias Naur
e6f3196453 cmd/gomobile: use go list -f {{.Stale}} to determine staleness
With CL 107957, the appropriate way to check that the gomobile
binary is up to date is by using go list -f {{.Stale}}. Use that
instead of go install -x -n.

Fixes golang/go#24389

Change-Id: I93a4428b048f0be9463c61928673886445dce3ed
Reviewed-on: https://go-review.googlesource.com/108055
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Sun Shine <mizommz89@gmail.com>
2018-04-25 21:19:26 +00:00
Junda Liu
ada9ee7b29 misc/androidstudio/src: drop the -i flag to avoid writing to a read-only $GOROOT
Gradle plugin failed on Mac due to -i flag trying to update /usr/local/go
Since go 1.10, The old advice to add the -i flag for speed,
as in go build -i or go test -i, is no longer necessary:
builds run just as fast without -i.

Fixes golang/go#25076

Change-Id: Ibddab3ff5961e06c8558f2a83af8a6964d622f40
Reviewed-on: https://go-review.googlesource.com/109144
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-04-25 17:22:43 +00:00
Elias Naur
5d5d88d1b1 cmd/gomobile: add CGO_ENABLED=1 to gobind runs
A previous CL switched gobind to use the "source" importer so go
files using cgo can be type checked. However, CGO_ENABLED=1 also
have to be passed in for such files not be ignored.

Also add -tags ios to the gomobile test output missing from CL
99777.

Fixes golang/go#24941

Change-Id: I868469af3061b82ab592899e365a8a90a0333e58
Reviewed-on: https://go-review.googlesource.com/108336
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-20 08:11:07 +00:00
Elias Naur
9422505f13 gl: remove duplicate build tag
Change-Id: I7dcb0b3b946cfae86eb6eed509ad96543213c409
Reviewed-on: https://go-review.googlesource.com/108335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-19 21:32:52 +00:00
Elias Naur
7d79e14f04 cmd/gobind: make sure to set exit code on type checking errors
Change-Id: Iea30db321c53b37b41a2b18689c5f724938a1593
Reviewed-on: https://go-review.googlesource.com/108135
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-19 19:22:22 +00:00
Elias Naur
5bfa0d14b7 cmd/gomobile,cmd/gobind: allow per-platform bindings again
CL 99316 changed gobind to be platform independent, so
standalone bindings could be generated without having the
Android and Xcode SDKs installed. However, bindings that does
depend on GOOS for its exported API, in particular go source
files that use Cgo now only works if the exported API is
extracted to platform independent files.

By switching to use the source importer, importer.For("source", nil),
gobind can type check the bound packages even in the presence of
Cgo.

The source importer in Go 1.9 and 1.10 has problems with relative
imports and imports from testdata directories (issues 23092 and 24392),
but works from Go 1.10.1 on.

Fixes golang/go#24856

Change-Id: Icb18dce15325b7d4e58cabc1181051bc6269fc1f
Reviewed-on: https://go-review.googlesource.com/99777
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-17 15:00:54 +00:00
Elias Naur
60d29bfb46 bind: pin Go objects while incrementing their reference count
When passing a refnum across the language barrier there is a small
window where a proxy object itself can be garbage collected, its
reference count go to 0 and the object be gone when the refnum
is dereferenced on the other side.

In Go the proxy object is pinned with runtime.KeepAlive. This CL
implements the same mechanism in Java by passing the proxy object to
native code, ensuring the Java GC can't reclaim it during the call.

Change-Id: I23824439012eb00f90d729f59d4846999f24f01f
Reviewed-on: https://go-review.googlesource.com/107095
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-17 15:00:19 +00:00
Elias Naur
e7d878f9d0 bind: replace Java finalizers with PhantomReferences
Android runs a finalizer watchdog that tracks the running time of
finalizers and throws an exception if any runs too long. Our
finalizers do very little work and as such are not affected by the
timeout. However, there has been reports, for example:

https://stackoverflow.com/questions/24021609/how-to-handle-java-util-concurrent-timeoutexception-android-os-binderproxy-fin

that the watchdog does not take into account periods where the device
goes to sleep in the middle of a finalizer run. So if a given app runs
in the background, the Java GC starts a finalizer and the device goes
to sleep before it returns, an exception will crash the app if the sleep
period extends the watchdog timeout.

The problem might be fixed on some newer version of Android, but the
problem is reported for as late as Android 6.

The suggested workaround is to use PhantomReferences and run a
background thread that take dead references off a ReferenceQueue and
perform cleanup.

This CL builds on the previous CL and splits up the Ref class so Refs
only reference counts Java objects, while a new class GoRef tracks Go
references. The Go references are wrapped in PhantomReferences that in
turn appear on a GoRefQueue to be cleaned up by a background (daemon)
Thread.

Change-Id: I04e3296b851999c612d3baf6a593cc044c2c5bdd
Reviewed-on: https://go-review.googlesource.com/106876
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-17 15:00:01 +00:00
Elias Naur
5b452fe89a bind: split out Seq.getRef calls with Go references
Today, the Seq.Ref class has two purposes. For Java references,
Ref contains the refnum, a reference to the Java object and a
reference count. For Go references, Ref contains the refnum and
its finalizer makes sure to decrement the reference count on the Go
side.

The next CL will replace the use of finalizers with an explicit
ReferenceQueue of Go references, and the Ref class will no longer
be used for Go refences. To prepare for that, this CL pulls up the
construction of Go referencing Ref instances into the Seq.trackGoRef
function.

Change-Id: I9eefe238cd3fd1b661b2af11d331a2f61e31303b
Reviewed-on: https://go-review.googlesource.com/106875
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-17 14:58:00 +00:00
Elias Naur
1f177cbe4d bind: ignore unsupported basic types
Before this change, binding unsupported basic types such as
uint failed with an error. Instead, add them to the list of
ignored types so that no error is generated and a comment is
generated explaining why the offending function, constant or
variable was skipped.

Unsigned integers are probably easy to support in ObjC, but
leave them unsupported for now.

While here, improve the printing of the ignored types in the
explaining comments.

Fixes golang/go#24762

Change-Id: I0d9ab471b2245728270f6ee588f554d4a105d500
Reviewed-on: https://go-review.googlesource.com/105377
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
2018-04-10 16:30:43 +00:00
Elias Naur
90139f6bae cmd/gomobile: don't run gobind with the ios tag
Bindings are independent of any particular GOOS/GOARCH pair and
as such the gomobile bind command doesn't set GOOS nor GOARCH when
running gobind. However, the ios tag was still added to the list
of tags to pass to gobind for -target=ios.

Move the ios tag to when actually building the bound packages,
mirroring gomobile build.

Add TestBindIOS and update TestBindAndroid.

Updates golang/go#24644

Change-Id: I007829c26036427a3376bba11a1ccb86e7338848
Reviewed-on: https://go-review.googlesource.com/104458
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-05 18:31:59 +00:00
Elias Naur
29776d85b2 app: support importing the package for bind programs
Delay loading of the getRune method ID to the first GoNativeActivity
is created. That way, importing golang.org/x/mobile/app will not
crash, even for gomobile bind programs that don't include (or use)
GoNativeActivity.

Fixes golang/go#24490

Change-Id: I4bf90e067700451f7c026e53165b6614366d7a94
Reviewed-on: https://go-review.googlesource.com/104395
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-05 18:30:20 +00:00
Elias Naur
3a7f1138ab app,exp/gl/glutil: add missing build directives
For some reason, the changes to the build tags that was supposed to
go in with CL 102915 didn't make it.

Fixes golang/go#24644

Change-Id: I106b3c71fef1088dd1eea193323c13d81e5985fa
Reviewed-on: https://go-review.googlesource.com/104355
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-03 15:03:16 +00:00
Elias Naur
19987bc3dc cmd/gomobile: fix tests
Forgot to update tests on macOS after CL 102915.

Change-Id: I902fd1046434d133129a0cd82bc28c3f7ee47816
Reviewed-on: https://go-review.googlesource.com/104455
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-03 15:02:56 +00:00
Elias Naur
54bca60619 app,cmd/gomobile,exp/gl/glutil: support target architectures for iOS build and bind
While we're here, add 386 to the list of supported architectures
on iOS.

To support gomobile build for amd64 and 386, use the "ios" tag to
distinguish between iOS and macOS builds.

Change-Id: Ie09a432794bd8d9853950115349f8d3b57cf43f5
Reviewed-on: https://go-review.googlesource.com/102915
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-28 15:26:55 +00:00
Elias Naur
4e3d9b7944 cmd/gomobile: add missing checks for the NDK and Xcode
Fixes golang/go#24571

Change-Id: I8d08548b4a4d6f9490a8bfd80c80a6408fde089b
Reviewed-on: https://go-review.googlesource.com/102896
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-28 14:47:19 +00:00
Hajime Hoshi
ae1772d3eb x/mobile/cmd/gomobile: allow digits-only basename for Android package name
Now package names for Android is generated based on the given package
path's base name, And the package name generation fails when the base
name consists of only digits (e.g. github.com/hajimehoshi/ebiten/examples/2048).

This CL fixes this problem by allowing only-number base name.

Fixes #24511

Change-Id: I6108c46823d0b2ee08869b306922f62351fb1510
Reviewed-on: https://go-review.googlesource.com/102576
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-27 03:16:25 +00:00
Elias Naur
2a86fdcad0 cmd/gomobile: don't ignore -openal if no NDK was found
Updates golang/go#20902

Change-Id: I523c0b7a205e620c143f2ba9c7cdbe30865a9c59
Reviewed-on: https://go-review.googlesource.com/101136
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-26 17:12:34 +00:00
Elias Naur
5d852261b1 cmd/gobind,cmd/gomobile: support the default GOPATH
Instead of using os.Getenv("GOPATH"), use go env GOPATH to determine
the effective GOPATH.

Fixes golang/go#21658

Change-Id: I03f897969e30fc3256d171aa7b32c101a9342a1a
Reviewed-on: https://go-review.googlesource.com/101117
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-26 17:12:27 +00:00
Elias Naur
b07e525bd7 cmd/gomobile: make sure gobind is installed and updated
When running gomobile bind, make sure gobind exists. If not, instruct
the user to run gomobile init which will go install gobind.

Change-Id: I2d064ba58874fd5581c17417124561f3d1fb6b83
Reviewed-on: https://go-review.googlesource.com/101055
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-26 17:12:18 +00:00
Elias Naur
6b7c05d452 cmd/gomobile: use standalone NDK toolchains
Issue golang/go#24058 demonstrates a Go package that fails to build with
gomobile but builds successfully with a manually using the standalone NDK
toolchain. I haven't been able to figure out a set of CPPFLAGS/LDFLAGS
that fixes the build for 24058 so instead rework gomobile to use
standalone NDK toolchains.

Standalone toolchains fixes the 24058 build and is the official way
to build Android programs. So gomobile should be less affected by
future changes in the NDK toolchain internals.

Create the standalone toolchains with gomobile init.

With the new Go 1.10 build cache, the prebuild work by the gomobile
init command is useless. Use the opportunity to simplify init to
only creating NDK toolchains and, optionally, building OpenAL for
Android. With that, it is no longer necessary to use gomobile init
to build iOS apps and frameworks.

Fixes golang/go#24058

Change-Id: I4692fcaa927e7076a6387d080ebc1726905afd72
Reviewed-on: https://go-review.googlesource.com/99875
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-26 17:11:49 +00:00
pankona
598bfe4b20 cmd/gomobile: support vendored "golang.org/x/mobile/..." packages
gomobile checks "golang.org/x/mobile/..." packages are included in
the build product using nm.
If "golang/x/mobile/..." package is placed under vendor directory,
this check fails and it is treated as a build failure.

Fixes golang/go#22152

Change-Id: Ie0e05c3e0340b3608de5c68bb3f852d4ef7cdeb1
Reviewed-on: https://go-review.googlesource.com/102095
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2018-03-23 11:57:23 +00:00
Elias Naur
57eb1e2f00 bind/benchmark: move package to testdata
Move the benchmark support package to the testdata directory, just
like the other test packages.

Change-Id: Idc35ca973a7da78e8c8bb640ba60cfb947fbed5b
Reviewed-on: https://go-review.googlesource.com/101896
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-21 18:16:30 +00:00