Skip to content

Commit

Permalink
fix: resolved gomobile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
baizon committed Jul 27, 2024
1 parent e1e9f28 commit 06ace7a
Show file tree
Hide file tree
Showing 121 changed files with 44,617 additions and 6 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ envinit:
go install github.com/vektra/mockery/v2@latest
go install github.com/matryer/moq@latest
go install golang.org/x/tools/cmd/goimports@latest
go install golang.org/x/mobile/cmd/gomobile@latest
# The gomobile/gobind libs are also needed when using `gomobile bind`, but it's not compatible with vendoring:
# https://github.com/golang/go/issues/50994#issuecomment-1032754206
GO111MODULE=off go get -u golang.org/x/mobile/cmd/gomobile
# TODO: replace with golang.org/x/mobile/cmd/gomobile@latest once https://github.com/golang/mobile/pull/105 is merged.
go install github.com/baizon/mobile/cmd/gomobile@latest
gomobile init
# Initializiation on MacOS
# - run make from $GOPATH/src/github.com/BitBoxSwiss/bitbox-wallet-app
Expand Down
1 change: 1 addition & 0 deletions android-env.mk.inc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export ANDROID_SDK_ROOT := /opt/android-sdk
export ANDROID_NDK_HOME := /opt/android-sdk/ndk/21.2.6472646
export GOMODCACHE_ROOT := /tmp/gomodcache/pkg/mod
4 changes: 2 additions & 2 deletions backend/mobileserver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ include ../../android-env.mk.inc
# Probably a variation of https://github.com/golang/go/issues/27234 - solution is to build it using vendored deps
# by turning off GO111MODULE. See also: https://github.com/golang/go/issues/34181#issuecomment-640260162
build-android:
GO111MODULE=off ANDROID_HOME=${ANDROID_SDK_ROOT} gomobile bind -x -a -ldflags="-s -w" -target android .
GOMODCACHE=${GOMODCACHE_ROOT} ANDROID_HOME=${ANDROID_SDK_ROOT} gomobile bind -x -a -glflags="-mod=mod" -ldflags="-s -w" -target android .
build-ios:
GO111MODULE=off gomobile bind -x -a -ldflags="-s -w" -target ios,iossimulator .
GOMODCACHE=${GOMODCACHE_ROOT} gomobile bind -x -a -glflags="-mod=mod" -ldflags="-s -w" -target ios,iossimulator .
clean:
rm -f mobileserver.aar mobileserver-sources.jar
9 changes: 9 additions & 0 deletions backend/mobileserver/implicit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file imports implicit dependencies required by generated code.

package mobileserver

import (
_ "golang.org/x/mobile/bind"
_ "golang.org/x/mobile/bind/java"
_ "golang.org/x/mobile/bind/objc"
)
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ require (
github.com/stretchr/testify v1.9.0
go.etcd.io/bbolt v1.3.10
golang.org/x/crypto v0.25.0
golang.org/x/mobile v0.0.0-20240716161057-1ad2df20a8b6
golang.org/x/net v0.27.0
)

// TODO: remove once https://github.com/karalabe/hid/pull/52 is merged.
replace github.com/karalabe/hid => github.com/benma/hid v0.0.0-20240312170000-f050ee197113

// TODO: remove once https://github.com/golang/mobile/pull/105 is merged.
replace golang.org/x/mobile => github.com/baizon/mobile v0.0.0-20240727101751-72327cc1b4a9

require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/aead/siphash v1.0.1 // indirect
Expand Down Expand Up @@ -54,8 +58,10 @@ require (
github.com/tklauser/numcpus v0.8.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
Expand Down
67 changes: 67 additions & 0 deletions go.sum

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions vendor/golang.org/x/mobile/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions vendor/golang.org/x/mobile/PATENTS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions vendor/golang.org/x/mobile/bind/bind.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 06ace7a

Please sign in to comment.