Commit Graph

31 Commits

Author SHA1 Message Date
David Crawshaw 743b9bfd9a cmd/gomobile: simplify init
The Go toolchain used to require that we rebuild the compiler and
friends (the cgo command) when building a cgo-enabled cross compiler.
This meant that gomobile init used to invoke make.bash in a temporary
copy of the GOROOT. This works, but brings with it several
complications, including needing to use -toolexec when invoking the
go tool, finding a boostrap copy of Go 1.4, long initialization
times, and a variety of unusual failure modes.

Fortunately we don't need our own compiler any more. All that's
necessary is building the standard library for the cross-compilation
targets and making sure the right C compiler is used when calling
go build (as it always was). This means most of the initialization
process can be replaced with a carefully invoked 'go install std'.

While here, remove the source install instructions (most of it is
documented already, and the final step, choosing the right git
revision should be within the skills of anyone using pre-release
software.) Some other documentation is changing because it's been a
while since go generate was run.

Change-Id: I88c10fef87867536e83c7df063ae7241b2e9eea4
Reviewed-on: https://go-review.googlesource.com/11711
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 20:40:46 +00:00
Burcu Dogan 8fff803af0 mobile/cmd/gomobile: install darwin/arm and darwin/arm64 compilers
Change-Id: I16fe8db9ac9e22c7ba9c821b4d8bf858ab28f5f8
Reviewed-on: https://go-review.googlesource.com/11237
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-20 18:09:14 +00:00
David Crawshaw 10a37afdaf cmd/gomobile: add -target flag
Also add a very simple test for gomobile build, some
documentation cleanup, and the -o flag for bind.

Change-Id: I719b92010ba2a5813049827c99502828788611ef
Reviewed-on: https://go-review.googlesource.com/11253
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-19 17:31:29 +00:00
Burcu Dogan 6490f64aef mobile/cmd/gomobile: build darwin/arm and darwin/arm64 cross compilers
Change-Id: If79c591ba81319947cd4073bacf009d3a5a7bf4a
Reviewed-on: https://go-review.googlesource.com/11265
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 17:22:34 +00:00
David Crawshaw 31aaa72f51 cmd/gomobile: add x86
Change-Id: I080182bf6d32c18e9713eefcf67930b44ee3b83b
Reviewed-on: https://go-review.googlesource.com/10914
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-11 17:07:53 +00:00
David Crawshaw 6c1c490379 cmd/gomobile: set tmpdir when calling cmd/dist
Fixes #10928

Change-Id: I7c842c9f0e812a31d0fe84fd6a2ea5f1259cb125
Reviewed-on: https://go-review.googlesource.com/10401
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 21:03:30 +00:00
David Crawshaw 8f15a83bc0 cmd/gomobile: do not run make.bash with user env
The user may have set GOBIN, in which case the existing go command is
overwritten. I cannot think of any relevant environment variables the
user would set, so the easiest thing is not to use them at all.

While here, fix the unit test I broke in cl/10319.

Change-Id: I8cef353b5a0e4aabae97169ff553b53f7973ff8b
Reviewed-on: https://go-review.googlesource.com/10397
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-28 17:26:45 +00:00
David Crawshaw c95aae96ba cmd/gomobile: update init with new compiler name
Change-Id: Id01a628ca4cb70a936a0aa19b9ffc037f92c933d
Reviewed-on: https://go-review.googlesource.com/10319
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-22 09:04:17 +00:00
David Crawshaw ddd3a9e786 cmd/gomobile: check version with working cmd/dist
Fixes golang/go#10760 maybe, I have been unable to reproduce it.

Change-Id: Iaeec631f5a6be29b312969df12f6bd6b95bc2aa1
Reviewed-on: https://go-review.googlesource.com/9880
Reviewed-by: Burcu Dogan <jbd@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-08 19:08:54 +00:00
David Crawshaw a7a3501c10 cmd/gomobile: simpler download caching
Instead of trying to preserve the unpacked NDK, this stores the
downloaded archives in GOPATH/pkg/gomobile/dl and completely
rebuilds on reinitialization.

Also introduce checking that the version of Go we are using to do
the build matches the GOROOT we are building from.

Fixes golang/go#10187

Change-Id: I4a861718d8a413855917a5b1f1073e2cd84c9bb1
Reviewed-on: https://go-review.googlesource.com/9685
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-07 17:19:57 +00:00
Hyang-Ah (Hana) Kim 1ab6893162 cmd/gomobile: fix init_test.go to pass on windows/darwin.
Change-Id: I03a18267ddd35ce432a394732185dab0283f2da6
Reviewed-on: https://go-review.googlesource.com/9170
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-20 21:32:12 +00:00
Hyang-Ah Hana Kim f0c91fa51b cmd/gomobile: copy old5a to the tool chain.
The app/internal/callfn package requires old5a.

Change-Id: Id0e084dc5c1dd1275d0043412ab9ea0423e7651d
Reviewed-on: https://go-review.googlesource.com/9034
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-17 19:43:10 +00:00
David Crawshaw 502bceb448 cmd/gomobile: generate package documentation
Change-Id: I2a41cf0f16dcefe87c73ab0a8f02a251c1243157
Reviewed-on: https://go-review.googlesource.com/8121
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-26 19:42:25 +00:00
Hyang-Ah (Hana) Kim f1ef55e1be cmd/gobind: simplify filepath.Join uses.
filepath.Join returns a Cleaned path that went through FromSlash.

Change-Id: I23afeea32453c3eb271d4e4bf47147940061c20f
Reviewed-on: https://go-review.googlesource.com/7161
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-09 16:35:40 +00:00
Burcu Dogan 269086b6fe cmd/gomobile/init: download the prebuilt OpenAL library
Change-Id: I21ec4bbcce7f1821c5172522fc87c033c1277d35
Reviewed-on: https://go-review.googlesource.com/6860
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-06 02:07:52 +00:00
Burcu Dogan 4940f61621 cmd/gomobile/init: report non-200 HTTP responses
Change-Id: I415a6c4693be340ff8236d5f56c3c00fa95ce2e0
Reviewed-on: https://go-review.googlesource.com/6822
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-04 23:08:40 +00:00
Hyang-Ah (Hana) Kim 79fcbd2571 cmd/gomobile: use the stripped NDK for Windows client.
Also moved the full ndk fetch into a separate function.

Change-Id: Ib5c4687e98a5d92ff3aa3ca99ec0ebee85d31f86
Reviewed-on: https://go-review.googlesource.com/6662
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-03 20:24:38 +00:00
Hyang-Ah Hana Kim 388f1b8302 cmd/gomobile: inherit env vars when running build subprocesses.
Change-Id: I687ce7f0730d4081d0c53d1eb2aa8bb99ff0f957
Reviewed-on: https://go-review.googlesource.com/6510
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-02 22:50:00 +00:00
Hyang-Ah Hana Kim 614540a6db cmd/gomobile: 5a is gone.
See https://go-review.googlesource.com/6366

fixes golang/go#10056

Change-Id: If518d69398df0393feadf6b5d8c56da89a201090
Reviewed-on: https://go-review.googlesource.com/6482
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-02 20:30:11 +00:00
Hyang-Ah (Hana) Kim 496a9d6d05 cmd/gomobile: Windows support for 'init' command.
Change-Id: Ia9b5f8e076a7ff78a59e38c54e1dbac3f6cb8021
Reviewed-on: https://go-review.googlesource.com/6403
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-02 18:02:30 +00:00
Hyang-Ah (Hana) Kim f13db43649 cmd/gomobile: don't try to copy $GOROOT/include; no longer exists.
golang.org/cl/6361.

Change-Id: Id056efa8de166978e1385e5a683c9d512b33e3cf
Reviewed-on: https://go-review.googlesource.com/6402
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-01 16:10:40 +00:00
Hyang-Ah (Hana) Kim cd61880423 cmd/gomobile: use exec.LookPath instead of 'which' cmd.
Change-Id: I7fe83d35777b6cb05747c412a69b764994902958
Reviewed-on: https://go-review.googlesource.com/6150
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-26 21:35:02 +00:00
Hyang-Ah (Hana) Kim f17dcbad8d cmd/gomobile: bind should not fail due to non-empty outdir.
This change makes bind remove existing symlinks to Go.java, Seq.java in outdir
and overwrites them with new paths.

Change-Id: I2d24fbfd04a2bee94c0fa220fa0bba2ec600ae4c
Reviewed-on: https://go-review.googlesource.com/5883
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-25 16:31:37 +00:00
David Crawshaw 6d45c43cd0 cmd/gomobile: check cross compilers are in sync
Fixes golang/go#9907

Change-Id: I34805ab3a71d720d028a9e2064b179fa329a4a5d
Reviewed-on: https://go-review.googlesource.com/5440
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-20 16:17:05 +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
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 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
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 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