Fixesgolang/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>
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>
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>
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>
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>
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>
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>
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>
Style identifiers for included themes were selected based on
api level <= 9.
Fixesgolang/go#13018
Change-Id: I6be19a90b65ad5cbd78ff73fe2d9a71b8e3908ca
Reviewed-on: https://go-review.googlesource.com/16159
Reviewed-by: David Crawshaw <crawshaw@golang.org>
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.
Fixesgolang/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>
Added recently, but I forgot to update the test.
Fixesgolang/go#12983
Change-Id: I668b20d74c6b91d9588e6f252939d36ae780bd77
Reviewed-on: https://go-review.googlesource.com/16052
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
The stderr includes a helpful note from Xcode about how to fix it.
Fixesgolang/go#12515
Change-Id: I4eb944f29a7a3e39e2f4150c27a53e04d02e5d09
Reviewed-on: https://go-review.googlesource.com/15300
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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.
Fixesgolang/go#12422
Change-Id: I7c60349caad100861d0b642ddfa873d7ada47598
Reviewed-on: https://go-review.googlesource.com/15044
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
New option -javapkg for -target=android, and -prefix for -target=ios.
Fixesgolang/go#9660.
Change-Id: I9143f30672672527876524b38f450629452a3161
Reviewed-on: https://go-review.googlesource.com/14023
Reviewed-by: David Crawshaw <crawshaw@golang.org>
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>
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>
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>
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>
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>
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>
Fixes an issue where the full NDK could not be downloaded due to a missing execute permission.
Fixesgolang/go#12208
Change-Id: I6f432b5021b082693a02a293f50caf6da4d4e379
Reviewed-on: https://go-review.googlesource.com/13669
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This deflakes the TestIOSBuild test, which relies on the iteration
order. While here, use the existing contents to shorten the test
output comparison.
Fixesgolang/go#11889
Change-Id: Ib8c9592d07c53a12eee1f40267eaa2074b8d71cc
Reviewed-on: https://go-review.googlesource.com/12679
Reviewed-by: Burcu Dogan <jbd@google.com>
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>
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>
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>
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>
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>
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>
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>
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>
Allows the use of -X, and similar flags.
Fixesgolang/go#11645.
Change-Id: I0ca097059f5f70c277c79eb89f2cbb10890db802
Reviewed-on: https://go-review.googlesource.com/12333
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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.
Fixesgolang/go#11342.
Change-Id: I0bc6378e0cb82e3175b2a1efe355e3ce39533649
Reviewed-on: https://go-review.googlesource.com/12303
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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.
Fixesgolang/go#11672.
Change-Id: Iaf867913eaa1311519a4d5a7a8169228ebf21346
Reviewed-on: https://go-review.googlesource.com/12128
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
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>
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>
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>
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>
Change-Id: I415a6c4693be340ff8236d5f56c3c00fa95ce2e0
Reviewed-on: https://go-review.googlesource.com/6822
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Change-Id: Iaaf72a06cc64e50e62c9282c95ab28317e4c915a
Reviewed-on: https://go-review.googlesource.com/4740
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: Ia325048a565ece9f606363869fb4e27e04c7513a
Reviewed-on: https://go-review.googlesource.com/4741
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
Change-Id: I8c74a3fd52e0978349061c53dd3305174ea441ee
Reviewed-on: https://go-review.googlesource.com/4580
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
Change-Id: I52dcc241e340813ff2cc575c42d92c59bef91ce1
Reviewed-on: https://go-review.googlesource.com/4410
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
Change-Id: I879e51834726c8713c5befeb4be2e328d5295af4
Reviewed-on: https://go-review.googlesource.com/4110
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I792edeed6bf8309084281eebcdba7d4b6c6a0818
Reviewed-on: https://go-review.googlesource.com/4181
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
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>
Change-Id: Ibbdd19990ecb64535baa55f81bbe7f2abcf118fd
Reviewed-on: https://go-review.googlesource.com/2653
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: Ieac721b486155679f3de2baa13c69d50d63dce3b
Reviewed-on: https://go-review.googlesource.com/2652
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>