Commit Graph

97 Commits

Author SHA1 Message Date
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