Commit Graph

64 Commits

Author SHA1 Message Date
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
Burcu Dogan a5e8a96a7f mobile/cmd/gomobile: add iOS binary builder from darwin/arm
This is the initial CL of a series to add iOS build support for
darwin/arm and darwin/arm64.

The builder utility is not invoked during $ gomobile build currently.

gomobile build will invoke goIOSBuild and codesign the generated
binary with assets available on the source directory to build an app
file. This app file might converted into an IPA as an ad-hoc
distribution archive.

darwin/arm and darwin/arm64 cross builders need to be built during
gomobile initialization step and tools need to be moved under
$GOROOT/pkg/gomobile/ios.

Change-Id: Ifb8d3c0f37611c78ca9c8887a367750fb98a546a
Reviewed-on: https://go-review.googlesource.com/10085
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-14 23:48:34 +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
Elias Naur 383d14d1a3 mobile/cmd/gomobile: add proguard.txt to gomobile bind .aar files
The gomobile bind command outputs an .aar file ready to include in an
Android project. If the including project use the minifyEnabled gradle
option  the field go.Seq.memptr will be removed since it is only referenced
from C code.

Instruct the minifier to keep all go.* java code by adding an appropriate
proguard.txt file to the .aar file.

Change-Id: Ia1e89a5d8f4b4f349f9c2cf4d0dba2628557fdf9
Reviewed-on: https://go-review.googlesource.com/9802
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-06 22:49:45 +00:00
David Crawshaw b364bb0348 cmd/gomobile: print error messages from javac
Useful if you are running an old unsupported Java 1.6.

Change-Id: I794bacc22a09ee339730ef7b600475eba09a3a9d
Reviewed-on: https://go-review.googlesource.com/9649
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-04 12:06:30 +00:00
Burcu Dogan d9a820a72b cmd/gomobile: expand the docs with instructions to build Go from tip
Change-Id: Ie7bd43cdf8d759e6d739824c59cac0e01d1a4b95
Reviewed-on: https://go-review.googlesource.com/9630
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-01 19:24:26 +00:00
Hyang-Ah (Hana) Kim 74be7c24e4 cmd/gomobile: update the doc.
Change-Id: Ie654ad9aaaf5a1c0394731161194a1358a075e97
Reviewed-on: https://go-review.googlesource.com/8245
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-29 16:05:14 +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
Hyang-Ah Hana Kim 47553f4d42 cmd/gobind: fix a typo.
This addresses the reviewer's comment from change 8986.

Change-Id: Ibeec45fa9b8ab2ee68ebcc98f38f3538d992024d
Reviewed-on: https://go-review.googlesource.com/8987
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-16 18:47:12 +00:00
Hyang-Ah Hana Kim 5f5a5fa270 cmd/gobind: list byte slice as a supported type.
Fixes golang/go#10481.

Change-Id: I8cee771c32347c2ef641b416dbc1967dc52a0f46
Reviewed-on: https://go-review.googlesource.com/8986
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-04-16 18:19:58 +00:00
Hyang-Ah (Hana) Kim d04e7395d9 cmd/gomobile: change the bind command to output .aar format for Android.
Instead of the ad-hoc output directory structure to hold java source code
and compiled .so files, this change makes the bind command create an AAR
bundle.  AAR is the format for Android library project/module outputs.
AAR is similar to .jar except that includes resource files.

http://tools.android.com/tech-docs/new-build-system/aar-format

This AAR format is in the Android's new build system's roadmap (
http://tools.android.com/tech-docs/jackandjill) and Android IDEs
are likely supporting the format.

For integration with Android Studio project, the user is expected to place
the .aar file to the main app's libs directory and specify the dependency
in the gradle rule. This can be done through a gradle plugin or with Android
Studio integration. For Buck, the .aar file can be the input of the
android_prebuilt_aar rule.

This depends on the availability of javac and android SDK -
which may not be an issue because the bind users will need them anyway
to build their main app.

Change-Id: I635902e994d002bb875c7838e19f172e187b0b87
Reviewed-on: https://go-review.googlesource.com/8084
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-30 20:00:37 +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 2965d09ba5 cmd/gomobile: don't create .apk file with the -n option.
Change-Id: If69b82f1c64c950fb5c0440dc5837f4ad7e1037a
Reviewed-on: https://go-review.googlesource.com/8085
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-26 13:49:12 +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 b316a2d0ce cmd/gomobile: pack OpenAL libraries into the apk if audio is imported
Fixes #10058.

Change-Id: Ie947f98d2ebbf1f851e1eb68132ddfe848c9aa94
Reviewed-on: https://go-review.googlesource.com/7020
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-03-07 02:57:56 +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
Burcu Dogan 42f807be2c cmd/gomobile/release: generate a tarball that contains OpenAL
Change-Id: I1a7282fcb31d778ff12d7a655eadbac1a01e584b
Reviewed-on: https://go-review.googlesource.com/6720
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-04 21:42:26 +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 0d808afac4 cmd/gobind: env variable merge for Windows.
context: https://go-review.googlesource.com/6510
Windows env var names are case insensitive and may contain "=".
Before merging, apply strings.ToUpper. Pass env vars that are not
in "key=value" form untouched.

Change-Id: I0d51d2f3bc64fcee72f765c04c550299d7b285e9
Reviewed-on: https://go-review.googlesource.com/6513
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-03 17:35:06 +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 ca953945bc cmd/gomobile/release: add windows android ndk dist.
Change-Id: I87b880bb76c144023864c6ea13c0c54194447035
Reviewed-on: https://go-review.googlesource.com/6339
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-01 15:19:46 +00:00
Hyang-Ah (Hana) Kim d6c8d03959 cmd/gobind: fix init_test.
$GOROOT instead of $HOME/go.

Change-Id: I6dd22057b58b0ad93ecbc6900a2fec09c41fe019
Reviewed-on: https://go-review.googlesource.com/6160
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-26 21:35:13 +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 605b2be3c2 cmd/gomobile: build non-main packages
This brings the semantics a little closer to the Go tool.
I find it surprisingly useful for testing if android-specific
changes to a package compile.

Change-Id: I9f5730f678eb418fc5659fa82c1fe9b78a084e33
Reviewed-on: https://go-review.googlesource.com/5741
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-24 14:29:17 +00:00
David Crawshaw b9b7a66d4b cmd/gomobile, cmd/gobind: fix build
Remove SourceImports, which was replaced with ImportBinary
in https://golang.org/cl/5653

Change-Id: Ic20e6b23b77209da182f284b34638d74030bfc0e
Reviewed-on: https://go-review.googlesource.com/5740
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-24 12:51:14 +00:00
David Crawshaw b2dee7a880 app, cmd/gomobile: expose an app.State variable
The State can be used in the Start callback (and lazily-initialized
packages) instead of JavaInit. This stores a reference to the
android.context.Context for the (future) keyboard package and for
setting TMPDIR.

Second attempt at https://golang.org/cl/4400.

Change-Id: I673997b26ab25ce5140cb31950593d8c6dbd9c51
Reviewed-on: https://go-review.googlesource.com/5555
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-23 17:54:17 +00:00
Burcu Dogan 9760c0641e cmd/gomobile: pass the -x flag to go build if set
Change-Id: I5a5c8cee5cf4683d01af2bf351ac43eb3695f89a
Reviewed-on: https://go-review.googlesource.com/5192
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-20 18:10:07 +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
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
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