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>
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.
Fixesgolang/go#11043.
Change-Id: Ibc23b6d355f10b09940b20c813eb73d0f4313851
Reviewed-on: https://go-review.googlesource.com/11587
Reviewed-by: David Crawshaw <crawshaw@golang.org>
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>
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>
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>
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>
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>
This CL will be followed by another change to remove the
misc/ios/clangwrapper.sh dependency.
Updates golang/go#11043.
Fixesgolang/go#11339.
Change-Id: I82466f8d845945935ab82d3d0b75f5af9e1ef3ec
Reviewed-on: https://go-review.googlesource.com/11345
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Fixesgolang/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>
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.
Fixesgolang/go#10187
Change-Id: I4a861718d8a413855917a5b1f1073e2cd84c9bb1
Reviewed-on: https://go-review.googlesource.com/9685
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
Change-Id: Ie7bd43cdf8d759e6d739824c59cac0e01d1a4b95
Reviewed-on: https://go-review.googlesource.com/9630
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
Change-Id: I2a41cf0f16dcefe87c73ab0a8f02a251c1243157
Reviewed-on: https://go-review.googlesource.com/8121
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>