Commit Graph
394 Commits
Author SHA1 Message Date
Diego Romar 98ec64efd2 fix: resolve bind packages using build info instead of packages.Load
This fixes the 'unable to import bind' error when
gomobile-tvos-fork is installed via 'go install' and
used to build packages outside the fork's module context.

The fix uses debug.ReadBuildInfo() to determine where the fork is
installed (either in GOPATH/src or module cache) and constructs
paths to bind packages directly, avoiding the dependency on
packages.Load which requires packages to be in the current
module's dependency graph.
2026-01-29 11:06:16 -03:00
Ashley Mensah 038e034b2c update references to gobind (now gobind-netbird) 2026-01-16 12:44:57 +01:00
Ashley Mensah 543a519937 Updated description text 2026-01-15 11:28:55 +01:00
Ashley Mensah a682d4b4eb Update module path and rename binaries to netbird-specific names
- Changed module path from golang.org/x/mobile to github.com/netbirdio/gomobile-tvos-fork
- Renamed gomobile → gomobile-netbird
- Renamed gobind → gobind-netbird
- Updated all internal imports
- Updated README.md with new installation and usage instructions
2026-01-15 11:17:24 +01:00
Ashley Mensah 82479a7010 Add Apple tvOS support 2025-12-02 12:57:22 +01:00
Caleb JasikandGopher Robot 5c265dc024 cmd/gomobile: pass -a build flag to go build command
The gomobile build command wraps "go build" and parses many build
flags including "-a", but it was not actually passing the "-a" flag
through to the underlying go build command.

The "-a" flag forces a rebuild of packages and dependencies, which
is useful for ensuring clean builds when needed.

Add the missing code to pass the "-a" flag through to the go build
command when buildA is true, matching the pattern used for other
build flags like "-x" and "-gcflags".

Fixes golang/go#76466.

Change-Id: Icf4b8520611a22b1106d6bbd48e75072697b94a6
GitHub-Last-Rev: 92bbebf3e658de5b87675c10a0ca960ba18da7c5
GitHub-Pull-Request: golang/mobile#114
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/724360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2025-11-26 10:19:37 -08:00
cuishuangandGopher Robot 188f512ec8 all: fix some comments
Change-Id: Idd6568edd3910379c0d558fd79679dbdb589fab1
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/713082
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-10-21 08:11:56 -07:00
Iliya LyanandGopher Robot a1d90793fc all: replace deprecated io/ioutil package
Change-Id: Ie22fc00b1382fbf854ce5c2cd617bc9cb1e0c674
GitHub-Last-Rev: 3176a9fecffd48bad69493a188116a4f0961640d
GitHub-Pull-Request: golang/mobile#110
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/674035
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Auto-Submit: Hajime Hoshi <hajimehoshi@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-05-20 11:05:27 -07:00
Dmitri ShuralyovandGopher Robot cd096645fc all: delete obsolete import comments
Import comments were initially used to specify the canonical import path
of a package, to prevent it from being used with a non-canonical path by
accident. The module path in the go.mod file serves that purpose now.

Change-Id: I36ebca191eb996b7254a6d452aa4f8dba88a6f94
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/649383
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
2025-02-18 09:38:27 -08:00
Dmitri ShuralyovandGopher Robot a8bae73673 all: make copyright headers consistent
The standard copyright header at https://go.dev/doc/contribute#copyright
has a single space (also see CL 20022). Also, add it to a files where it
was missed.

Change-Id: I341ce5b5c455efa768b65597c387866e47a6757e
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/649382
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-02-18 09:38:25 -08:00
a87c1cf6cf cmd/gomobile: work around for corrupted build on Mac Catalyst
The problem was observed after Go 1.18.
x/mobile requires go1.22.0+.

Patch from https://github.com/stffabi/go-mobile/commit/e31230fb8e5d45adb0be5b69854b6b9bafb8151f

For golang/go#52299

Co-authored-by: stffabi <stffabi@users.noreply.github.com>
Change-Id: I856c68f60ad7c45acf4ae550a1e66747ef7719db
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/635342
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-12-13 14:13:54 -08:00
Hajime Hoshi 7ff83004ec cmd/gomobile: use Output instead of CombinedOutput at envClang
It dosen't make sense to parse stdout and stderr to get a necessary
information like clang command. Actually envClang sometimes didn't work
correctly due to this.

Fixes golang/go#53316

Change-Id: Ia2c518c44c0003b4f9b50dba85fb971c2ef4340d
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/620315
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-10-16 13:47:51 +00:00
Sander BruensandGopher Robot 755f4ef71b cmd/gomobile: fix error message to reflect current build target
Change-Id: I94b7d1c7029102c252a77f75929066281040b9f2
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/564856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
2024-04-01 22:45:55 +00:00
scosmanandGopher Robot 365c353387 cmd/gomobile: add CFBundleShortVersionString and CFBundleVersion, fixing Apple validation/distribution
An app containing a framework can't be validated and distributed without these two entries in the framework bundle's `Info.plist`.

Using `0.0.epoch` format per discussion here: https://go.dev/issue/66500#issuecomment-2025767017

Tested Xcode 15.3 with:
 - without keys, fails to validate
 - with keys: passing validation, distribution upload, and Apple's server validation ("Ready to test" server check).

Fixes golang/go#66500

Change-Id: I2e0718247301ec7db36f8d85aea81b203ca7848b
GitHub-Last-Rev: 1455c5e8165eecca82a5ab96d7d0c31b36607f7a
GitHub-Pull-Request: golang/mobile#100
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/575115
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-03-29 16:42:31 +00:00
scosmanandGopher Robot 268e6c3a80 cmd/gomobile: produce frameworks which follow Apple's specs per platform, fixing Xcode 15.3 compatibility issues
This patch updates the framework generation code to follow the Apple spec for placing content:
https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle

Previously, we setup the framework in MacOS format, and used symlinks to make it compatible with iOS format. This approach no longer works (it works locally in simulator, but causes signing issues when attempting to upload apps for distribution, or running on real hardware). We now setup the expected bundle format for each platform.

Other benefits:

 - Thirds the size of the xcframework and resulting app binary when distributing the xcframework by zip (common for SPM and other formats). The symlinks resulted in duplicate files after zipping, which made it into the final app.
 - Set MinimumOSVersion, fixing SPM compatibility issue
 - Eliminates the blank Info.plist
 - Initial testing shows this also fixes golang/go#66406 (code signing issues) as a side effect of using the proper format

Testing:

 - Tested all 4 platforms (iOS, simulator, macOS, Catalyst) on Xcode 15.3

Fixes golang/go#66406
Fixes golang/go#66500

Change-Id: I8538989efe67cb0d2d0496087dcbeca923c3dffe
GitHub-Last-Rev: 28dca85888bedcc5eb44d3c74af6b88cf5121914
GitHub-Pull-Request: golang/mobile#98
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/574055
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-03-26 19:53:18 +00:00
scosmanandGopher Robot 19e4cdff46 cmd/gomobile: fix a compatibility issue with Xcode 15.3
This change adds compatibility for Xcode 15.3 to "gomobile bind" for building xcframeworks.

 - New blank Info.plist in the *.framework target root
 - Add CFBundleExecutable and CFBundleIdentifier to the resource level Info.plist

Tested locally on my framework on Xcode 15.3 (fixes issue) and 15.2 (doesn't create new issues).

Would love to get some more folks to try this fix, to make sure it works broadly.

Note: I'm using the framework name as the bundleID. Some chance of collision here, but didn't want to add a required top level cmd parameter. I don't *think* a collision is a serious concern, but I'm not an apple build system expert.

To test:
 - sync my branch
 - build go mobile: `go build` in the `cmd/gomobile` dir
 - Build your xcframework with this version of go mobile: `gomobile bind ... `
 - Launch a project using the xcframework in Xcode 15.3, and run in simulator

Fixes golang/go#66018

Change-Id: I3e8ee99adb09071aa89a541dc97271a44b552ea3
GitHub-Last-Rev: 6277c7d66a26efa8b9ff99dea191eeb7bef136a6
GitHub-Pull-Request: golang/mobile#96
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/572175
TryBot-Result: Gopher Robot <gobot@golang.org>
TryBot-Bypass: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-03-18 14:18:34 +00:00
Hajime HoshiandGopher Robot e2f452493d cmd/gomobile: resolve symbolic links as a workaround for an Xcode bug
On macOS, a temporary directory starts with /var, which is a symbolic
link to /private/var. And in gomobile, a temporary directory is usually
used as a working directly. Unfortunately, xcodebuild in Xcode 15 seems
to have a bug and might not be able to understand fullpaths with
symbolic links. As a workaround, resolve the path with symbolic links by
filepath.EvalSymlinks.

Fixes golang/go#63141

Change-Id: Ieb684223192fc3e354b79dededaecdb0b25937e6
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/530135
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Hajime Hoshi <hajimehoshi@gmail.com>
2023-09-22 14:23:53 +00:00
Hajime Hoshi dc64209e86 cmd/gomobile: add go statements to autogenerated go.mod files
go.mod files are automatically generated in a temporary working
directory in order to resolve dependencies. The go.mod files didn't
include go statements, which means a Go compiler tried to resolve
dependencies in the most conservative way. In this way, some paths could
not be resolved as ambiguous paths (e.g. golang.org/x/exp vs
golang.org/x/exp/shiny).

This CL fixes this issue by giving a go statement to the go.mod files.

Fixes golang/go#62458

Change-Id: Ibabd1974f8cd7a3e01eb89994080e32a7115693a
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/525695
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-06 02:19:30 +00:00
Hajime HoshiandGopher Robot fbe1c053b6 all: update Go version to 1.18
Fixes golang/go#62415

Change-Id: Ica46a62f60b8ebcf6244da98fe4e0643206cb24f
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/525095
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-09-05 14:05:55 +00:00
SuzukihonokaandGopher Robot 3c911d8e3e cmd/gomobile: upgrade minimal javac version to 1.8
Fixes golang/go#59803

Change-Id: I248ab312eedf091bbfd6ebf35c8990fbdf611fbc
GitHub-Last-Rev: c61def7df008265555efa24ef27d262d7fd9b644
GitHub-Pull-Request: golang/mobile#91
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/488555
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2023-05-31 17:31:38 +00:00
cui fliterandGopher Robot e8d11dd0ba cmd/gobind: remove repeated definite articles
Change-Id: Ib2d256f59ec759100f8c25e52acf24547a6528fb
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/489735
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-04-27 22:14:53 +00:00
Hajime Hoshi e0f57694e1 cmd/gomobile: update the doc about the minimum Android SDK version
Change-Id: Ia17aadf683b8e3e918e0490b9b3bf4f6ae48d813
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/472236
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
2023-03-01 16:31:55 +00:00
Hajime Hoshi b36e624617 cmd/gomobile: concurrent build for iOS archive files
This change makes building archive files for iOS concurrent for each
architecture and each platform. The strategy is basically the same as
my previous CL for Android: https://go.dev/cl/426274.

This change also specifies GOMODCACHE explicitly when executing Go
commands so that the existing cache is always used. The default
GOMODCACHE is $GOPATH/pkg/mod, and this path varies when a temporary
GOPATH is specified, which results in cold cache.

Before this change (on my MacBook Pro 2020):

$ time go run ./cmd/gomobile/ bind -target ios ./example/bind/hello/

real    0m23.274s
user    0m15.751s
sys     0m10.469s

After this change:

$ time go run ./cmd/gomobile/ bind -target ios ./example/bind/hello/

real    0m8.059s
user    0m13.763s
sys     0m9.004s

Updates golang/go#37902
Updates golang/go#54770

Change-Id: Iaeb077b58c22ab63d28f78972a0af76660883a05
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/442195
Reviewed-by: Changkun Ou <mail@changkun.de>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-10-20 08:52:26 +00:00
Hana (Hyang-Ah) KimandHajime Hoshi 406ed3a7b8 cmd/gobind: do not compile package just to find package dir
Gobind utilizes golang.org/x/tools/go/packages.Load to find
the directory of a package. Configure the load configuration
to just find the list of files. Zero load mode is equivalent
to combining NeedName+NeedFiles+NeedCompiledGoFiles bits.
That is unnecessary, and can increase the chance of load
failures. For example, load with the zero load mode may fail
if all the necessary cgo dependencies aren't available in the
system, but that shouldn't be critical for gobind's use case.

Updates golang/go#56292

Change-Id: Ifaf4f43e9053cf4a43fd657a9a394fc13f611576
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/443935
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-10-19 14:23:27 +00:00
Bryan C. MillsandGopher Robot 3eb82726e4 cmd/gobind: exec the test binary as gobind and log only stderr by default
Using the test binary as the "gobind" command not only avoids the
overhead of recompiling the command, but also allows commands like "go
test -race" to actually test the requested configuration of the
command.

Logging stderr and stdout separately — and logging only stderr by
default — makes the failure messages much easier to spot. (Logging the
combined output as before produced a massive wall of text that tends
to bury the actual errors.)

For golang/go#56292.

Change-Id: Ia11fad19418d9b9004608c76fe512ceab4f247bc
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/443655
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-10-18 19:01:30 +00:00