2
0
mirror of synced 2025-02-23 14:58:12 +00:00

1115 Commits

Author SHA1 Message Date
Hilário Coelho
eae5320c54 bind: added protocol documentation to Objective-C generated file
Fixes golang/go#46956

Change-Id: Ifa1b8e7f2a0e46034f0eccc32249f69a064199e3
GitHub-Last-Rev: 175fa08b1696fca4c11b35b691e0df550ed66864
GitHub-Pull-Request: golang/mobile#67
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/331429
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-18 03:50:03 +00:00
Changkun Ou
50dca8fc07 cmd/gomobile: tidy a few unused code and variables
Change-Id: I979589adf74ec0cd097ef7acc6c120f6557c8f25
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/369201
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-05-04 14:47:22 +00:00
Russ Cox
ce6a79cf6a all: gofmt
Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: I9b4c287e2d25aa108adfa9fe2f972c8fd3d68fe1
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/399597
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-04-14 15:34:00 +00:00
Changkun Ou
e579adbbc4 app: allow app.Main to return on Windows
Fixes golang/go#49499

Change-Id: Ia65b61b9e0707321439ea85d06bac5ed507b58c7
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/369196
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Changkun Ou <mail@changkun.de>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-07 11:11:46 +00:00
Hana (Hyang-Ah) Kim
447654d348 example/ivy: update robpike.io/ivy/mobile to 0.2.7
Change-Id: I0db9c1396f003eca30196aab14523d1cf7b85197
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/388375
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-25 16:17:04 +00:00
cuishuang
55113b94f0 mobile: fix some typos
Change-Id: Iaffde6f90b92b1f8b96c76d2bc3d8c312ebb764f
GitHub-Last-Rev: 7413e9537adc1626c76386cf2d47188eeed8342e
GitHub-Pull-Request: golang/mobile#76
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/390014
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-03-07 22:04:22 +00:00
Hana (Hyang-Ah) Kim
8a0a1e5073 example/ivy/android: update app version (1.4.0)
Add mavenCentral to repositories
needed to pull in necessary build tools dependencies

Change-Id: I9b8525430d4ba9535ad0d3bc6b4acd94f6ea0642
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/360835
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
2022-02-24 13:45:51 +00:00
Zaiyang Li
032b21455f cmd/gomobile: add missing latest tag to gobind
Go install requires a version to be provided after the package name.
gomobile init command is updated to reflect this new requirement

Fixes golang/go#50994

Change-Id: I014bd6815d9620415ceb43dd7e0aea3afac60556
GitHub-Last-Rev: 3a07fa669175c34b5948de4abe74ab9092c83934
GitHub-Pull-Request: golang/mobile#75
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/384414
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-23 14:21:00 +00:00
Changkun Ou
4f294b3ab5 app: resolve build warnings
iOS builders fail to build the mobile repository because of compile
warnings.

1. "go build golang.org/x/mobile/app" can result in build error because
   of the warning "missing [super prepareOpenGL] call".

2. "null passed to a callee that requires a non-null argument" because
   argv is expected to not be a null argument.

Resolve these warnings.

Change-Id: I86130abc3a104be388475f5c316f5c3aef13aa92
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/387094
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Run-TryBot: Changkun Ou <mail@changkun.de>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-02-23 14:12:36 +00:00
Hana
858099ff78 cmd,bind: add implicit dependencies
cmd/gomobile depends on cmd/gobind. Code generated by cmd/gobind
depends on packages under golang.org/x/mobile/bind. Explicitly
list those (with build tags) so the go command can take into account
these implicit dependencies (e.g. go mod tidy or go mod vendor).

We use tag `mobile_implicit`.

Updates golang/go#43736

Change-Id: I09c519556ffe8e8c4db0754571c5173b1613c210
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/377754
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-01-12 01:59:53 +00:00
Hajime Hoshi
4a8be17bd2 all: add go:build comments for .m and .c files
Change-Id: I24fbde8ec50be43000b9fcf3e7801f1ad25238cb
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/374498
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-01-04 18:42:38 +00:00
Hajime Hoshi
5579029ea0 all: add -DGLES_SILENCE_DEPRECATION instead of #define
Defining GLES_SILENCE_DEPRECATION did not take any effects. Use -D
instead.

Change-Id: I9c0602b38d39020b9539fdb8030fef3a7b366929
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/374499
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-01-04 18:42:24 +00:00
Hajime Hoshi
cde37c62e1 all: add GLES_SILENCE_DEPRECATION to suppress warnings
Change-Id: I8544e7cd8c4e3d2b71fd1850f7043eabe25231d0
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/374497
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-01-04 17:11:26 +00:00
Changkun Ou
4e6c2922fd cmd/gomobile: remove binary XML
It is a full of unused code. Remove it.

Change-Id: I086f244adde57c8c9f1fc73b46e25550f15562f7
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/369197
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-07 04:14:40 +00:00
Changkun Ou
3d43a2788e app: remove outdated TODO of app termination
This was resolved in CL 11733. The "C.stopApp()" triggers the
termination of an app.

Change-Id: I48d4b798e42bc0c8b780ed5c0ec50968b62d0afa
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/369199
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-12-07 04:14:20 +00:00
Changkun Ou
29d5ad490c cmd/gomobile: remove outdated TODO of bundle ID
The TODO message was introduced in CL 13041, but later resolved
in CL 77070 because it allows bundle id customization.

Remove the oudated TODO message.

Change-Id: Ib32793ace937f67b5c95d6efadd6d4eef48a8986
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/369200
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Alex Rakoczy <alex@golang.org>
Run-TryBot: Alex Rakoczy <alex@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-07 04:13:54 +00:00
Changkun Ou
1ab90197b3 example/ivy/ios: turn off quoted include warning from clang
Taking the same approach from the widely used CocoaPods who had facing
the same issue since Xcode 12. See discussion:
https://github.com/CocoaPods/CocoaPods/pull/9905

Fixes golang/go#48677

Change-Id: I92584e6cf87e34747db3ce32cda837d55e5f8b2c
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/369198
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-12-06 11:45:35 +00:00
Changkun Ou
fea317f4e1 cmd/gomobile: use LLVM binutils if GNU binutils are missing
Starting from NDK 23, GNU binutils are fully migrated to LLVM binutils.
Use LLVM if GNU binutils are missing.

Fixes golang/go#49808

Change-Id: Iccb40780390a66081fc811d717c7357194b92acf
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/369195
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-12-06 11:09:38 +00:00
Bryan C. Mills
d61a72f26a example/ivy: add a "// +build" comment in tools.go
The modules in x/mobile are still tested under Go 1.16, which emits a
vet warning for files that have "//go:build" constraint comments
without matching "// +build" comments.

This fixes a build failure observed on the Go dashboard:
https://build.golang.org/log/2925343437d0c0559bcfa9d9de740a3a1aef2dc3

Change-Id: Ic0e3ed151a2ea3262d853c4e22cf042d54230ede
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/362575
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-11-09 19:11:25 +00:00
Bryan C. Mills
198acf5f4f app: add missing header for XVisualInfo and other X11 declarations
Without this header, the x/mobile build fails on my workstation.
(Compare CL 359695 in x/exp.)

Change-Id: If32fe6bc2945d31fed5cffca5e347970b344e40e
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/362574
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-11-09 19:10:59 +00:00
robaho
e68c98865f example/ivy/ios: format code according to Google style guide
Change-Id: I4cef2b60756b3318c123b832bcdb719d2d45fadc
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/360607
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-03 15:16:57 +00:00
robaho
2ab7fee9df example/ivy/ios: enable return to continue demo
Change-Id: I189cd6b4953aeb988dfb1d28662f228508d463ff
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/360379
Reviewed-by: Rob Pike <r@golang.org>
Trust: Rob Pike <r@golang.org>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-02 00:03:17 +00:00
robaho
170e11ba23 example/ivy/ios: enable demo functionality
And bring iOS app up to Android capabilities.

Fixes golang/go#48694

Change-Id: I0e853cab102e34053ecdb17edb99644aa2f8651a
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/357977
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Peter Weinberger <pjw@google.com>
2021-10-30 03:09:00 +00:00
Hana (Hyang-Ah) Kim
7b8bfe0993 example/ivy/android: remove prompt symbol
Now the user input is printed in bold, so it is obvious even with
out this dummy prompt-like symbol. This makes the output more like
the desktop version of Ivy tool.

Change-Id: I146685815ceb52aa5da6ddaa64f764e43839ffa9
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/356733
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
2021-10-29 12:31:40 +00:00
Hana (Hyang-Ah) Kim
93c5f8af85 example/ivy/android: fix demo to handle comments & 'quit' correctly
Demo feature is implemented by reading the demo.ivy file included
as an asset, read lines, and feed each line to mobile.Eval if it
is not a comment line. Comments can start from the middle of a line
so previously, the code simply looked for '#' in each line and
treated the substring starting from it as a comment. This assumption
is not correct - see ")format '%#x'". Without proper parsing, it is
hard to do it correctly. This CL passes the entire line to Ivy as
it is - the backend correctly parses the line with comments.
One drawback of this change is, unlike the line comments, we don't
apply the style for comments (gray font). But correctness is more
important. This also simplifies the code.

This CL implements the 'quit' command that terminates a demo
session (as mentioned in the demo.ivy script).

Change-Id: Ib0801338e0dd34c52c6c6209fe47a1846e71f0c8
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/356732
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
2021-10-29 12:31:31 +00:00
Hana (Hyang-Ah) Kim
d263badac8 example/ivy/android: use escapeHtmlTags in ivy output processing
Android App emulates terminal-like functionality in WebView by
appending the input and output lines of Ivy to the WebView HTML
document as a new div entry using javascript. The app used
Android's TextUtils.htmlEncode to get HTML escaped representation
of the input and output. Among those escaped characters, `&` is
included (HTML entity prefix).

Ivy's mobile.Eval returns lines that include HTML entities (e.g.
&#92; instead of backslash -- see
https://github.com/robpike/ivy/blob/master/mobile/mobile.go#L43)
TextUtils.htmlEncode escapes this `&` and as a result, the backslash
is left broken.

escapeHtmlTags is identical to TextUtils.htmlEncode except it
leaves the entity alone.

Change-Id: Ifec401f07b46f4c6aee6d8df7d61933ae8dbc666
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/356731
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
2021-10-28 16:12:33 +00:00
Hana (Hyang-Ah) Kim
3e409eeb21 example/ivy/android: use monospace & pre-wrap for WebView text formatting
Output from ivy is carefully formatted to work best in terminal.
Use of monospace & pre-wrap white space make table-format output look nicer.

Change-Id: If11fd57c8e685c01825fb1c2dd8b6d24fe860850
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/356730
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Peter Weinberger <pjw@google.com>
2021-10-28 16:11:54 +00:00
Hana (Hyang-Ah) Kim
eb3c0abee2 example/ivy: make ivy as a separate module, and update to use AndroidX
golang.org/x/mobile/example/ivy module specifies dependency on
golang.org/x/mobile and robpike.io/ivy versions.

- Updated to use AndroidX and target API level 30 to meet
the current Google Play policies
https://support.google.com/googleplay/android-developer/answer/9859152?visit_id=637402646062706504-1797308153&rd=1#targetsdk&zippy=%2Ctarget-api-level-requirements-for-play-console
- Updated demo.ivy script (copied from 66c48de6eb/demo/demo.ivy)
- Added example/ivy/android/README.md

Change-Id: Ie613ecdba4c3d77b5c45ef8a792fba6ee8a2c5cf
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/356729
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-10-27 13:47:44 +00:00
Hana (Hyang-Ah) Kim
122ae57121 go.mod: update golang.org/x/tools@316ba0b
We plan to move example/ivy to a separate module by adding go.mod
in the directory. That change will break gobind tests that depend
on golang.org/x/tools/packages/packagestest which didn't handle
nested module directories. Update the dependency to pick up the fix
(https://go-review.googlesource.com/c/tools/+/358037)

Change-Id: Ie333093a7f48e50623738ff7c18748161ce62175
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/357617
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
2021-10-27 13:47:05 +00:00
wmdngngng
1c027f395e cmd/gomobile: fix header padding computation in apk generation
fix file data align to 4

Change-Id: Ie88c46521e216b3f83a8dc3495591cd19bce83c6
GitHub-Last-Rev: aebf3cd7ff0d77050659e9269f7eddaeff364eff
GitHub-Pull-Request: golang/mobile#73
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/351789
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-24 03:28:53 +00:00
Randy Reddig
b5eb1abba0 example: updates for XCFramework and Mac Catalyst
This updates examples for the changes in golang.org/cl/334689 for
.xcframework files and Mac Catalyst.

Depends on golang.org/cl/334689

https://go-review.googlesource.com/c/mobile/+/334689/28/example/bind/ios/README#1

Change-Id: Ice89e7e675c8f190c7040407908f619a7631fd2b
GitHub-Last-Rev: 64da8e6cad76f3e0530e36895bbfeacab7439b35
GitHub-Pull-Request: golang/mobile#72
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/350489
Reviewed-by: Changkun Ou <euryugasaki@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-22 14:22:29 +00:00
Changkun Ou
b17b856605 cmd/gomobile: embed teamID into Xcode project settings
The default Xcode project settings do not specify any team ID.
If we open the Xcode project in Xcode, it won't compile and deploy
the app directly via Xcode unless a user manually selects the team
account. This is an extra effort. Since we can detect team ID
automatically embeds the teamID directly into the project settings
so it better helps the user to compile and deploy apps without getting
into the project settings.

Change-Id: I268653f66280bb6cf013f0a28891e4382e4de576
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/351409
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-09-22 14:04:04 +00:00
Randy Reddig
6d8ad35e46 cmd/gomobile: improve support for macOS and Catalyst
This is is a follow-up from my previous PR (#65). It makes gomobile
aware of GOOS=ios and adds support for specifying specific Apple
platforms, instead of overloading the "ios" platform.

Supported platforms: ios, iossimulator, macos, and maccatalyst

These can now be specified the -target argument to gomobile, e.g.:
gomobile build -target=ios,iossimulator,macos,maccatalyst

It preserves the current behavior of -target=ios, which will build for
ios and iossimulator on supported architectures (arm64 and amd64).

It adds platform-specific build tags so Go code can discriminate between
different Apple platforms like maccatalyst (UIKit on macOS).

This PR also fixes a number of broken tests.

TODO: cgo has a bug where c-archive builds targeting Catalyst will fail
unless -tags=ios is supplied. See https://golang.org/issues/47228

Fixes https://golang.org/issues/47212
Updates https://golang.org/issues/47228

Change-Id: Ib1a2f5302c5edd0704c13ffbe8f4061211f50d4e
GitHub-Last-Rev: 01ab28e63fe6890a9f9783e3fc41b1c895b0274d
GitHub-Pull-Request: golang/mobile#70
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/334689
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
2021-09-17 18:55:23 +00:00
Changkun Ou
5d9a33257a example/ivy: make ivy work again
This CL allows a (super) outdated Xcode project - the Pob Pike's Ivy
work again and can compile and run on the latest iOS (tested on iOS 15
beta 8).

There are some changes to the project that might be worth mentioning:

- The UIWebView is deprecated in iOS 10, this CL migrates the code to
use the latest recommended WKWebView.
- The old project does not compatible with iOS 9 and later, the CL upgrades
the development target to iOS 14, and makes it compatible with all
all orientation (Portrait, landscape, upside down).
- The old Launch.storyboard is deprecated, the Main.storyboard cannot
be opened (will cause Xcode crash), this change slightly reworked on
the UI management, and merges the purpose of Launch.storyboard as well
as Main.storyboard into the single Main.storyboard.
- Injects a meta tag into the HTML header so that the fonts are properly
scaled on (very) high-resolution display.
- The app is not only tested on a simulator but also physically tested
on an iPhone 12 Pro.

See screenshots:

- iOS Home: https://changkun.de/midgard/img/ivy-ios-home.png
- iOS Help: https://changkun.de/midgard/img/ivy-ios-help.png
- Mac Home: https://changkun.de/midgard/img/ivy-mac-home.png
- Mac Help: https://changkun.de/midgard/img/ivy-mac-help.png

Change-Id: I1b8dec6b17d5722fddb1011453b3c8f86e4900e4
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346949
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-09-02 10:41:08 +00:00
Changkun Ou
ddd6497b06 cmd/gomobile: enable bitcode unconditionally
As discussed in CL 346150, conditional bitcode build flag was introduced
in CL 214899, for Go >= 1.14 but not Go 1.13.

Since we have dropped the support for 1.13, all bitcode conditions
can be removed.

Hence this CL removes it.

Updates golang/go#47952

Change-Id: I0436cad8d5ab5675b647e25e7dfa85af85996a7e
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346390
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-09-01 16:06:15 +00:00
Changkun Ou
80cb72e7af cmd/gomobile: use GOOS=ios for iOS builds
This change permits gomobile to build iOS applications by properly
set GOOS=ios in the build process. The change is locally tested on
darwin/arm64, and golang.org/x/mobile/example/basic can be build
using the following commands:

gomobile build -target=android -o=basic.apk \
golang.org/x/mobile/example/basic

gomobile build -target=ios -bundleid=org.golang.gomobiletest \
-o=basic.app golang.org/x/mobile/example/basic

The built binaries are also tested on iOS 15 beta7 and Android 12 API31.

Updates golang/go#47952
Fixes golang/go#47238

Change-Id: Ibf40a77933ac957640c78d0dbc1af043477e4b3a
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346150
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-01 15:58:30 +00:00
Changkun Ou
a0f9ae51e3 cmd/gomobile: allow tests to pass on ios builder
There are several tests are skipped for Android but they may still be
tested on iOS. This will leads to trybot failure.

This CL skips those tests and allow them to pass on iOS.

Furthermore, deprecated C function warning are promoted to errors on
builders, this CL also fixes a deprecated asl_log for iOS in mobileinit.

Change-Id: Ie9da57a20dd75ef3d29b393e30aef01051bab454
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346391
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-09-01 15:13:16 +00:00
Changkun Ou
1fde1d6c3c cmd/gomobile: remove unused binary xml
The removed binary XML was introduced in CL 2653 for the TestBinaryXML.
But in CL 16150, the test was reworked and the binary XML was never
used since then.

Delete it.

Change-Id: I80fd90264142bdcd4a6d88a377e36cba64088a5a
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346389
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-09-01 02:52:45 +00:00
Changkun Ou
f7a629369e cmd/gomobile: extract import packages more robust
In darwin/arm64, with Xcode13 toolchain, the nm shows a prefix `_` in
the import path, which was previously not handled.

Such as:

000000010009cd70 t _golang.org/x/mobile/app.(*app).Events
000000010009ce70 t _golang.org/x/mobile/app.(*app).Filter
000000010009cdf0 t _golang.org/x/mobile/app.(*app).Publish
000000010009cd80 t _golang.org/x/mobile/app.(*app).Send
000000010009d870 t _golang.org/x/mobile/app.(*app).loop
000000010009d7f0 t _golang.org/x/mobile/app.(*app).loop.func1

This change fixes the regexp for import package extraction and permits
TestRegexImportGolangXPackage to pass.

Change-Id: I5f8b02177c8b022283276f2ddffaa8bb277aa255
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346154
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-31 18:40:57 +00:00
Changkun Ou
9cba7bc03c cmd/gomobile: handle NDK path for darwin/arm64
This change allows TestBindAndroid to pass.

Fixes golang/go#46464

Change-Id: I8cc3edb21fe9ae9efdc0c8c243a4098553b06e5e
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346153
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-31 15:17:48 +00:00
Changkun Ou
d82874c7e6 cmd/gomobile: fix flaky TestNdkRoot test
The current TestNdkRoot may fail if ANDROID_HOME and ANDROID_NDK_HOME
are both set from the environment. This is because ndkRoot will first
check ANDROID_HOME, if fails, then check ANDROID_NDK_HOME.

The test was intended to reset the ANDROID_HOME and expecting an error
for fetching ANDROID_NDK_HOME. However, if ANDROID_NDK_HOME is set,
the ndkRoot will not return an error, which may fail the test.

This change moves the environment settings around to permit TestNdkRoot
to pass.

Change-Id: I17ce6dbeec186d35f7a4ba2d8275a43a862c306d
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346152
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-31 15:17:20 +00:00
Changkun Ou
18b1a0c48f cmd/gomobile: use Apple Development over iPhone Developer
Apple Development Program was introduced in WWDC2015. It is 2021 today,
and there should have no possibility to use iPhone Developer certificate
for code signing.

This CL replaces "iPhone Developer" by "Apple Development" so that
cmd/gomobile can use the correct certificate to sign the building
application. Otherwise, gomobile throws an error gomobile: failed to
pull the signing certificate to determine your team ID: exit status 44

Updates golang/go#47238

Change-Id: Ia48c03ff7cda39a95159e0f77e7ba7042776f9ef
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346151
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-31 15:17:05 +00:00
Hajime Hoshi
34ab1303b5 Revert "cmd/gomobile: support macOS and Catalyst"
This reverts commit 76c259c465ba39f84de7e2751a666612ddca556b.

Reason for revert: Regression. Specifying architectures doesn't work. See golang/go#47212

Change-Id: I3200316cf28535cfb48e37636bc3b9d14d13e91e
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/334590
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-07-16 00:47:57 +00:00
Randy Reddig
76c259c465 cmd/gomobile: support macOS and Catalyst
Add support for macOS (non-Catalyst) and Catalyst targets.

The compiled library is packaged into a "fat" XCFramework file (as
opposed to a Framework), which includes binaries for iOS, macOS,
MacCatalyst (iOS on macOS), and iOS Simulator targets, for amd64 and
arm64 architectures.

The generated XCFramework file is suitable for distribution as a binary
Swift Package Manager package:
https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages

This change is based on earlier work:
https://github.com/golang/mobile/pull/45
https://github.com/golang/mobile/pull/63

Fixes golang/go#36856

Change-Id: Iabe535183c7215c68838d6c8f31618d8bceefdcf
GitHub-Last-Rev: 623f8f38653c856d2cd07e721f0932e515b50d02
GitHub-Pull-Request: golang/mobile#65
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/310949
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-10 06:49:35 +00:00
Hajime Hoshi
93619952ba cmd/gomobile: enable the test for gomobile-build on iOS
As golang/go#32963 has been fixed, gomobile-build test on iOS now
works.

Updates golang/go#32963

Change-Id: I96add914d1f97de6506f26e4ae0c07e8c884cb6a
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/214957
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-07-01 03:20:07 +00:00
Joseph Morag
7c8f154d10 cmd/gomobile: remove unnecessary IsDir check
The check when looking for android platform is unnecessarily stringent
in that the error would be caught by the call to os.Stat, and
it fails when the android platform folder is a symlink,
which is the case when developing on NixOs.

Change-Id: I07a96c969ffa29dea8bf8e353264e8597dcdc550
GitHub-Last-Rev: c684b80402ad30ad52eb854951aab69657ad7a5d
GitHub-Pull-Request: golang/mobile#55
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/267081
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2021-06-14 20:29:36 +00:00
Jay Conrod
7e972142eb all: update golang.org/x/tools to v0.1.2
This should fix an incompatibility between
golang.org/x/tools/go/packages/packagestest and Go 1.17.

Fixes golang/go#46418

Change-Id: If1416f53685632d705e7814354f792eb30de88a2
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/323149
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-27 17:15:05 +00:00
Russ Cox
bdb1ca9a1e all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I30822eb504168b037ed3ec0f7759da1f41251f52
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/294374
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-20 03:30:13 +00:00
Than McIntosh
f462b3930c app: support C compiler that defaults to -fno-common
For the Android NDK, between r21 and r22 the NDK compiler switched the
default from "-fcommon" to "-fno-common", which causes duplicate
definitions when building the examples given the current C code. To
fix things, rework the C code to insure that we have a single
definition and an "extern" reference to the objects in question.

Updates golang/go#44121.

Change-Id: If198d5cfd977a7cfd1a37652d3a1916d8c8dbcb7
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/290031
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Than McIntosh <thanm@google.com>
2021-02-08 17:11:26 +00:00
Hajime Hoshi
e4a08af010 cmd/gomobile: create go.sum at the temporary directory
As of Go1.16, `go build` fails if go.sum does not exist. This change
fixes this issue by forcing to create go.sum by calling `go mod tidy`.

Closes golang/go#44162

Change-Id: Ibba738503d1a58c6533b2427dd4efa6954b8eaa3
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/290409
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Than McIntosh <thanm@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-02-08 16:36:35 +00:00