Граф коммитов

383 Коммитов

Автор SHA1 Сообщение Дата
Hyang-Ah Hana Kim 01216d9779 cmd/gomobile: do not pass -i to 'go install' command
Fixes golang/go#13407

Also updates bind test.

'gomobile bind' currently runs 'go install' first and generates code
from the compiled object. This makes the -i option unnecessary.
Updated the bind command doc not to mention the -i option.

The use of -i option from Android Studio GoBind plugin will be removed
in a separate CL.

Change-Id: Ie48c00874219adb5169e01d3ba61930728cf2314
Reviewed-on: https://go-review.googlesource.com/17253
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-30 21:48:35 +00:00
Hyang-Ah Hana Kim 6295a61f59 cmd/gobind: delete unused parseFiles func
Change-Id: I1f9678671692becde0721347721bea65530146ee
Reviewed-on: https://go-review.googlesource.com/17190
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-24 15:52:38 +00:00
Sridhar Venkatakrishnan 71a0e8bda1 bind: Android support for multiple packages.
As discussed in golang/go#12245

Usage: gomobile bind [options] a.b.c x.y.z

For java gobind and gomobile  will generate go.c.C.java and go.z.Z.java.
If -javapkg=com.example is specified they will generate
com.example.C.java and com.example.Z.java.

Tested on Darwin.

Change-Id: Ia8e57c8fec7967131d55de71cc705d9e736ccca0
Reviewed-on: https://go-review.googlesource.com/17023
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-24 12:33:02 +00:00
David Crawshaw 0d55c986b8 cmd/gomobile: make -n work with bind
Fixes golang/go#13323.

Change-Id: Ica213b7d06581ac7a0492184a903752cfa15d889
Reviewed-on: https://go-review.googlesource.com/17090
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-20 17:04:45 +00:00
Hyang-Ah (Hana) Kim b39ed682d8 cmd/gomobile: sanitize android app package names
https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

"This can occur if the domain name contains a hyphen or other special
character, if the package name begins with a digit or other character
that is illegal to use as the beginning of a Java name, or if the
package name contains a reserved Java keyword, such as "int". In this
event, the suggested convention is to add an underscore."

The sanitized name is used for the app package name and the default apk
file name.

Update golang/go#12273

Change-Id: I76d7f423e87c54a5bb7ab71ec251fd3a26da9722
Reviewed-on: https://go-review.googlesource.com/16875
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-18 17:26:55 +00:00
David Crawshaw d4beed2e0a cmd/gomobile: load from export data, not source
Replace the vendored version of x/tools/go/loader with the standard
library's go/importer package. This reads the export data from
$GOPATH/pkg/pkgname.a instead of parsing and type checking the source
code. The "go install" subcommand is invoked just prior to reading
the export data to make sure the export data is up to date.

Not yet tested on darwin, but working for android builds.

Change-Id: I24aa60aa46b843d30bc5833e3035699900bf3df4
Reviewed-on: https://go-review.googlesource.com/16913
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 19:25:59 +00:00
David Crawshaw f8cb2f0e7e cmd/gomobile: expose goVersion to subcommands
Pulled out of golang.org/cl/16913.

Change-Id: I041aba4e8cefed95ee2935139571140164b5d677
Reviewed-on: https://go-review.googlesource.com/17001
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 18:51:34 +00:00
David Crawshaw a6a27b7fc9 cmd/gomobile: say why a version is unknown
Fixes golang/go#13238

Change-Id: Ib44f9833891d721843a0fa255d9a86f1c7d43902
Reviewed-on: https://go-review.googlesource.com/16929
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 12:58:04 +00:00
David Crawshaw 8835366576 cmd/gomobile: build android stdlib
Second attempt at the change reverted in golang.org/cl/16917.

The current code executes go install -buildmode=c-shared std, which
does nothing. (See golang/go#13234.)

Correctly compiling packages for android arm requires different
flags on Go 1.5 and 1.6, as we now build PIC. So we look for go1.5
in the output of "go version", and otherwise assume 1.6+.

Change-Id: If636f52be5019bd179483b8735630a98e6f8d201
Reviewed-on: https://go-review.googlesource.com/16928
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-16 15:38:01 +00:00
Hyang-Ah Hana Kim 4f9c718489 Revert "cmd/gomobile: avoid -buildmode for go install std"
This reverts commit b84795b494.

See golang/go#13246

Change-Id: Ie8b89a9ac6e5b6906b3a4de21122d694cf7a2d0a
Reviewed-on: https://go-review.googlesource.com/16917
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-14 03:18:11 +00:00
David Crawshaw daecc566fd cmd/gobind: load from export data, not source
Replace the vendored version of x/tools/go/loader with the standard
library's go/importer package. This reads the export data from
$GOPATH/pkg/pkgname.a instead of parsing and type checking the source
code. The "go install" subcommand is invoked just prior to reading the
export data to make sure the export data is up to date.

This has the advantage of relying entirely on the go tool for correctly
resolving and parsing dependencies of the package being bound. (For
example, a bound package can now depend on cgo.) It also removes a class
of bugs where the version of the loader we depend on can get out of sync
with the go tool. (For example, gobind now correctly handles vendor
dependencies.)

As a bonus, for packages with significant dependencies this approach
should also be noticeably faster as we do not need to parse and
typecheck all of the dependencies.

Change-Id: If9a431c137eae2071c1d89be88a4a6a61d6812fa
Reviewed-on: https://go-review.googlesource.com/16911
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 20:01:33 +00:00
David Crawshaw b84795b494 cmd/gomobile: avoid -buildmode for go install std
Turns out that go install -buildmode=c-shared std does nothing. The go
tool filters all non-main packages from c-shared builds, which for the
standard library is all packages.

This may be a bug in the go tool. I'm not sure yet. But either way, to
make the gomobile tool work with Go 1.5, work around it here.

Change-Id: Ica1e7eeb0f40a21a2c78b0c55bdc54f133a32ee5
Reviewed-on: https://go-review.googlesource.com/16912
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-13 20:00:04 +00:00
Daniel Skinner 3b97f7024e cmd/gomobile: synthesize minSdkVersion for manifest
Fixes golang/go#13172

Change-Id: I16cab3f74f668ce3522a1a14c979aca5c988347c
Reviewed-on: https://go-review.googlesource.com/16843
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-13 09:00:34 +00:00
Hyang-Ah Hana Kim 1452f035be cmd/gomobile, asset: specify vanity import paths
Change-Id: I3740f3be3d229c308e12f94bb88d8c8b8a411d19
Reviewed-on: https://go-review.googlesource.com/16636
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-05 15:43:03 +00:00
Burcu Dogan c6f2181dba cmd/gomobile: don't override the build tags
Fixes golang/go#13082.

Change-Id: I0956efb1045cc04dcda5034e2ff6e3089be192e0
Reviewed-on: https://go-review.googlesource.com/16433
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-28 20:22:40 +00:00
Burcu Dogan 5785cf5e17 cmd/gomobile: remove the unused Debug configuration
Change-Id: Ic55a3dd91d2b3baccf22de532d98a3d29f799df9
Reviewed-on: https://go-review.googlesource.com/16414
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-28 17:00:43 +00:00
Daniel Skinner 38a56c4998 cmd/gomobile: support manifest theme with new reference type
Style identifiers for included themes were selected based on
api level <= 9.

Fixes golang/go#13018

Change-Id: I6be19a90b65ad5cbd78ff73fe2d9a71b8e3908ca
Reviewed-on: https://go-review.googlesource.com/16159
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-22 15:26:47 +00:00
Daniel Skinner 103b3cfae8 cmd/gomobile: support manifest screenOrientation
Testing BinaryXML for the change was non-trivial as the first 4 bytes
of gomobile output did not match the latest version of aapt's output.
A new approach to testing compatibility was added based on how the
aapt tool pretty prints xmltree of manifest's contents.

Fixes golang/go#10943

Change-Id: I5c60af10931d9693dbeaff66f23a69042a78e8fa
Reviewed-on: https://go-review.googlesource.com/16150
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-21 22:56:52 +00:00
Burcu Dogan f1034a4131 cmd/gomobile: use the proper prefix when generating a bundle
Fixes golang/go#12960.

Change-Id: I97abdc3219e857a83908a360aa619089086795ac
Reviewed-on: https://go-review.googlesource.com/16026
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-19 16:14:39 +00:00
David Crawshaw 0303da803c cmd/gomobile: fix test for buildmode=c-shared
Added recently, but I forgot to update the test.

Fixes golang/go#12983

Change-Id: I668b20d74c6b91d9588e6f252939d36ae780bd77
Reviewed-on: https://go-review.googlesource.com/16052
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-19 14:40:54 +00:00
David Crawshaw 82d11f2f29 cmd/gomobile: build android stdlib as PIC
Fixes golang/go#12581

Change-Id: I9e462b76037f0f89f1d3e59b9aef899d21de925a
Reviewed-on: https://go-review.googlesource.com/15803
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-13 19:59:19 +00:00
Burcu Dogan c58aba718c cmd/gomobile: title case framework bundles
Traditionally, framework bundles have title case names such as
CoreFoundation.framework and UIKIt.framework.

gomobile bind should generate framework bundles named similarly,
following this convention.

Change-Id: Ia6082ed351ddc6fc97e0435e24e5f79c5afbaea4
Reviewed-on: https://go-review.googlesource.com/15330
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-02 04:47:58 +00:00
David Crawshaw 560c1bec66 cmd/gomobile: print stderr on xcrun failure
The stderr includes a helpful note from Xcode about how to fix it.

Fixes golang/go#12515

Change-Id: I4eb944f29a7a3e39e2f4150c27a53e04d02e5d09
Reviewed-on: https://go-review.googlesource.com/15300
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-10-01 18:48:56 +00:00
Hyang-Ah (Hana) Kim c3c5f8745b cmd/gomobile: fix minSdkVersion formatting for bind.
The fix for golang/go#12661 was incorrect.

Fixes golang/go#12809.

Change-Id: Ic2cfedcc99ced0241a5756fb36f6f9ae5a6b7287
Reviewed-on: https://go-review.googlesource.com/15270
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-10-01 16:59:24 +00:00
Hyang-Ah (Hana) Kim 2cd6a4d2c6 cmd/gomobile: specify minSdkVersion for .aar file.
Fixes golang/go#12661.

Change-Id: I9f37159cd8090454bf2dd59126bece6647b9f3b8
Reviewed-on: https://go-review.googlesource.com/14883
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-30 19:08:35 +00:00
Burcu Dogan 8cf29b651f cmd/gomobile: add modulemaps to framework bundles for simpler imports
Modulemaps allow users to use the import directives without
providing the specific header file but by using a module name
in Objective-C and Swift.

  gomobile bind -target=ios golang.org/x/mobile/example/bind/hello

Add the generated framework to an Xcode project. You will be able
to import the library header and use the library by importing hello
in Swift.

  import hello
  // ...
  hello.GoHelloGreetings("burcu");

In Objective-C, you will be able to import with the module name
similarly by using the import directive below.

  #import hello

This CL also enables Go bindings to be used from Swift without an
Objective-C bridging header.

Fixes golang/go#12422

Change-Id: I7c60349caad100861d0b642ddfa873d7ada47598
Reviewed-on: https://go-review.googlesource.com/15044
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-09-28 16:36:07 +00:00
Burcu Dogan ae2f847064 cmd/gomobile: skip the hidden asset files
gomobile builds apps with hidden files from the assets directory.
The final applications should skip files like .DS_Store, .gitignore,
etc. Therefore, walker needs to skip the hidden files.

Change-Id: Ibbf7010d525cc831a009f3680f84063f40ac570f
Reviewed-on: https://go-review.googlesource.com/14825
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 17:04:59 +00:00
Burcu Dogan 18875a7b5b cmd/gomobile: follow the symlink if assets is a symlink
Fixes golang/go#12713.

Change-Id: Ie63a48b2ab3f39d6481fab702e00c762587501b2
Reviewed-on: https://go-review.googlesource.com/14824
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 17:04:24 +00:00
Hyang-Ah (Hana) Kim 24e7a6212f cmd/gomobile: use ARC when compiling generated objective-c files.
Gobind -lang=objc generates code that assume use of ARC.
Set -fobjc-arc to explicitly enable ARC.

Change-Id: Ib0ec7b19773c112c01ed23cb00f1ec9d64946e6b
Reviewed-on: https://go-review.googlesource.com/14544
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-14 20:55:34 +00:00
Hyang-Ah (Hana) Kim ffd5bae668 cmd/gomobile: add a dummy Info.plist for happy manual codesign.
Fixes golang/go#12604.

Change-Id: I94e94c32ce42022b58097c349fcbb90edb0a2f13
Reviewed-on: https://go-review.googlesource.com/14543
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-14 20:44:35 +00:00
David Crawshaw 1f77c34859 cmd/gomobile: copy libopenal.so explicitly
Fixes golang/go#12550.

Change-Id: I744729cfd702f0e044eac22858ee746096977665
Reviewed-on: https://go-review.googlesource.com/14474
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-09-11 14:46:26 +00:00
David Crawshaw 471eeebd99 cmd/gomobile: always display stdout from abd
Fixes golang/go#12418

Change-Id: Ie0f2e669b3e516787b548c69a624e9063cd7f68f
Reviewed-on: https://go-review.googlesource.com/14160
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-09-02 14:17:25 +00:00
Hyang-Ah (Hana) Kim 4a6caa5fd7 cmd/gomobile: bind allows custom package path/prefix.
New option -javapkg for -target=android, and -prefix for -target=ios.
Fixes golang/go#9660.

Change-Id: I9143f30672672527876524b38f450629452a3161
Reviewed-on: https://go-review.googlesource.com/14023
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-01 19:17:05 +00:00
David Crawshaw 0c8c4ad3bc cmd/gomobile: revert dex change made in 54c0a36
There is no change to GoNativeActivity.java in cl/14039, so there
should be no change to the generated dex file. Confirmed with go
generate in a clean client.

Change-Id: I37ad615716d6ab6cd6e492b2145e1a71228f79ae
Reviewed-on: https://go-review.googlesource.com/14078
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-31 13:19:12 +00:00
Burcu Dogan 54c0a36309 cmd/gomobile: *.aar and *.framework files are libraries
It seems like shared library terminology has left as a legacy
from the days bind command only supported Android and bind was
generating shared libraries as an output.

Additionally, rewording the mention of apks and apps.
These libraries aren't generated for apk or apps but Android IDE
or Xcode projects.

Change-Id: I46dd56ddccde2d2526fa9b69f700c48c5dd474db
Reviewed-on: https://go-review.googlesource.com/14039
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-31 05:15:54 +00:00
Burcu Dogan 1b518ad9d6 cmd/gomobile: capitalize the app name on android
Fixes golang/go#12376.

Change-Id: Ibc48d309a6f15953939550c271033d889721553c
Reviewed-on: https://go-review.googlesource.com/13982
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-28 15:23:09 +00:00
Hyang-Ah (Hana) Kim c384607ef3 bind: support for custom java package name and objective-c prefix.
Introduce options -javapkg and -prefix for gobind command.

The following generates java class Testpkg with package name com.example.

gobind -lang=java -javapkg=com.example testpkg

The following generates objective-c files where function and type names
are prefixed with ExampleTestpkg.

gobind -lang=objc -prefix=Example testpkg

As discussed in golang/go#9660 and golang/go#12245.

Gomobile support is not yet implemented.

Change-Id: Ib9e39997ce915580a5a2e25643c0c28373f27ee1
Reviewed-on: https://go-review.googlesource.com/13969
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-28 13:57:06 +00:00
Hana Kim 979ebcea99 cmd/gomobile: make test pass in windows.
Change-Id: I189524ddf853b9fd0c5510878cfb2cf33b973345
Reviewed-on: https://go-review.googlesource.com/13875
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-24 21:39:25 +00:00
David Crawshaw 8bf23706cf cmd/gomobile: only install app pkgs on darwin
Unfortunately GLES is not a common package for a linux desktop
to have installed. To avoid bind-based users having to jump
through the hoop of installing GL, disable this performance
optimization on linux for now.

Change-Id: Ic00baef6237dca360f191ec291b6c165eda7ad6e
Reviewed-on: https://go-review.googlesource.com/13874
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-24 21:04:37 +00:00
David Crawshaw 128f53db6d cmd/gomobile: install common dev packages
I often forget to do this. I can't be the only one.

Change-Id: Ia5dfaa6811242758f996de614f80cb42badf327b
Reviewed-on: https://go-review.googlesource.com/13742
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-24 16:01:42 +00:00
Hyang-Ah Hana Kim f9f0ffafe3 cmd/gomobile: reset readonly bits of downloaded files in Windows
os.Rename in init fails in Windows for various reasons. One of them
is the temporary files extracted from NDK, OpenAL archives. For
some reason, some of them have read-only properties.
(golang/go#12212)

> gomobile init
gomobile: rename
 C:\Users\foo\pkg\gomobile\work-427911983\openal\include\AL
 C:\Users\foo\pkg\gomobile\android-ndk-r10e\arm\sysroot\usr\include\AL:
 Access is denied.

We reset the read-only bits of all the extracted files.

Change-Id: Ib958cbedf1b7527ecb5b9318f23fe9437dc7c241
Reviewed-on: https://go-review.googlesource.com/12970
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-24 13:08:21 +00:00
Tim Cooijmans 78ac81ee2f cmd/gomobile: Fix issue in init when downloading full NDK.
Fixes an issue where the full NDK could not be downloaded due to a missing execute permission.

Fixes golang/go#12208

Change-Id: I6f432b5021b082693a02a293f50caf6da4d4e379
Reviewed-on: https://go-review.googlesource.com/13669
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-19 19:55:24 +00:00
David Crawshaw 377063dfa4 app: plumbing for physical android key events
This is only the first half of physical key event mapping. The
modifiers and hardware key codes will be in a followup CL. I'm
splitting this out because it covers two other parts of the problem:
first is maintaining a JNIEnv pointer for the main routine, the
second is access to the Android unicode key map. The NDK does not have
a method to give us the key mapping, so we get to it via
GoNativeActivity.

Tested with a USB keyboard. I'll attempt an abd-based unit test later,
but I suspect it will be difficult to set a device ID.

Change-Id: Ie93700d1f2a5d382a9b17cdd668cb4acaa6e4bcc
Reviewed-on: https://go-review.googlesource.com/13649
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-18 13:10:55 +00:00
David Crawshaw df7e121d2f cmd/gomobile: cleanup and link to wiki docs
Change-Id: Iaaa5208c663f8d1ff8acf1a632b5fe05976d86a4
Reviewed-on: https://go-review.googlesource.com/13610
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-12 16:21:55 +00:00
Hyang-Ah (Hana) Kim 73792b1db2 bind: update doc to include objective-C interface type support.
Also mention the current limitation in byte slice binding.
golang/go#12113.

Change-Id: Ie75780c2d203431ca26a188dfdb8f000f6805c18
Reviewed-on: https://go-review.googlesource.com/13531
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 16:37:26 +00:00
Hyang-Ah (Hana) Kim 2a7a6f0949 cmd/gomobile: use the app names as bundle id in ios.
This fixes the bug - all apps built with gomobile build had the same
bundle id (org.golang.todo.main).

As part of this fix, rfc1034Label function is used to sanitize the app
name (in a similar way of 'rfc1034identifier' formatter). We use this
for Android app package name as well.

Change-Id: Iae1985614a55771bf1849fe66180c4ac736497d7
Reviewed-on: https://go-review.googlesource.com/13041
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 14:39:38 +00:00
David Crawshaw a1723d5d95 cmd/gomobile: add SHA256 hashes for downloads
Change-Id: I063870b65be136f95d44c5c00c3be89015717c08
Reviewed-on: https://go-review.googlesource.com/13443
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-10 17:06:08 +00:00
David Crawshaw fa69a4e270 cmd/gomobile: better AndroidManifest errors
Before:
	gomobile: EOF
After:
	gomobile: error parsing /Users/crawshaw/src/golang.org/x/mobile/example/basic/AndroidManifest.xml: EOF

Change-Id: I5e890e3ede5eef04c0a9f26a894bf450da19b3d9
Reviewed-on: https://go-review.googlesource.com/13442
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-10 12:29:32 +00:00
Hyang-Ah Hana Kim 18a718a447 cmd/gomobile: fix init test (linux)
Change-Id: I069991176c91e73255a3c92c19bb9f5eff94d681
Reviewed-on: https://go-review.googlesource.com/12980
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-31 14:47:41 +00:00
David Crawshaw dbb9fceceb cmd/gomobile: update docs, remove iOS warning
This is not to say that iOS support in the gomobile tool is "ready",
but it is working well enough to qualify as the same level of
experimental as the rest of the tool.

Change-Id: I7aab7a5072b23f051501bbb6bbecdb9c449296a5
Reviewed-on: https://go-review.googlesource.com/12892
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-30 14:59:13 +00:00
David Crawshaw b780379135 bind: vendor x/tools/go/loader
This breaks our dependency on the x/tools repository, which has a
tendency to change in unexpected ways. It also means we can use the
version of go/types that ships with Go 1.5.

Along the way, it appears that cgo processing has changed slightly.
The old check for cgo files apparently wasn't working, so I removed
it.

Change-Id: I14378e9df9cd65c5ab61b47728ba0d56f31cdf76
Reviewed-on: https://go-review.googlesource.com/12680
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-28 18:02:47 +00:00
David Crawshaw 23401e249d cmd/gomobile: skip test if keytool is bad
Looks like the binary is present on OS X even when Java is not
installed, and it returns an error when called.

Change-Id: Icbd42637f718a4fc05e65ea3973a584d1f24850e
Reviewed-on: https://go-review.googlesource.com/12743
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-28 16:36:02 +00:00
Hyang-Ah (Hana) Kim af3e09ede0 cmd/gomobile: add -work flag.
In order to make the artifacts of go build command preserved under WORK
directory, this change modifies TMPDIR (TEMP/TMP for windows)
environment variables to point to gomobile's tmpdir if -work flag is set.

> gomobile init -work
WORK=/gopath/pkg/gomobile/work-276689736

> ls /gopath/pkg/gomobile/work-276689736
README			go-build823903592	openal
android-ndk-r10e	go-build858075903
go-build365743399	go-build921886344

> gomobile build -work golang.org/x/mobile/example/basic
WORK=/tmp/gomobile-work-863381843

> ls /tmp/gomobile-work-863381843
go-build102034516	libbasic.so

> gomobile bind -work github.com/hyangah/ivy
WORK=/tmp/gomobile-work-355100962

> ls /tmp/gomobile-work-355100962
android			go-build284034365	javac-output
androidlib		go_ivy

Change-Id: I2f467e0063bc1c8b8c636a8cd6d100e86a99a91a
Reviewed-on: https://go-review.googlesource.com/12720
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 13:37:12 +00:00
David Crawshaw 405d6233b3 cmd/gomobile: parameterize tests on NumCPU
Builders only have p=4.

Change-Id: I3e5d57579d26cb26f4ce29817a7bbdd8c34ad2ae
Reviewed-on: https://go-review.googlesource.com/12742
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-28 13:18:05 +00:00
David Crawshaw 2928ad7782 cmd/gomobile: use nm to build list of packages
Today we only look at direct imports of package main for an import of
golang.org/x/mobile/app, which is unfortunate. We also do a complete
package tree load using go/build looking for the OpenAL import when
building for android, which involves reading a lot of files.

The compiler and linker have already done all of this work for us.
Run nm on the output binary and extract package names from it.

Change-Id: Ie4f07befede5017bbca7d24325062369d4b5c30d
Reviewed-on: https://go-review.googlesource.com/12645
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-27 23:32:43 +00:00
David Crawshaw cf7179576b cmd/gomobile: consistent iteration order of paths
This deflakes the TestIOSBuild test, which relies on the iteration
order. While here, use the existing contents to shorten the test
output comparison.

Fixes golang/go#11889

Change-Id: Ib8c9592d07c53a12eee1f40267eaa2074b8d71cc
Reviewed-on: https://go-review.googlesource.com/12679
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-07-27 20:15:51 +00:00
Burcu Dogan 9072a8963f cmd/gomobile: init should honor -u flag
gomobile init should force download the NDK or the OpenAL package
if -u is set. -x should not print `curl` lines if cached archives
are being used.

Change-Id: I82ceb28540c22a0579ba9969bcf11477f1da81fb
Reviewed-on: https://go-review.googlesource.com/12701
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-27 19:00:49 +00:00
David Crawshaw 73db4d8b43 cmd/gomobile: -n implies -x, use runCmd in install
Change-Id: Ic03f1e4e49a80cf1000735a367534161bf3fe975
Reviewed-on: https://go-review.googlesource.com/12454
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-27 17:54:18 +00:00
David Crawshaw 460cd41ce2 cmd/gomobile: fix tests, add -p=8 from cl/12641
Change-Id: I96552800dc8e396592a073283ccf8949b7849439
Reviewed-on: https://go-review.googlesource.com/12677
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-25 16:35:55 +00:00
David Crawshaw e85e05a453 cmd/gomobile: fix build
Change-Id: Ia4f09fbc56ca4f0c31ef075049b7854442b0155e
Reviewed-on: https://go-review.googlesource.com/12644
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-24 20:04:04 +00:00
David Crawshaw ecc4253790 cmd/gomobile: set *build.Context GOOS
This lets `gomobile build` work on a package that contains files all
protected as '// +build android'.

Change-Id: I22915aecda8674597cfe18e1f75d30e6bfc4aab7
Reviewed-on: https://go-review.googlesource.com/12640
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-24 19:52:34 +00:00
David Crawshaw 58652d815d cmd/gomobile: init darwin/arm{,64} concurrently
Drops the time for `gomobile init` on my machine from 46s to 30s.

Change-Id: Iab89f2e1d1cee4b414dc2fb1c735b4167aef9036
Reviewed-on: https://go-review.googlesource.com/12641
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-24 19:48:49 +00:00
Hyang-Ah (Hana) Kim 354c023467 cmd/gomobile: version command
Finding the revision info from compiled binary (gomobile) built with
'go get' is not currently possible. What we can do instead is to check
if the current mobile repository found from GOPATH builds the same
binary by running 'go install -x -n' and checking if it outputs any
output. If so, this command prints out the revision info of the
repository. Otherwise, prints 'unknown'.

Sample output:

./gomobile version
gomobile version +27329c5 Wed Jul 22 19:29:08 2015 -0400 (android,ios);
androidSDK=/Users/hakim/Library/Android/sdk/platforms/android-22

./gomobile version
gomobile version unknown

Change-Id: Idc26c8a1dd3b43cc47a5c15ce130e2b97a460cec
Reviewed-on: https://go-review.googlesource.com/12455
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-23 15:25:54 +00:00
Burcu Dogan 09206a7c58 cmd/gomobile: test ios builds
iOS builds have been broken due to missing main executable. Xcode
doesn't complain and buildling the target .app bundle even if a
referenced objects doesn't exist.

Fixing .app builds and adding a unit test.

Change-Id: Ie9aec6c8c982a96c10bf07344e44bd501fcabd19
Reviewed-on: https://go-review.googlesource.com/12492
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-21 22:09:02 +00:00
Burcu Dogan a1efd1d6c6 cmd/gomobile: use package path as the app name
If the application main package is in

  golang.org/x/mobile/example/basic

the generated application will have "Basic" as its name.

Change-Id: Ic59fae6e18c26e406ab352265aa2d6b11619c102
Reviewed-on: https://go-review.googlesource.com/12435
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-21 21:11:27 +00:00
David Crawshaw 5f9cda1c8a cmd/gomobile: build .framework for iOS bind
Tested manually, I can bind github.com/hyangah/ivy and include it
in an Xcode project.

Change-Id: I7dfa7828da7288841bc930d3e506ee97bf2ca520
Reviewed-on: https://go-review.googlesource.com/12388
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-20 20:49:37 +00:00
David Crawshaw bebbf49ba9 cmd/gomobile: consolidate os/exec Run calls
Tested:
	go test golang.org/x/mobile/bind/java
	gomobile bind -target={ios,android} github.com/hyangah/ivy
	gobuild build -target={ios,android} golang.org/x/mobile/example/basic

	(With various takes on -x and -v.)

Change-Id: I15c8f605490381feb6fefb482110f2a1c210529d
Reviewed-on: https://go-review.googlesource.com/12411
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-20 17:45:43 +00:00
David Crawshaw c9adc5b29d cmd/gomobile: build for iOS with -tags=ios
Fixes golang/go#11782.

Change-Id: Ifa23a3cbe0032972f7c5c122ac1689441b63334e
Reviewed-on: https://go-review.googlesource.com/12387
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-19 20:54:12 +00:00
Jae Kwon 96f72abd68 cmd/gomobile: expect GoNativeActivity in external manifests
gomobile expects GoNativeActivity, otherwise current_ctx_clazz stays
null.
Fixed cmd/gomobile/manifest.go to expect GoNativeActivity, and fixed the
network example app.

Change-Id: Idad6f9bec2fcbc876fbd6013009582868ad3e133
Reviewed-on: https://go-review.googlesource.com/12374
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-18 02:39:09 +00:00
David Crawshaw ea6f260cd0 cmd/gomobile: update tests and add bind tests
Change-Id: I9e2fdf179b1e07a8b0d9b612913814768f8284dc
Reviewed-on: https://go-review.googlesource.com/12331
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 16:18:56 +00:00
David Crawshaw 7d5958d761 cmd/gomobile: pass -gcflags and -ldflags
Allows the use of -X, and similar flags.

Fixes golang/go#11645.

Change-Id: I0ca097059f5f70c277c79eb89f2cbb10890db802
Reviewed-on: https://go-review.googlesource.com/12333
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 14:09:01 +00:00
David Crawshaw 9300366e65 cmd/gomobile: use new -pkgdir flag
The go command now has a -pkgdir flag, which specifies a directory
for all install output, including the standard library. Use it to
build the mobile compilers under $GOMOBILE, so that targets like
the iOS simulator (darwin/386) do not conflict with system targets.
The result is we no longer need GOROOT to be writable.

The iOS simulator now works with gomobile bind.

Fixes golang/go#11342.

Change-Id: I0bc6378e0cb82e3175b2a1efe355e3ce39533649
Reviewed-on: https://go-review.googlesource.com/12303
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-16 20:10:22 +00:00
David Crawshaw ec5d8df4c0 cmd/gomobile: bind -target=ios support
First pass at bind support, simply produces .a/.h files.

In future CLs:

- Take the type defintion from seq.h and place it directly in the
  generated header, breaking the user's dependency on seq.h.

Open question for future CLs:

- Should we create a framework directory?
  If we bundle assets in the directory, can the asset package
  find them automatically?

In 1.6: support multiple archives.

Change-Id: I7c3f655e7653018333e3ce3c89807edfcf62906d
Reviewed-on: https://go-review.googlesource.com/12199
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-16 17:25:44 +00:00
Burcu Dogan ac3e8010d5 cmd/gomobile: install should fail for target!=android
Change-Id: I1c21e7aab2b283927e732a5ec8420b4c36cfae91
Reviewed-on: https://go-review.googlesource.com/12090
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-14 19:23:04 +00:00
David Crawshaw c8fe70554f cmd/gomobile: use standard env to run Go tool
Now that we no longer modify the user's $GOROOT and run make.bash,
the need for isolating the environment is gone. Pass through
whatever users want, overriding only those necesssary for corss
compilation.

While here, remove some dead code.

Fixes golang/go#11672.

Change-Id: Iaf867913eaa1311519a4d5a7a8169228ebf21346
Reviewed-on: https://go-review.googlesource.com/12128
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-14 10:24:28 +00:00
David Crawshaw 21587585e9 cmd/gomobile: switch to Android NDK r10e
Tested darwin/amd64, carefully inspected linux/amd64.

Change-Id: I237ffe446ea275911e2d44a33fc27d179924b528
Reviewed-on: https://go-review.googlesource.com/12122
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-13 23:41:23 +00:00
David Crawshaw fa6f31145f cmd/gomobile/release.go: add NDK r10e
Note that darwin/386 is no longer released by the Android NDK.

Change-Id: Ie9d5105884db45a10716637980e8352c855293a0
Reviewed-on: https://go-review.googlesource.com/12121
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-13 19:56:57 +00:00
David Crawshaw 8f20c3e9d3 app, cmd/gomobile: subclass NativeActivity
Subclassing NativeActivity makes two things possible. Firstly, we can
implement an InputConnection to offer good support for IMEs,
necessary for good keyboard support. Secondly, we can use it to
overlay WebViews onto the NativeActivity.

But to sublcass NativeActivity, we need to compile Java. To keep the
toolchain go gettable, this is done with go generate.

While here, check the exception after FindClass. Apparently it can
throw an exception.

Updates golang/go#9361.
Updates golang/go#10247.

Change-Id: I672545997f0c9a7580f06988a273c03404772247
Reviewed-on: https://go-review.googlesource.com/11980
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-13 19:05:26 +00:00
David Crawshaw e5193c59b3 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>
2015-07-13 18:54:16 +00:00
Burcu Dogan c39753dbd1 cmd/gomobile: pipe xcodebuild stdout in verbose mode
Fixes golang/go#11488.

Change-Id: I1ff2ca25dd1013d603d6f60d1e8f6e5c58c5b0ee
Reviewed-on: https://go-review.googlesource.com/12002
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-11 18:26:50 +00:00
Burcu Dogan 08407a4b1b cmd/gomobile: don't build apps that doesn't import the app package
In order to keep consistency with target=android, this CL turns
off gomobile build support for target=ios for programs that don't
import golang.org/x/mobile/app.

Change-Id: I423b042144aecfdc127726d0b97733c4d6532a81
Reviewed-on: https://go-review.googlesource.com/11985
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-08 20:46:03 +00:00
Burcu Dogan 80eb606a0f cmd/gomobile: accept -o for target=ios
Fixes golang/go#11447.

Change-Id: I6298927eb7d434ec4865c3fa45dd9e4dede17d8c
Reviewed-on: https://go-review.googlesource.com/11968
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-08 16:49:13 +00:00
Burcu Dogan b546dd39ba cmd/gomobile: reject non-main packages for ios
Change-Id: Ia103093186b775fa1edcc488979c2c1cb389b835
Reviewed-on: https://go-review.googlesource.com/11967
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-08 16:45:53 +00:00
David Crawshaw 576afe99b4 cmd/gobind: document Objective C
Also point users towards gomobile bind and move the type restrictions
section to emphasis the code examples.

Change-Id: I57c867dce02a8d9fa12df7deab892b2705bf10fe
Reviewed-on: https://go-review.googlesource.com/11963
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-07 22:36:36 +00:00
David Crawshaw 5ced61ace7 cmd/gomobile: call System.loadLibrary for .aar
Change-Id: I3fd099910cfb1fe112ded4386905d370acfea002
Reviewed-on: https://go-review.googlesource.com/11816
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-06 22:21:32 +00:00
David Crawshaw e19b161d0d cmd/gomobile: report errors from go install std
While here, make the output of -v easier to read.

Fixes golang/go#11295, golang/go#11296.

Change-Id: I51974a3443bb60a5c0bb77ac784e48987eee8391
Reviewed-on: https://go-review.googlesource.com/11814
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-01 05:19:37 +00:00
Burcu Dogan 86a5c4ee9b cmd/gomobile: remove obsolete TODOs
Change-Id: Iad4da95329c6f0d446f82a815bf84ae9bb54312c
Reviewed-on: https://go-review.googlesource.com/11732
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 15:15:46 +00:00
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 d1e52bb351 cmd/gomobile: enable target=ios builds
This CL adds iOS build support to gomobile command.

  $ gomobile build golang.org/x/mobile/example/basic

gomobile builds an .app file that is signed with the development
provisioning entities.

You may deploy .app files to your test device or convert them to IPA
to publish on App Store or share them as an AdHoc distribution.

target=ios flag requires a Darwin host machine.

Fixes golang/go#11043.

Change-Id: Ibc23b6d355f10b09940b20c813eb73d0f4313851
Reviewed-on: https://go-review.googlesource.com/11587
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 20:16:57 +00:00
Burcu Dogan ef2d0c9811 cmd/gomobile: ios builds should be achievable without an assets dir
Fixes golang/go#11445.

Change-Id: Ie1eb6df1501aeb651439711d08f2a7505b386614
Reviewed-on: https://go-review.googlesource.com/11585
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 18:34:58 +00:00
Burcu Dogan 8cac158036 cmd/gomobile: rewrite to output .app even it already exists
Fixes golang/go#11446.

Change-Id: I578bb0c6f09ea35abe56ddb8310fac85bfa20c97
Reviewed-on: https://go-review.googlesource.com/11583
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 17:35:19 +00:00
Burcu Dogan b9ad843048 cmd/gomobile: rename pkgImportsAudio to pkgImportsAL
We are determining whether to add libopenal.so dependending on the
al package imports. The names must suggest we are looking for the
al package rather than the audio.

Change-Id: Ib6896302238ff1ebe135f004b134911a0c340821
Reviewed-on: https://go-review.googlesource.com/11680
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 17:26:34 +00:00
Burcu Dogan beece5b2b6 cmd/gomobile: fix CC, CXX compliers for ios builds
Fixes #golang/go#11339.

Change-Id: Ib6069d8471332a80251bea6e8740fc7a96a16404
Reviewed-on: https://go-review.googlesource.com/11614
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 15:07:58 +00:00
David Crawshaw 8144405762 app, bind: separate the app package from gobind
Historically, the app package implemented Go runtime initialization.
This was convoluted, so the package was used both by all-Go apps
(currently based on Android's NativeActivity) and bind-based apps.

With Go 1.5 we have -buildmode=c-shared, which does a lot of the work
of the old app package. That code was removed a while back, but both
all-Go and gobind-based apps still used package app. The intermingled
initialization processes led to some strange states.

This CL separates gobind-based apps completely from the app package.
As part of that users are now expected to use System.loadLibrary
themselves. (A future CL may want to make the loadLibrary call part
of the .aar generated by gomobile bind.)

Delete the libhello example, which has been replaced by gomobile bind,
which could do with its own example at some point. Also delete the
libhellojni example, which now has nothing to do with the x/mobile
repository.

Change-Id: I444397f246dbafe81e5c53532eb482c197d26f70
Reviewed-on: https://go-review.googlesource.com/11654
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 11:40:40 +00:00
Nigel Tao 4dd66723b0 cmd/gomobile: have pkgImportsAudio look for exp/audio/al, not exp/audio.
An app could conceivably import the former without importing the latter.

Change-Id: I7b0e13fe7d9e6d9e586fa2edf00811330be2a9b7
Reviewed-on: https://go-review.googlesource.com/11607
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 04:41:45 +00:00
Burcu Dogan 0a8a8b8cb6 exp/audio/al,cmd/gomobile: fix the broken build
Change-Id: Ia2da7d987f253c11a62843f54051c9d18c1612b5
Reviewed-on: https://go-review.googlesource.com/11521
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-26 07:40:05 +00:00
Burcu Dogan 95c05c6dfd cmd/gomobile: parse -target and -o
Fixes golang/go#11337.

Change-Id: I324f0c4482476b6f2b084828625fd53b8f802a23
Reviewed-on: https://go-review.googlesource.com/11480
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-26 04:37:57 +00:00
Burcu Dogan e9833322dc Revert "cmd/gomobile: build *.app files if target=ios"
This reverts commit 597df59d36.

Reverting the change since, runtime/cgo is still not buildable and CCFLAGS is not a valid env variable. See golang/go#11339 for more information.

Change-Id: I2f168508d1ca72f5c75ff641938fd3b304939617
Reviewed-on: https://go-review.googlesource.com/11453
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-25 17:14:22 +00:00
Hyang-Ah (Hana) Kim 3ebbe2de54 cmd/gomobile: fix the path of the audio package.
The audio package has been moved.
The path used to determine whether to include openal in apk needs to
be updated.

Change-Id: Ic368617763e1991b0e82172c199e8f4318f115dc
Reviewed-on: https://go-review.googlesource.com/11500
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-25 13:10:31 +00:00
Burcu Dogan 597df59d36 cmd/gomobile: build *.app files if target=ios
This CL will be followed by another change to remove the
misc/ios/clangwrapper.sh dependency.

Updates golang/go#11043.

Fixes golang/go#11339.

Change-Id: I82466f8d845945935ab82d3d0b75f5af9e1ef3ec
Reviewed-on: https://go-review.googlesource.com/11345
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-24 20:21:15 +00:00
Hyang-Ah (Hana) Kim f770de8d07 cmd/gomobile: change the generated go file name
This prevents filenames like go_test.go (when the package name is test)
or go_windows.go (wen the package name is windows).

Change-Id: Iae8f549d4d73baac8f8ba2ea33be7fec83f0023a
Reviewed-on: https://go-review.googlesource.com/11305
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-23 13:25:24 +00:00
Burcu Dogan 4d8c316cd9 cmd/gomobile: fix the aar suffix check
Change-Id: Iecfa5326b4b2e234fbbd9e4d1815cf782035efbf
Reviewed-on: https://go-review.googlesource.com/11310
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-22 12:42:51 +00:00
Burcu Dogan df4a6521ad cmd/gomobile: improve error message if gomobile hasn't inited
gomobile init builds and install the toolchain for iOS builds now.
The error message shouldn't exclude the darwin/arm and darwin/arm64
related initialization.

Change-Id: Iebd5d7fb1466d9be694d8848c0fd8fa782850c79
Reviewed-on: https://go-review.googlesource.com/11239
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-20 22:31:06 +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
Hyang-Ah (Hana) Kim 7319e3567c cmd/gomobile: use package dir basename as app name.
Fixes golang/go#11218

Change-Id: I5faee5853170b7a53543d950801ccbf9265e60b1
Reviewed-on: https://go-review.googlesource.com/11251
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 19:39:56 +00:00
Hyang-Ah (Hana) Kim 1edfb833a0 cmd/gomobile: fix the use of diff function.
The params order matters in diff function's output.
Related to the confusing error report seen in golang/go#11297

Change-Id: Ibde615dbe43a4393232b72230fb21d7b577c0812
Reviewed-on: https://go-review.googlesource.com/11258
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-19 18:47:43 +00:00
Hyang-Ah (Hana) Kim b97afd068d cmd/gomobile: fix the broken build test.
The golden output for build test was generated assuming GOPATH == HOME.

Change-Id: I7dbf292b66e2ba999cbdc1e288ddb60767b0835b
Reviewed-on: https://go-review.googlesource.com/11257
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 18:15:02 +00:00
David Crawshaw fb3a660302 cmd/gomobile: fix test broken in cl/11265
Change-Id: Ia431f061fd10aad17b53e2b0ef12fd15eaf8795d
Reviewed-on: https://go-review.googlesource.com/11255
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-19 17:38:45 +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
Burcu Dogan 090698ee2b mobile/cmd/gomobile: remove the temp iOS work directory
Change-Id: I1ceb859fb35d1069ed4d3835f74f7ec082bfefb8
Reviewed-on: https://go-review.googlesource.com/11264
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 16:33:59 +00:00
Burcu Dogan 2813ddb570 mobile/cmd/gomobile: add the assets to the iOS Release build
Updates golang/go#11043.

Change-Id: Ied1a2a4842dc0078dc34da1266c11eec9acba114
Reviewed-on: https://go-review.googlesource.com/11263
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-18 22:13:25 +00:00
Burcu Dogan addf80de0c mobile/cmd/gomobile: invoke Xcode toolchain to build an iOS app
Currently, we don't allow user to override xcodebuild args, we may
introdude a new go build flag such as `xcodebuildargs` to pass
additional flags.

Updates #11043.

Change-Id: I776b332c2af3d9640a7c5f23ab7bc7b19a5e408a
Reviewed-on: https://go-review.googlesource.com/10990
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-13 01:48:29 +00:00
Burcu Dogan 428b72be66 mobile/cmd/gomobile: create boilerplate Xcode project
This CL adds the generation of a boilerplate Xcode project
to make it possible to shell out to xcodebuild to make a
release build.

In order to support multiple architectures, we are using lipo tool to
create fat binaries that target both darwin/arm and darwin/arm64.

This build strategy will require a darwin host with Xcode CLI tools
installed.

Updates #11043.

Change-Id: I741b05f5e34bf2a90103b1efdfa2db97a743e2a6
Reviewed-on: https://go-review.googlesource.com/10813
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-12 17:06:52 +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 4ad40f4216 cmd/gomobile: use -buildmode=c-shared
Change-Id: I427a076a8064be0a73830a37aa40f4eca8bdfda6
Reviewed-on: https://go-review.googlesource.com/10894
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-10 19:38:36 +00:00
Hyang-Ah (Hana) Kim 26f6ffe0b5 cmd/gobind: add experimental, objective-C code generation option.
Change-Id: Ia0e66ee0964bd40d868261994f7cb70260f3cbe9
Reviewed-on: https://go-review.googlesource.com/10841
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-10 00:14:20 +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
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
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
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
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
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
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
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
David Crawshaw 96c0ef1480 all: update docs to remove code.google.com
Fixes golang/go#9259.

Change-Id: I4768ce0a2abc56100e6616bacdf6aad196639b10
Reviewed-on: https://go-review.googlesource.com/1370
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-11 14:15:30 +00:00
David Symonds 7b659348a5 mobile: add import comments.
Change-Id: I0ff6d42a8e11f49df6fc3066e86be75015b93631
Reviewed-on: https://go-review.googlesource.com/1238
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-10 01:59:04 +00:00
Andrew Gerrand 9470e0ba58 go.mobile: use golang.org/x/... import paths
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/162710043
2014-11-10 08:55:57 +11:00
David Crawshaw cd38d7f2f1 go.mobile/cmd/gobind: newline after printing errors
LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/123210043
2014-08-12 14:29:18 -04:00
David Crawshaw d58b149990 go.mobile/cmd/gobind: use go/loader to load packages
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/127050043
2014-08-12 14:09:08 -04:00
David Crawshaw e8dea067be go.mobile/cmd/gobind: language binding command line tool
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/120140043
2014-08-01 10:45:18 -04:00