Commit Graph

184 Commits

Author SHA1 Message Date
Andrew Gerrand eb4d72e07d doc: add CONTRIBUTING.md
Change-Id: If7e45a437e94772347fc3aca51bd540c9f4e7c29
Reviewed-on: https://go-review.googlesource.com/5220
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-18 23:42:31 +00:00
David Crawshaw a52f1ea922 cmd/gomobile: init subcommand tests
Compare the output of gomobile init -x -n with what's expected.

Change-Id: Ib797c900b0a4cf1573395f8ffeb9a662a0fd6154
Reviewed-on: https://go-review.googlesource.com/5080
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-18 15:07:23 +00:00
Hyang-Ah (Hana) Kim eada1f182c cmd/gomobile: init skips ndk download if usable toolchain exists.
This feature is necessary when the cross compilers need to be rebuilt
because the goroot has been updated but the ndk version has not changed, or
when rebuilding is required but there is no network.

Currently the test for usable ndk compilers is simply checking
the presence of a file that's created after the ndk tool chain is installed
in the $GOPATH/pkg/gomobile/androind-<ndkversion> directory.

The -u option forces update of the ndk tool chain regardless.

Change-Id: I3d4f62266d436ddc52d158877f08481f92a6a690
Reviewed-on: https://go-review.googlesource.com/5140
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-18 14:13:01 +00:00
David Crawshaw 64689dc2a5 cmd/gomobile: isolate cross-compiler toolchains
Each cross compiler needs tools that are stored under
GOROOT/pkg/tool/GOHOSTOS_GOHOSTARCH: 5g, 5l, etc. This means a
single GOROOT is incompatible with multiple cross compilers for
different GOOS targets that share a GOARCH. In particular, it
means android/arm and darwin/arm cannot co-exist.

To avoid conflicting paths, this CL installs the cross-compiler
tools under GOPATH/pkg/gomobile. The Go tool is instructed to
use them using the new -toolexec flag. This means far less
meddling in the user's GOROOT.

Unfortunately, the standard library .a files (and textflag.h/funcdata.h)
must still be installed under GOROOT/pkg/GOOS_GOARCH. However this path
does not conflict across cross compiler toolchains, nor with the host
toolchain.

Change-Id: I088142281cf441365072c77f4cb73683b5ffd0ce
Reviewed-on: https://go-review.googlesource.com/5040
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-17 15:56:40 +00:00
Hyang-Ah (Hana) Kim 7e60a8610f cmd/gomobile: fix subcommand help message handling.
1) add subcommand in the usage printout.
2) exit after printing out usage during flag parsing.

Change-Id: I57da849eca3c297f67437bdee1d36e5d340c2a58
Reviewed-on: https://go-review.googlesource.com/4836
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-13 21:31:32 +00:00
Hyang-Ah (Hana) Kim 968871a5be cmd/gomobile: bind command for running gobind and building the libraries.
Change-Id: Ic4bf580b9c3f9757611ec7644eaf998d60f0fafc
Reviewed-on: https://go-review.googlesource.com/4833
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-13 19:51:16 +00:00
David Crawshaw 8b708def2f cmd/gomobile: use stripped NDK tarballs
Change-Id: Iaaf72a06cc64e50e62c9282c95ab28317e4c915a
Reviewed-on: https://go-review.googlesource.com/4740
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-13 18:13:24 +00:00
David Crawshaw a7f95e2b5c cmd/gomobile: script to build binary releases
Change-Id: Ia325048a565ece9f606363869fb4e27e04c7513a
Reviewed-on: https://go-review.googlesource.com/4741
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-13 13:46:42 +00:00
David Crawshaw 1a5645cad8 cmd/gomobile: add -n and -x flags
Besides being useful for debugging, I intend to use these in a
followup CL to write some simple tests.

Change-Id: I9420c0b72111bcc86ce0330886106221aab533ba
Reviewed-on: https://go-review.googlesource.com/4690
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-12 18:32:36 +00:00
Burcu Dogan 7e40b31538 mobile/audio: add a basic audio player
Fixes #9551.

Change-Id: I83311afc2d2fd67a883c70d83c6a498d9e033f2c
Reviewed-on: https://go-review.googlesource.com/3262
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-12 17:24:23 +00:00
Hyang-Ah (Hana) Kim 5fdd6687da cmd/gomobile: provide the package name to the go build command.
Change-Id: I9aeb74f24bb19454ee7a7b861690857e9c562c08
Reviewed-on: https://go-review.googlesource.com/4610
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-11 23:37:20 +00:00
Hyang-Ah (Hana) Kim 593197c0b6 cmd/gomobile: fix broken test.
debugCert is now defined in build.go.

Change-Id: Iaa3d2257cb48378991ae03c99d0c71d8506281c2
Reviewed-on: https://go-review.googlesource.com/4600
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-11 21:41:52 +00:00
David Crawshaw 6180a253ca cmd/gomobile: flag cleanups, plumb -i and -tags
Change-Id: I8c74a3fd52e0978349061c53dd3305174ea441ee
Reviewed-on: https://go-review.googlesource.com/4580
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-11 20:59:54 +00:00
Hyang-Ah (Hana) Kim 2d18129a02 cmd/gomobile: handle GOPATH with multiple directories.
init command uses the first path in the GOPATH path list.
build command searches all path elements until it finds the one
with the compiler tool chain.

Change-Id: Ia2914243965a5ef56546ff6e75af22f49457d07d
Reviewed-on: https://go-review.googlesource.com/4560
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-11 20:54:55 +00:00
David Crawshaw 5fef7f5727 cmd/gomobile: subcommand flag support
Several standard Go tool flags are not supported yet, those will
come in followup CLs.

Change-Id: I1d98afccf3063d7a3313f66b9fd57067fcfa5297
Reviewed-on: https://go-review.googlesource.com/4450
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-11 18:17:12 +00:00
David Crawshaw 7599d72f11 cmd/gomobile: add install subcommand
Change-Id: I52dcc241e340813ff2cc575c42d92c59bef91ce1
Reviewed-on: https://go-review.googlesource.com/4410
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-11 17:28:14 +00:00
Hyang-Ah (Hana) Kim 2af6cc3a6e cmd/gobind: add -outdir flag. Delete -output flag.
For some target languages, gobind will need to output multiple files.
(e.g. objective-c) -output flag is not compatible with such cases.

Change-Id: I6da6109ae75c3aaa7d7379d411df2bb14c88bbc2
Reviewed-on: https://go-review.googlesource.com/4120
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-10 23:55:20 +00:00
David Crawshaw 8602f76ecd Revert "app: repalce JavaInit with RegisterAndroidInit"
Not thought through. For gobind-based apps, JNI_OnLoad is called and there is never any NativeActivity.

This reverts commit b781b80ee8.

Change-Id: Ib076f30d144cbacb7926d54981ac86bbb8a5a4ff
Reviewed-on: https://go-review.googlesource.com/4440
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-10 19:28:17 +00:00
David Crawshaw b781b80ee8 app: repalce JavaInit with RegisterAndroidInit
I am working on a virtual keyboard package that needs access to the
*ANativeActivity. As the *ANativeActivity contains *JavaVM, this CL
deprecates JavaInit. I'll remove it in a subsequent CL that updates
gobind to use RegisterAndroidInit.

Change-Id: Ib1d60bbaac5de4583b368c93ab90b764c6081291
Reviewed-on: https://go-review.googlesource.com/4400
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-10 18:52:00 +00:00
David Crawshaw c55730db15 cmd/gomobile: add build subcommand
Change-Id: I879e51834726c8713c5befeb4be2e328d5295af4
Reviewed-on: https://go-review.googlesource.com/4110
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-09 12:49:49 +00:00
Shenghou Ma c44ea393d0 cmd/gomobile: remove temporary files used in tests
Change-Id: I792edeed6bf8309084281eebcdba7d4b6c6a0818
Reviewed-on: https://go-review.googlesource.com/4181
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-08 22:37:23 +00:00
David Crawshaw d0e75fc927 cmd/gomobile: add init subcommand
Running gomobile init downloads the appropriate Android NDK
compiler toolchain and builds a Go cross compiler.

Details: https://docs.google.com/document/d/1cePOQ35PNEb_QqxnPAmBv0cEnAm7AQSGuz9wVeJ-lBs/edit?usp=sharing

Change-Id: I279f6ff0753f8776ae7d98f33a85ee4d0bbf5390
Reviewed-on: https://go-review.googlesource.com/3971
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-06 23:24:46 +00:00
Michael Matloob 4c31c789d7 gl: fix func name in doc comment for GetRenderbufferParameteri
Also s/bufer/buffer/ in comment for VertexAttribPointer.

Change-Id: Icb2ce35e4fed91939ebd00012e5caf88453fcbbf
Reviewed-on: https://go-review.googlesource.com/3959
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 09:33:13 +00:00
Burcu Dogan c67709898b mobile/audio: adding OpenAL bindings
The bindings are not working on Android currently. We may require
the users to build their own OpenAL library that is targetting
Android or may distribute a shared object.

Change-Id: Ibcfa3482aa53e9b3ec9bfddf5dd1622ad07b7b7e
Reviewed-on: https://go-review.googlesource.com/3115
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-04 14:48:47 +00:00
Hyang-Ah Hana Kim 40f92f7d9f mobile: add go 1.4 for bootstrap & pin the revision of Go.
Use revision 34bc85f6f3b02ebcd490b40f4d32907ff2e69af3.

Change-Id: I63293b7155883ce8f89942ed05842697a33fffde
Reviewed-on: https://go-review.googlesource.com/3146
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-23 16:07:06 +00:00
David Crawshaw 2695ecabb5 cmd/gomobile: APK writer
Files go in, a .apk file comes out. Effective testing depends
on the aapt tool being installed.

Change-Id: I10daaabe9090c10181d9a83b876a934d540023d3
Reviewed-on: https://go-review.googlesource.com/3049
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-21 18:02:26 +00:00
Hyang-Ah Hana Kim 90d6854261 mobile: add extra build tags.
missing ones from https://go-review.googlesource.com/#/c/2902/

Change-Id: If42f9e53bdd7be468315ad746ba35d397a874ee6
Reviewed-on: https://go-review.googlesource.com/2965
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-20 15:15:48 +00:00
David Crawshaw 8cbd6a23e3 cmd/gomobile: PKCS#7 signing
Does the equivalent of jarsigner for APKs.

Change-Id: Ie55ddb22ef9f56062034b091c9477fd9e9196310
Reviewed-on: https://go-review.googlesource.com/2904
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-20 11:00:55 +00:00
Burcu Dogan 098109e687 mobile: use the fully qualified Docker image name
Change-Id: Id9875cd07d18f6ca96ac64fd0b4537d69457d72c
Reviewed-on: https://go-review.googlesource.com/2922
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-16 17:55:11 +00:00
Hyang-Ah Hana Kim a8fcf739b9 mobile: limit app/font/gl packages to linux/darwin.
They don't make sense for other platforms yet.

See golang/go#9603

Change-Id: I2ed269a00b1e1961aadf0a47fc95bbe3cd230113
Reviewed-on: https://go-review.googlesource.com/2902
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-15 20:16:28 +00:00
David Crawshaw bf371f421b cmd/gomobile: android binary XML encoder
Change-Id: Ibbdd19990ecb64535baa55f81bbe7f2abcf118fd
Reviewed-on: https://go-review.googlesource.com/2653
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-15 15:08:49 +00:00
Hyang-Ah (Hana) Kim 71e2276663 bind/java: pin java byte array elements until Seq send is done.
When passing a byte array from Java to Go, Seq.writeByteArray JNI
call encodes only the array size and the pointer to the array.
Go-side receives the (size, ptr) pair info during the subsequent
Seq.send JNI call, and copies the elements into a Go byte slice.
We must pin the array elements until Go-side completes copying
so that they are not moved or collected by Java runtime.

This change keeps track of the pinned array info in a 'pinned' linked
list, and unpin them as the Seq memory is freed.  The jbyteArray
argument passed to Seq.writeByteArray is needed to release the pinned
byte array elements, but that is a "local reference". It is not
guaranteed that the reference is valid after the method returns. Thus,
we stash its global reference in the 'pinned' list and delete it later
as well.

A similar problem can occur on the byte slice returned from a Go function.
This change does not address the case yet.

Fixes golang/go#9486

Change-Id: I1255aefbc80b21ccbe9b2bf37699faaf0c5f0bae
Reviewed-on: https://go-review.googlesource.com/2586
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-14 19:06:28 +00:00
Hyang-Ah (Hana) Kim d97f4d82bd mobile: docker run should require a $GOPATH/src volume mount.
If the volume is not accessible or -v option is not given,
docker run golang/mobile will fail with an error like:

finalize namespace chdir to /src/golang.org/x/mobile no such file or directory2015/01/13 20:14:19 Error response from daemon: Cannot start container dfe1dbc2bac3ea939e154eee13d20ecae4c473a595dbc1e6a0e5cf0be3963909: finalize namespace chdir to /src/golang.org/x/mobile no such file or directory

Change-Id: I4d56c044e9c7682e63da7170a546522230237b18
Reviewed-on: https://go-review.googlesource.com/2780
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-01-14 18:59:42 +00:00
David Crawshaw cf241b7ad2 mobile/cmd/gomobile: initial empty main function
Change-Id: Ieac721b486155679f3de2baa13c69d50d63dce3b
Reviewed-on: https://go-review.googlesource.com/2652
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-12 15:56:55 +00:00
David Crawshaw a5177c8172 mobile/font: access to system fonts
This initially supports reading two common system fonts. At some point
there should be a more general Open function, but first I need to work
out how to to turn font names into android file names.

Fixes golang/go#9419.

Change-Id: I8321df873315a5222c39dccf961f742f2e2a7a4c
Reviewed-on: https://go-review.googlesource.com/2059
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-01-10 22:16:05 +00:00
Hyang-Ah Hana Kim 2b3c96656c cmd/gobind: implement interface method binding.
This change makes gobind to generate proper Go-side proxy code to
handle interface methods that have parameters and return values.

It allows gobind to accept struct pointer types as parameters
or a return value of a method.

Fixes golang/go#9487, golang/go#9488.

Change-Id: Id243c42ee0701d40e3871e392140368c2f8f9bc6
Reviewed-on: https://go-review.googlesource.com/2348
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 18:26:42 +00:00
Hyang-Ah Hana Kim 8f449fffd2 bind/java/testpkg: use go generate to run gobind on testpkg.
Change-Id: I2426f3607120b7ce2da60bcb45d834b539d7dbb9
Reviewed-on: https://go-review.googlesource.com/2342
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 17:28:35 +00:00
Hyang-Ah Hana Kim 2be77e4ffc cmd/gobind: take -output option for output file.
Change-Id: Ie91223592474938cbfb9d7e4abe85867acdf69db
Reviewed-on: https://go-review.googlesource.com/2380
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-07 16:33:56 +00:00
Shenghou Ma bd50534d55 bind: remove temporary files used in tests
Fixes golang/go#9513

Change-Id: I19a14f6e8f24396e5a191258917e5ff9caf8928a
Reviewed-on: https://go-review.googlesource.com/2343
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-06 06:13:23 +00:00
Burcu Dogan 1e525d6eb2 mobile: cache debug.keystore to avoid adb install certificate errors
Otherwise, successive adb installs will require the existing apk to be
removed. If no android.keystore is generated during docker build, one
will be generated by the NDK toolchain during docker run.
It will end up the applications are being signed with different
certificates on each docker run.

Fixes #9498.

Change-Id: Ibac202b828224287ec6fdc3eaff659de5fce61c3
Reviewed-on: https://go-review.googlesource.com/2266
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-01-03 21:35:02 +00:00
Burcu Dogan 3d879bb1b3 mobile: modify instructions to pull the Docker image from the hub
Image is published at https://registry.hub.docker.com/u/golang/mobile/.

Fixes #9270

Change-Id: Ib5730a5f571bf42c53f223a6543219db3e34871d
Reviewed-on: https://go-review.googlesource.com/2158
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-30 04:05:25 +00:00
Alex Brainman 237eb3c606 mobile: copying .gitattributes to all subrepositories
Fixes #9281

Change-Id: I93741f5955afc4c3d0a519d9b441cd5add126182
Reviewed-on: https://go-review.googlesource.com/2079
Reviewed-by: Minux Ma <minux@golang.org>
2014-12-23 23:23:25 +00:00
Daniel Ortiz Pereira da Silva 696db895ff example/sprite: make example lives
Add necessary files to build and run example/sprite.
Change main.go to get image from assets.

Change-Id: Ic3065aab97f59c34f2c0446ab4b46840305b5864
Reviewed-on: https://go-review.googlesource.com/1882
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-22 13:10:48 +00:00
Daniel Ortiz Pereira da Silva 9c997eaee4 example: add windows batch files
Add windows batch files to build and run examples

Change-Id: I9102ceb5c47f692730a8b024648b1d10ff49b624
Reviewed-on: https://go-review.googlesource.com/1622
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-22 13:10:26 +00:00
Pierre Roullon 3bb5e71983 app: Remove 'from' duplication on Run doc
Change-Id: I97855989e32a09d0b0c3309579aa7965d3c72129
Reviewed-on: https://go-review.googlesource.com/1896
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-21 21:03:24 +00:00
Gordon Klaus f8e3bd5ba6 mobile: Deliver all touch events.
Android delivers events in a batch.  Previously, only the first event of the batch was passed to the Go callback, resulting in many events (typically corresponding to non-primary touches) being dropped.

Change-Id: I4b01bb6c4d1c88dec6c8fa379875043dfc0e9986
Reviewed-on: https://go-review.googlesource.com/1894
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-21 16:17:07 +00:00
David Crawshaw 93ef3562fa app: call Start on darwin
Still working on how/when to call Stop.

Change-Id: Ice56c4c71ba351765657bb86dc01649c8238859e
Reviewed-on: https://go-review.googlesource.com/1885
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-19 20:39:27 +00:00
Hyang-Ah Hana Kim b2e453e1cd bind/java: support byte arrays.
Fixes golang/go#9338.

Change-Id: I6e2af67cdf7f923963fa525b944613a91aac994e
Reviewed-on: https://go-review.googlesource.com/1884
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-19 20:07:11 +00:00
David Crawshaw 1aa04cf038 app: Start and Stop callbacks
Change-Id: If8ea6aaf2fb2c62eaf4119526a8bb46b8a84b982
Reviewed-on: https://go-review.googlesource.com/1881
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-19 19:01:54 +00:00
Hana (Hyang-Ah) Kim 8952e43db8 build/androidtest.bash: script to run all tests in a repository on an
android device.

It assumes it runs in golang.org/x/mobile repository.

This script copies the repository source tree into the connected device
and invokes go test that runs using the binary compiled from
go_android_exec.go. go_android_exec arranges to push and run the test
binary to the right place in the android device.

Change-Id: I4ac24bcfd8e26e01cccd3d7c2dddaf6b3c14951e
Reviewed-on: https://go-review.googlesource.com/1680
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-18 00:48:16 +00:00