Skip to content

Commit

Permalink
Merge commit 'refs/pull/2760/head' of https://github.com/BitBoxSwiss/…
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Aug 26, 2024
2 parents 4b318b8 + eac3a04 commit bdf270c
Show file tree
Hide file tree
Showing 134 changed files with 44,649 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
# https://docs.github.com/en/packages/guides/pushing-and-pulling-docker-images
#
# Keep this in sync with default in scripts/github-ci.sh.
CI_IMAGE: ghcr.io/bitboxswiss/bitbox-wallet-app-ci:23
CI_IMAGE: ghcr.io/bitboxswiss/bitbox-wallet-app-ci:24
GITHUB_BUILD_DIR: ${{github.workspace}}

jobs:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Install Node.js
uses: actions/setup-node@v4
with:
Expand Down
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# options for analysis running
run:
go: "1.21"
go: "1.22"

# default concurrency is a available CPU number
concurrency: 4
Expand Down Expand Up @@ -86,6 +86,8 @@ linters:
- wsl
- execinquery
- ireturn
- copyloopvar
- intrange
- wrapcheck
- varnamelen
- tagliatelle
Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ 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 go install golang.org/x/mobile/cmd/gomobile@latest once https://github.com/golang/mobile/pull/105 is merged.
git clone https://github.com/BitBoxSwiss/mobile.git && cd /tmp/mobile/cmd/gomobile && go install .
gomobile init
# Initializiation on MacOS
# - run make from $GOPATH/src/github.com/BitBoxSwiss/bitbox-wallet-app
# - additional dependencies: Qt 5.15 & Xcode command line tools
# - add to $PATH: /usr/local/opt/go@1.21/bin
# - add to $PATH: /usr/local/opt/go@1.22/bin
osx-init:
./scripts/osx-brew.sh
$(MAKE) envinit
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The below instructions assume a unix environment.

To build the app or run the development workflow, the following dependencies need to be installed:

- [Go](https://golang.org/doc/install) version 1.21
- [Go](https://golang.org/doc/install) version 1.22
- [Node.js](https://nodejs.org/) version 20.x
- [NPM](https://docs.npmjs.com/about-npm-versions) version 10.x or newer
- [Qt5](https://www.qt.io) version 5.15.2
Expand Down
2 changes: 2 additions & 0 deletions android-env.mk.inc
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export ANDROID_SDK_ROOT := /opt/android-sdk
export ANDROID_NDK_HOME := /opt/android-sdk/ndk/21.2.6472646
# gomodcache location for gomobile build pkgs. Set to tmp folder, because writing access is needed.
export GOMODCACHE_ROOT := /tmp/gomodcache/pkg/mod
11 changes: 6 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ environment:
nodejs_version: "20"
matrix:
- QT: C:\Qt\5.15.2\msvc2019_64
GOROOT: C:\go121
# As installed by `choco`
GOROOT: C:\Program Files\Go
GOPATH: C:\gopath\
GOTOOLCHAIN: local
PLATFORM: amd64
COMPILER: msvc

# https://www.appveyor.com/docs/windows-images-software/#golang
# If you change this, also change the GOROOT variable above to point to the right installation folder.
stack: go 1.21

install:
- ps: Install-Product node $env:nodejs_version
- git submodule update --init --recursive
Expand All @@ -26,6 +24,9 @@ before_build:

build_script:
- echo on
- choco install go --version=1.22.6
- go version
- go env
- choco install make
- choco install nsis -pre
- mkdir %GOPATH%\src\github.com\BitBoxSwiss
Expand Down
9 changes: 4 additions & 5 deletions backend/mobileserver/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
include ../../android-env.mk.inc

# go mod makes the Android build hang forever. Remove this once we move to go modules in a controlled fashion.
# 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
# GOMODCACHE to /tmp directory, because gomobile needs to write pkgs.
# Also set -glflags to fix the vendor issue with gomobile, see: https://github.com/golang/go/issues/67927#issuecomment-2241523694
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=readonly" -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=readonly" -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 the packages required by gomobile so they can be vendored.

package mobileserver

import (
_ "golang.org/x/mobile/bind"
_ "golang.org/x/mobile/bind/java"
_ "golang.org/x/mobile/bind/objc"
)
6 changes: 3 additions & 3 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Build artifacts:

## MacOS

Make sure you have `qt@5/bin`, `go@1.21/bin` and `go/bin` in your PATH, i.e. add to your `.zshrc`
Make sure you have `qt@5/bin`, `go@1.22/bin` and `go/bin` in your PATH, i.e. add to your `.zshrc`

```bash
export PATH="$PATH:/usr/local/opt/qt@5/bin"
export PATH="$PATH:/usr/local/opt/go@1.21/bin"
export PATH="$PATH:/usr/local/opt/go@1.22/bin"
export PATH="$PATH:$HOME/go/bin"
```

Expand Down Expand Up @@ -73,7 +73,7 @@ xcrun altool --list-providers --username "APPLE_ID" --password "PASSWORD"
The build requires `Microsoft Visual Studio 2019 Community Edition`, with the `MSVC v142 - VS 2019 C++ x64/x86 build tools (Latest)`
individual component.

It also requires `mingw-w64`, `bash` (e.g. `git-bash`), `make`,`go 1.21`, `node@20`, `QT 5.15.2` with `qtwebengine`, `nsis`
It also requires `mingw-w64`, `bash` (e.g. `git-bash`), `make`,`go 1.22`, `node@20`, `QT 5.15.2` with `qtwebengine`, `nsis`
and possibly other tools.

Some of the tools are easy to install with `choco`:
Expand Down
3 changes: 2 additions & 1 deletion frontends/qt/server/Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ CGO=1
BUILDMODE=c-shared
GOARCH=amd64
GOOS=linux
GOTOOLCHAIN=local

linux:
CC=clang \
CGO_CFLAGS="${GOLNXSECFLAGS} ${CFLAGS}" \
CGO_LDFLAGS="${GOLNXLDFLAGS} ${LFLAGS}" \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} GOTOOLCHAIN=${GOTOOLCHAIN} \
go build -x -mod=vendor -buildmode=${BUILDMODE} -ldflags \
-extldflags="${GOLNXEXTLDFLAGS}" -o ${LIBNAME}.so

Expand Down
3 changes: 2 additions & 1 deletion frontends/qt/server/Makefile.macosx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ CGO=1
BUILDMODE=c-shared
GOARCH=amd64
GOOS=darwin
GOTOOLCHAIN=local

darwin:
CGO_CFLAGS="-g ${GODARWINSECFLAGS} ${CFLAGS}" \
CGO_LDFLAGS="${GODARWINLDFLAGS} ${LFLAGS}" \
MACOSX_DEPLOYMENT_TARGET=${MACOS_MIN_VERSION} \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} GOTOOLCHAIN=${GOTOOLCHAIN} \
go build -ldflags='-s' -x -mod=vendor \
-buildmode="c-shared" -o ${LIBNAME}.so

Expand Down
5 changes: 3 additions & 2 deletions frontends/qt/server/Makefile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ CGO=1
BUILDMODE=c-shared
GOARCH=amd64
GOOS=windows
GOTOOLCHAIN=local

windows:
CGO_CFLAGS="${GOWINSECFLAGS} ${CFLAGS}" \
CGO_LDFLAGS="${GOWINLDFLAGS} ${LFLAGS}" \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} GOTOOLCHAIN=${GOTOOLCHAIN} \
go build -x -mod=vendor \
-buildmode="${BUILDMODE}" -o ${LIBNAME}.dll

Expand All @@ -17,7 +18,7 @@ windows-cross:
CC_FOR_TARGET=/usr/bin/x86_64-w64-mingw32-gcc \
CGO_CFLAGS="-g ${GOWINSECFLAGS} ${CFLAGS}" \
CGO_LDFLAGS="${GOWINLDFLAGS} ${LFLAGS}" \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} \
GOARCH=${GOARCH} CGO_ENABLED=${CGO} GOOS=${GOOS} GOTOOLCHAIN=${GOTOOLCHAIN} \
go build -x -mod=vendor \
-buildmode="${BUILDMODE}" -o ${LIBNAME}.dll

Expand Down
7 changes: 4 additions & 3 deletions frontends/web/package-lock.json

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

5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/BitBoxSwiss/bitbox-wallet-app

go 1.21
go 1.22

require (
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20240726181108-383ad4bcada4
Expand All @@ -20,6 +20,7 @@ require (
github.com/stretchr/testify v1.9.0
go.etcd.io/bbolt v1.3.10
golang.org/x/crypto v0.26.0
golang.org/x/mobile v0.0.0-20240716161057-1ad2df20a8b6
golang.org/x/net v0.28.0
)

Expand Down Expand Up @@ -54,8 +55,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.23.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
Loading

0 comments on commit bdf270c

Please sign in to comment.