Commit Graph

424 Commits

Author SHA1 Message Date
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
Meir Fischer 7fb893ba43 mobile/exp/audio: use correct indefinite article prior to PCM
There is currently one usage of "an" prior to "PCM". The indefinite
article usage prior to an acronym is determined by the
pronunciation of that acronym's first letter. If the pronunciation
starts with a consonant, "a" is used. If the pronunciation starts
with a vowel, "an" is used.

Usage
https://en.wikipedia.org/wiki/Pulse-code_modulation

Note that there is currently a correct usage in the same file on a
different line: "a PCM header"

Change-Id: Id7749d20722a5cc9b96ecfe466be66fe3c76ab2b
Reviewed-on: https://go-review.googlesource.com/12083
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-13 15:00:26 +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 adcf40b30c exp/audio/al: avoid creation of multiple contexts
This CL reverts the changes made in golang/go#11299.

Allowing creation of multiple contexts break the case of multiple
third party packages depending on the al bindings. These packages
need to make sure that there is a valid current context or initiate
and make a context current. Packages racing to create and make a
context current is what we would like to avoid.

Therefore, al bindings will support only a single context that is
initiated during OpenDevice.

Fixes golang/go#11385.

Change-Id: I662f70e49d12833a545005cf0724cc21f67bea09
Reviewed-on: https://go-review.googlesource.com/12001
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-11 16:23:18 +00:00
Elias Naur ca1abe50ca x/mobile/internal/mobileinit: revert Android log prefix
CL 11981 changed the Android logcat prefix from "GoLog" to "GoStdio".
Revert the prefix to "GoLog".

Also remove a global variable left unused by CL 11981.

Change-Id: I500313652cd618d8573640d5165e5069a0ba0ba7
Reviewed-on: https://go-review.googlesource.com/11991
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-11 11:50:45 +00:00
Elias Naur 5aee943213 x/mobile/bind: remove debug print
Android support has advanced to the point where this logging statement
adds very little information.

Change-Id: I3c8c9d60be8c0b52a519f9e44711bd211b5bfe67
Reviewed-on: https://go-review.googlesource.com/11990
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-10 17:08:45 +00:00
Hyang-Ah (Hana) Kim c68947979f example/network: a simple example to show AndroidManifest customization
Change-Id: I558925eca6be12772726cfff96b48fd4c6bbc303
Reviewed-on: https://go-review.googlesource.com/11892
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-07-09 17:52:27 +00:00
David Crawshaw 960fedd178 internal/mobileinit: new package for shared logic
Package app contains some logic that we want to share with
gobind-based libraries. So move it to a new internal package
that both can import.

Long term the log changes should be in the standard library,
but the Go tree is currently frozen.

Fixes golang/go#11630.

Change-Id: I9ff622fc499bf255bce18df23cb68b03f667947f
Reviewed-on: https://go-review.googlesource.com/11981
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-08 21:29:11 +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 28e6297551 app: update package docs for gomobile and events
Change-Id: I96e0e5fe7d5de9c04aee049b88efed4964fefc0d
Reviewed-on: https://go-review.googlesource.com/11921
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-07 11:34:25 +00:00
Hyang-Ah (Hana) Kim a922dd97b1 bind/objc: remove '_' after Go<pkgname> prefix from names.
Before this change, func Hello() of mypkg package generated a function
GoMypkg_Hello to distinguish the prefix from the function name.
It seems the use of '_' is very rare in Objective-C though.
After this change, it generates GoMypkgHello.

Change-Id: Ic7aa2b667363a447a5ff3500262502d3137d6853
Reviewed-on: https://go-review.googlesource.com/11893
Reviewed-by: Damien Neil <dneil@google.com>
2015-07-07 03:29:17 +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 ddd9618c5b app: darwin/amd64 rendering improvements
The full set of event.LifecycleStages are now plumbed through.

More user control over the window, in particular it:
- takes focus correctly on start
- can now be closed and minimized
- can be hidden (allowing testing of LifecycleStageAlive)

Flickering during resize has been eliminated by triggering draws from
a second thread. This encouraged the introduction of a dedicated draw
loop in Go, which makes responsibility for GL calls a little more
like android/x11.

Change-Id: I63982f20bd4859601e2a27915f60f6c8083a176f
Reviewed-on: https://go-review.googlesource.com/11733
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-06 06:21:37 +00:00
Nigel Tao 8631054b13 exp/app/debug: fit the FPS counter's aspect ratio to the backing image.
Ever since we moved to a bitmap font instead of using freetype, the backing
image's dimensions are 43x9, not 50x12, and we might as well match. For
example, the output will be exactly 43x9 pixels at 72DPI, or 86x18 pixels at
144DPI, etc.

Change-Id: I99975cc780760b28b73fbf6d55befbe500f1a6e1
Reviewed-on: https://go-review.googlesource.com/11880
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-04 02:53:51 +00:00
Nigel Tao c0fb3fcc1e event: fix the build from a bad merge.
https://go-review.googlesource.com/#/c/11822/3/event/event.go
removed the fmt package dependency, but concurrently,
https://go-review.googlesource.com/#/c/11813/2/event/event.go
introduced new code that relied on fmt already being imported.

Change-Id: Ib5c66bf59850aa49d251778371c4863bfdf54655
Reviewed-on: https://go-review.googlesource.com/11859
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-03 02:19:54 +00:00
Nigel Tao 15dc27054b event: delete TouchType in favor of Change.
Change-Id: I8772c8d2690fbe6b636f1dcafe1393f6810d6716
Reviewed-on: https://go-review.googlesource.com/11822
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-03 01:56:41 +00:00
Nigel Tao f464c65ce4 exp/gl/glutil: fix test for the foo to exp/foo package rename.
Change-Id: I8709146467d15f59433783759a51a1d0a59cdcfc
Reviewed-on: https://go-review.googlesource.com/11857
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-03 01:37:31 +00:00
Nigel Tao 467d8559f2 f32: move to exp/f32.
In the long term, a lot of this package should be removed in favor of the
golang.org/x/image/math/f32 package. The latter is the common location for
matrix types shared across graphics libraries. For example, the
golang.org/x/image/draw package refers to golang.org/x/image/math/f64.

Change-Id: I9d7ccd3cb35912e0d9dc5bd46c919516ea840340
Reviewed-on: https://go-review.googlesource.com/11856
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-03 01:37:12 +00:00
Alan Donovan 616f82b347 bind: fix build broken by API change to golang.org/x/tools/go/types
Fixes golang/go#11509.

Change-Id: Ia54febfa3ef9b589befb09b8f5d79cb6d7f6c4da
Reviewed-on: https://go-review.googlesource.com/11841
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-07-02 12:24:20 +00:00
Nigel Tao bd8fa0d7bb gl/glutil: move to exp/gl/glutil.
Change-Id: I310c365300cb3fbf8a1abb630e26661fa7ef4844
Reviewed-on: https://go-review.googlesource.com/11824
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-01 11:41:50 +00:00
David Crawshaw f02d32beeb event: add String method to LifecycleStage enum
Change-Id: Iaa723e8db258540d60170216430295ac9dee1901
Reviewed-on: https://go-review.googlesource.com/11813
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-01 05:20:26 +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
Nigel Tao c2c03d3a71 asset: add missing copyright header, fix typo.
Change-Id: I86feab77d053d384af74219df371b31a7f5d82f0
Reviewed-on: https://go-review.googlesource.com/11823
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-01 00:10:52 +00:00
David Crawshaw e7a7f32e55 asset: wrong package name
Not part of, but mentioned on golang/go#11424.

Change-Id: I9d9289a67592aa43bcd55e073d8f3b29daa93056
Reviewed-on: https://go-review.googlesource.com/11735
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-30 23:51:02 +00:00
Nigel Tao c7c93d6952 app/debug: move to exp/app/debug.
Change-Id: I97f3585ff155e8c5b95c5bb32cfa793980c81a9a
Reviewed-on: https://go-review.googlesource.com/11821
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 23:41:11 +00:00
Nigel Tao a5abc28279 app: consolidate multiple cgo directives into one.
Change-Id: Ie65251fe24063096cd95645089a222b597f3bd8b
Reviewed-on: https://go-review.googlesource.com/11666
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 23:04:34 +00:00
Nigel Tao 8de8fcfbf7 app/debug, exp/font: remove the freetype dependency.
Change-Id: Id71acfeb605995d8caf947d996a1375335410e08
Reviewed-on: https://go-review.googlesource.com/11668
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 23:03:35 +00:00
Burcu Dogan 3522bcc2e0 asset: add missing license header
Change-Id: Ife81591606a2fadcc216eae0ea17d772b3757cf7
Reviewed-on: https://go-review.googlesource.com/11736
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 17:31:44 +00:00
Burcu Dogan 52ece69162 gitignore: add apk and app to the ignore list
Change-Id: Ie9150aded0ebefd0d6f63e0acdb7b8c06773125f
Reviewed-on: https://go-review.googlesource.com/11586
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 15:15:53 +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
Burcu Dogan 383ad68fc0 exp/audio: APIs should not use Context pointer type
This CL is a followup of CL/11315 where it is suggested to remove
Context pointer types from the signatures.

Change-Id: Ice68bfabad0e345f7d93102257a99402be8760b5
Reviewed-on: https://go-review.googlesource.com/11560
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-30 06:09:10 +00:00
Nigel Tao d06bbc53e4 exp/audio/al: use the standard log library, if al_init fails.
This means that there's only one adb log prefix that Go app developers
need to watch: GoLog.

Change-Id: I562566b92a7bba19f7c7a9cc71315bea02844db1
Reviewed-on: https://go-review.googlesource.com/11609
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-30 06:08:38 +00:00
Nigel Tao 4f45fb5d7f app: remove some unnecessary logging.
Change-Id: Idf0e03e90a9cc2a497c4ac6ebde7a842d5f0a81b
Reviewed-on: https://go-review.googlesource.com/11606
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-30 03:36:16 +00:00
David Crawshaw 8bb4ca139b asset: move app.Open to its own package
This does not break the dependency on the app package's AndroidContext
for loading assets on android. A potential answer for gobind-based
apps: add a SetAndroidContext method to app.Context. But I'll explore
that separately after the long weekend.

Change-Id: I812f899740e288c379eee7900f42d9d53926d4ce
Reviewed-on: https://go-review.googlesource.com/11675
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 21:49:28 +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
David Crawshaw 20f0df5da5 app: darwin/arm{,64} event model implementation
Change-Id: Ie04a58ac090d8916463586b5fadb14c5539a21dd
Reviewed-on: https://go-review.googlesource.com/11640
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-29 11:38:56 +00:00
David Crawshaw 9ed16d2774 app: leave GL buffer clearing to clients
It is already done in our examples and is missing from the linux/x11
implementation. If memory serves this is just long-standing
debugging cruft.

Change-Id: I1919a8704b11502fe8f402e3840bc5a1cd8b16e3
Reviewed-on: https://go-review.googlesource.com/11655
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-29 11:10: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
Nigel Tao d1d3d8a5a0 exp/audio/al: delete a debugging log message.
This was accidentally introduced in
https://go-review.googlesource.com/#/c/11351/

Change-Id: Icc9bc9ccb97e48d376e0da440b72631e605a0a15
Reviewed-on: https://go-review.googlesource.com/11608
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 04:33:40 +00:00