cmd/gomobile: reorganize build logic

The goal here is to remove several inconsistencies between
-target=android and -target=ios support, along with making the flow
of the command follow the path you might expect given a certain set
of flags, and preparing for `gomobile bind` support of ios. In
particular, building non-main packages now works with both targets
and the initialization of global build state is clearer.

The reorg also is designed around an nm trick I thought of
yesterday to do better package import scanning without a slow
all-file scan. This will give better detection of x/mobile/app and
x/mobile/exp/audio/al packages. There's a TODO about it, and I'll do
it in a future CL.

Tested with:

	go test golang.org/x/mobile/cmd/gomobile
	gomobile init
	gomobile bind golang.org/x/mobile/asset
	go test golang.org/x/mobile/bind/java
	gomobile build -target=ios golang.org/x/mobile/example/basic
	gomobile build -target=ios golang.org/x/mobile/gl
	gomobile build -target=android golang.org/x/mobile/gl
	gomobile build -target=android golang.org/x/mobile/example/basic
	(Along with manual testing of basic on an android device.)

That might make a pretty good _test.go.

Change-Id: I41230008c3c15db25a11c33b9eaca4abada9f411
Reviewed-on: https://go-review.googlesource.com/12051
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 files changed
tree: 9e2c327b680b836a133f829ad2e80ffd3c005a3c
  1. app/
  2. asset/
  3. bind/
  4. cmd/
  5. event/
  6. example/
  7. exp/
  8. geom/
  9. gl/
  10. internal/
  11. testdata/
  12. .gitattributes
  13. .gitignore
  14. AUTHORS
  15. codereview.cfg
  16. CONTRIBUTING.md
  17. CONTRIBUTORS
  18. Dockerfile
  19. LICENSE
  20. PATENTS
  21. README.md
README.md

Go support for Mobile devices

The Go mobile repository holds packages and build tools for using Go on Android.

This is early work and installing the build system requires Go 1.5. Follow the build instructions on godoc.org/golang.org/x/mobile/cmd/gomobile to install the gomobile command and build the basic example.


APIs are currently very limited, but under active development. Package documentation serves as a starting point:


Contributions to Go are appreciated. See https://golang.org/doc/contribute.html.