diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index d2bcbb00..2df7b51f 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: [fyne-io, Jacalz] +github: [fyne-io, Jacalz, lucor] diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 00000000..66bb242d --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbcac7c1..ae2bd28c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,10 +9,10 @@ jobs: - name: Setup Go environment uses: actions/setup-go@v3 with: - go-version: "1.19.x" + go-version: "1.23.x" - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@latest + run: go install honnef.co/go/tools/cmd/staticcheck@v0.4.7 - name: Install goimports run: go install golang.org/x/tools/cmd/goimports@latest @@ -34,7 +34,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] # use max/min supported Go versions - go-version: ["1.18.x", "1.14.x"] + go-version: ["1.23.x", "1.19.x"] steps: - name: Setup Go environment @@ -56,7 +56,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] # use max/min supported Go versions - go-version: ["1.18.x"] + go-version: ["1.19.x"] steps: - name: Setup Go environment @@ -80,7 +80,7 @@ jobs: fail-fast: false matrix: # use max/min supported Go versions - go-version: ["1.18.x", "1.14.x"] + go-version: ["1.23.x", "1.19.x"] target: - os: linux - os: windows @@ -119,7 +119,7 @@ jobs: path: calculator - name: Cache build artifacts - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/go/pkg/mod @@ -131,11 +131,9 @@ jobs: working-directory: fyne-cross run: go install - # attempt to use "go install" but fallback to "go get" - name: Install Fyne run: | - go install fyne.io/fyne/v2/cmd/fyne@latest || - go get fyne.io/fyne/v2/cmd/fyne@latest + go install fyne.io/fyne/v2/cmd/fyne@latest - name: Install Podman if: ${{ runner.os == 'macos' }} @@ -162,7 +160,7 @@ jobs: fail-fast: false matrix: # use max/min supported Go versions - go-version: ["1.18.x", "1.14.x"] + go-version: ["1.23.x", "1.19.x"] target: - os: linux - os: windows @@ -201,7 +199,7 @@ jobs: path: terminal - name: Cache build artifacts - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/go/pkg/mod @@ -213,11 +211,9 @@ jobs: working-directory: fyne-cross run: go install - # attempt to use "go install" but fallback to "go get" - name: Install Fyne run: | - go install fyne.io/fyne/v2/cmd/fyne@latest || - go get fyne.io/fyne/v2/cmd/fyne@latest + go install fyne.io/fyne/v2/cmd/fyne@latest - name: Install Podman if: ${{ runner.os == 'macos' }} diff --git a/CHANGELOG.md b/CHANGELOG.md index cf6bea66..b657a891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog - Fyne.io fyne-cross +## 1.6.0 - 31 Dec 2024 + +### Changed +- Bump github.com/stretchr/testify from 1.7.0 to 1.9.0 by @dependabot in https://github.com/fyne-io/fyne-cross/pull/233 +- Ldflags where only needed with older version of zig which we have updated since then. by @Bluebugs in https://github.com/fyne-io/fyne-cross/pull/246 + +## 1.5.0 - 13 Apr 2024 + +### Changed + +- Improve Docker Darwin support when using it has a host for fyne-cross (ssh-agent detection, documentation, arm64) +- Support Podman on Darwin +- Improve Android signature support +- Propagate GOFLAGS correctly +- Adjust supported Go version to match Fyne +- Update dependencies + ## 1.4.0 - 13 Mar 2023 ### Added diff --git a/README.md b/README.md index 0b955d8f..17b096b9 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Supported targets are: - linux/arm - linux/arm64 - windows/amd64 + - windows/arm64 - windows/386 - android ([multiple architectures](https://developer.android.com/ndk/guides/abis)) - android/386 @@ -27,8 +28,8 @@ Supported targets are: > Note: > - iOS compilation is supported only on darwin hosts. See [fyne pre-requisites](https://developer.fyne.io/started/#prerequisites) for details. -> - macOS packaging for public distrubution (release mode) is supported only on darwin hosts. -> - windows packaging for public distrubution (release mode) is supported only on windows hosts. +> - macOS packaging for public distribution (release mode) is supported only on darwin hosts. +> - windows packaging for public distribution (release mode) is supported only on windows hosts. > - starting from v1.1.0: > - cross-compile from NOT `darwin` (i.e. linux) to `darwin`: requires a copy of the macOS SDK on the host. The fyne-cross `darwin-sdk-extractor` command can be used to extract the SDK from the XCode CLI Tool file, see the [Extract the macOS SDK](#extract_macos_sdk) section below. > - cross-compile from `darwin` to `darwin` by default will use under the hood the fyne CLI tool and requires Go and the macOS SDK installed on the host. @@ -138,8 +139,12 @@ The fyne-cross `darwin-sdk-extractor` command can be used to extract the SDK fro terms before continuing.](https://www.apple.com/legal/sla/docs/xcode.pdf)** To extract the SDKs: -1. [Download Command Line Tools for Xcode](https://developer.apple.com/download/all/?q=Command%20Line%20Tools) >= 12.4 (macOS SDK 11.x) +1. [Download Command Line Tools for Xcode](https://developer.apple.com/download/all/?q=Command%20Line%20Tools) 12.4 (macOS SDK 11.x) 2. Run: `fyne-cross darwin-sdk-extract --xcode-path /path/to/Command_Line_Tools_for_Xcode_12.5.dmg` + * Once extraction has been done, you should have a SDKs directory created. This directory contains at least 2 SDKs (ex. `SDKs/MacOSX12.3.sdk/` and `SDKs/MacOSX13.3.sdk/` in Command_Line_Tools_for_Xcode_14.3.1.dmg) +3. Specify explicitly which SDK you want to use in your fyne-cross command with --macosx-sdk-path: `fyne-cross darwin --macosx-sdk-path /full/path/to/SDKs/MacOSX12.3.sdk -app-id your.app.id` + +> Note: current version supports only MacOS SDK 11.3 ## Contribute diff --git a/go.mod b/go.mod index 6ab3b285..5c133a32 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,17 @@ module github.com/fyne-io/fyne-cross -go 1.17 +go 1.19 require ( - github.com/BurntSushi/toml v1.1.0 + github.com/BurntSushi/toml v1.3.2 github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 - github.com/aws/aws-sdk-go v1.41.19 + github.com/aws/aws-sdk-go v1.51.13 github.com/klauspost/compress v1.13.4 github.com/mholt/archiver/v3 v3.5.1 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.9.0 github.com/urfave/cli/v2 v2.11.1 - golang.org/x/sync v0.1.0 - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f + golang.org/x/sync v0.6.0 + golang.org/x/sys v0.13.0 k8s.io/api v0.18.19 k8s.io/apimachinery v0.18.19 k8s.io/client-go v0.18.17 @@ -43,10 +43,11 @@ require ( github.com/ulikunitz/xz v0.5.10 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect - golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect google.golang.org/appengine v1.5.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index 0e69838e..85596afe 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,9 @@ github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxB github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 h1:1ltqoej5GtaWF8jaiA49HwsZD459jqm9YFz9ZtMFpQA= github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I= github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= @@ -26,8 +27,8 @@ github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aws/aws-sdk-go v1.41.19 h1:9QR2WTNj5bFdrNjRY9SeoG+3hwQmKXGX16851vdh+N8= -github.com/aws/aws-sdk-go v1.41.19/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go v1.51.13 h1:j6lgtz9E/XFRiYYnGNrAfWvyyTsuYvWvo2RCt0zqAIs= +github.com/aws/aws-sdk-go v1.51.13/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= @@ -187,7 +188,6 @@ github.com/pierrec/lz4/v4 v4.1.14 h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -217,11 +217,17 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -237,6 +243,7 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRT github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -245,14 +252,18 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -269,8 +280,12 @@ golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -282,8 +297,10 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -299,18 +316,29 @@ golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -325,6 +353,8 @@ golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/cloud/s3.go b/internal/cloud/s3.go index a630df43..f53921fb 100644 --- a/internal/cloud/s3.go +++ b/internal/cloud/s3.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -20,7 +19,7 @@ import ( "github.com/klauspost/compress/zstd" "golang.org/x/sync/errgroup" - archiver "github.com/mholt/archiver/v3" + "github.com/mholt/archiver/v3" ) type AWSSession struct { @@ -104,7 +103,7 @@ func (a *AWSSession) UploadFile(localFile string, s3FilePath string) error { } func (a *AWSSession) UploadCompressedDirectory(localDirectoy string, s3FilePath string) error { - file, err := ioutil.TempFile("", "fyne-cross-s3") + file, err := os.CreateTemp("", "fyne-cross-s3") if err != nil { return err } @@ -255,7 +254,7 @@ func (a *AWSSession) DownloadFile(s3FilePath string, localFile string) error { } func (a *AWSSession) DownloadCompressedDirectory(s3FilePath string, localRootDirectory string) error { - file, err := ioutil.TempFile("", "fyne-cross-s3") + file, err := os.CreateTemp("", "fyne-cross-s3") if err != nil { return err } diff --git a/internal/command/command.go b/internal/command/command.go index 4559ed18..8a62859c 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -2,7 +2,6 @@ package command import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -97,20 +96,18 @@ Use "fyne-cross -help" for more information about a command. func cleanTargetDirs(ctx Context, image containerImage) error { dirs := map[string]string{ - "bin": volume.JoinPathContainer(ctx.BinDirContainer(), image.ID()), - "dist": volume.JoinPathContainer(ctx.DistDirContainer(), image.ID()), - "temp": volume.JoinPathContainer(ctx.TmpDirContainer(), image.ID()), + "bin": volume.JoinPathHost(ctx.Volume.BinDirHost(), image.ID()), + "dist": volume.JoinPathHost(ctx.Volume.DistDirHost(), image.ID()), + "temp": volume.JoinPathHost(ctx.Volume.TmpDirHost(), image.ID()), } log.Infof("[i] Cleaning target directories...") for k, v := range dirs { - err := image.Run(ctx.Volume, options{}, []string{"rm", "-rf", v}) - if err != nil { + if err := os.RemoveAll(v); err != nil { return fmt.Errorf("could not clean the %q dir %s: %v", k, v, err) } - err = image.Run(ctx.Volume, options{}, []string{"mkdir", "-p", v}) - if err != nil { + if err := os.MkdirAll(v, os.ModePerm); err != nil { return fmt.Errorf("could not create the %q dir %s: %v", k, v, err) } @@ -134,7 +131,7 @@ func prepareIcon(ctx Context, image containerImage) error { } log.Infof("[!] Default icon not found at %q", ctx.Icon) - err = ioutil.WriteFile(volume.JoinPathHost(ctx.WorkDirHost(), ctx.Icon), icon.FyneLogo, 0644) + err = os.WriteFile(volume.JoinPathHost(ctx.WorkDirHost(), ctx.Icon), icon.FyneLogo, 0644) if err != nil { return fmt.Errorf("could not create the temporary icon: %s", err) } @@ -142,10 +139,12 @@ func prepareIcon(ctx Context, image containerImage) error { } } - err := image.Run(ctx.Volume, options{}, []string{"cp", volume.JoinPathContainer(ctx.WorkDirContainer(), ctx.Icon), volume.JoinPathContainer(ctx.TmpDirContainer(), image.ID(), icon.Default)}) - if err != nil { - return fmt.Errorf("could not copy the icon to temp folder: %v", err) + if data, err := os.ReadFile(volume.JoinPathHost(ctx.Volume.WorkDirHost(), ctx.Icon)); err != nil { + return fmt.Errorf("could not read in icon %s: %w", ctx.Icon, err) + } else if err := os.WriteFile(volume.JoinPathHost(ctx.TmpDirHost(), image.ID(), icon.Default), data, 0644); err != nil { + return fmt.Errorf("could not copy icon %s to tmp folder: %w", ctx.Icon, err) } + return nil } @@ -157,7 +156,7 @@ func printUsage(template string, data interface{}) { func checkFyneBinHost(ctx Context) (string, error) { fyne, err := execabs.LookPath("fyne") if err != nil { - return "", fmt.Errorf("missed requirement: fyne. To install: `go get fyne.io/fyne/v2/cmd/fyne` and add $GOPATH/bin to $PATH") + return "", fmt.Errorf("missed requirement: fyne. To install: `go install fyne.io/fyne/v2/cmd/fyne@latest` and add $GOPATH/bin to $PATH") } if debugging() { diff --git a/internal/command/context.go b/internal/command/context.go index d0173ec5..484e3b89 100644 --- a/internal/command/context.go +++ b/internal/command/context.go @@ -4,6 +4,7 @@ import ( "bytes" "errors" "fmt" + "os" "path/filepath" "runtime" "strconv" @@ -174,6 +175,10 @@ func makeDefaultContext(flags *CommonFlags, args []string) (Context, error) { return ctx, err } + if env := os.Getenv("GOFLAGS"); env != "" { + ctx.Env["GOFLAGS"] = env + } + if len(flags.Ldflags) > 0 { goflags := "" for _, ldflags := range strings.Fields(flags.Ldflags) { diff --git a/internal/command/darwin.go b/internal/command/darwin.go index dd03678b..2f1ba60a 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -187,8 +187,6 @@ func (cmd *darwin) setupContainerImages(flags *darwinFlags, args []string) error return fmt.Errorf("could not make command context for %s OS: %s", darwinOS, err) } - flags.Ldflags += " -s -w" - ctx, err := makeDefaultContext(flags.CommonFlags, args) if err != nil { return err @@ -200,7 +198,7 @@ func (cmd *darwin) setupContainerImages(flags *darwinFlags, args []string) error ctx.Category = flags.Category - // Following settings are needed to cross compile with zig 0.9.1 + // Following settings are needed to cross compile with zig ctx.BuildMode = "pie" cmd.defaultContext = ctx diff --git a/internal/command/darwin_sdk_extract.go b/internal/command/darwin_sdk_extract.go index cf145464..70ded4ce 100644 --- a/internal/command/darwin_sdk_extract.go +++ b/internal/command/darwin_sdk_extract.go @@ -3,7 +3,6 @@ package command import ( "errors" "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -78,7 +77,7 @@ func (cmd *DarwinSDKExtract) Run() error { } // mount the fyne-cross volume - workDir, err := ioutil.TempDir("", cmd.Name()) + workDir, err := os.MkdirTemp("", cmd.Name()) if err != nil { return err } diff --git a/internal/command/docker.go b/internal/command/docker.go index 19c6a781..8fb6865c 100644 --- a/internal/command/docker.go +++ b/internal/command/docker.go @@ -77,9 +77,9 @@ func AppendEnv(args []string, environs map[string]string, quoteNeeded bool) []st for k, v := range environs { env := k + "=" + v if quoteNeeded && strings.Contains(v, "=") { - // engine requires to double quote the env var when value contains + // engine requires to double quote the value when it contains // the `=` char - env = fmt.Sprintf("%q", env) + env = fmt.Sprintf("%s=%q", k, v) } args = append(args, "-e", env) } @@ -104,8 +104,8 @@ func (i *localContainerImage) cmd(vol volume.Volume, opts options, cmdArgs []str } mountFormat := "%s:%s:z" - if runtime.GOOS == darwinOS && runtime.GOARCH == string(ArchArm64) { - // When running on darwin with a Arm64, we rely on going through a VM setup that doesn't allow the :z + if runtime.GOOS == darwinOS { + // When running on darwin with an Arm64 or Amd64, we rely on going through a VM setup that doesn't allow the :z mountFormat = "%s:%s" } @@ -114,7 +114,7 @@ func (i *localContainerImage) cmd(vol volume.Volume, opts options, cmdArgs []str } arch := "amd64" - if runtime.GOARCH == "arm64" { + if runtime.GOARCH == "arm64" && (runtime.GOOS != "darwin" || i.os != "android") { // If we are running on arm64, we should have arm64 image to avoid using emulation arch = runtime.GOARCH } @@ -140,10 +140,13 @@ func (i *localContainerImage) cmd(vol volume.Volume, opts options, cmdArgs []str // detect ssh-agent socket for private repositories access if sshAuthSock := os.Getenv("SSH_AUTH_SOCK"); sshAuthSock != "" { if runtime.GOOS == "darwin" { - // on macOS, the SSH_AUTH_SOCK is not available in the container directly, - // but instead we need to the magic path "/run/host-services/ssh-auth.sock" - args = append(args, "-v", "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock") - args = append(args, "-e", "SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock") + // Podman doesn't yet support sshagent forwarding on macOS + if !i.runner.engine.IsPodman() { + // on macOS, the SSH_AUTH_SOCK is not available in the container directly, + // but instead we need to the magic path "/run/host-services/ssh-auth.sock" + args = append(args, "-v", "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock") + args = append(args, "-e", "SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock") + } } else if realSshAuthSock, err := filepath.EvalSymlinks(sshAuthSock); err == nil { args = append(args, "-v", fmt.Sprintf("%s:/tmp/ssh-agent", realSshAuthSock)) args = append(args, "-e", "SSH_AUTH_SOCK=/tmp/ssh-agent") diff --git a/internal/command/docker_test.go b/internal/command/docker_test.go index cd6201e3..895c4719 100644 --- a/internal/command/docker_test.go +++ b/internal/command/docker_test.go @@ -273,6 +273,113 @@ func TestCmdEnginePodman(t *testing.T) { } } +func TestAppendEnv(t *testing.T) { + type args struct { + args []string + env map[string]string + quoteNeeded bool + } + tests := []struct { + name string + args args + wantStart []string + wantEnd [][2]string + }{ + { + name: "empty", + args: args{ + args: []string{}, + env: map[string]string{}, + quoteNeeded: true, + }, + wantStart: []string{}, + wantEnd: [][2]string{}, + }, + { + name: "quote needed", + args: args{ + args: []string{}, + env: map[string]string{"VAR": "value"}, + quoteNeeded: true, + }, + wantStart: []string{}, + wantEnd: [][2]string{{"-e", "VAR=value"}}, + }, + { + name: "quote not needed", + args: args{ + args: []string{}, + env: map[string]string{"VAR": "value"}, + quoteNeeded: false, + }, + wantStart: []string{}, + wantEnd: [][2]string{{"-e", "VAR=value"}}, + }, + { + name: "multiple", + args: args{ + args: []string{}, + env: map[string]string{"VAR": "value", "VAR2": "value2"}, + quoteNeeded: true, + }, + wantStart: []string{}, + wantEnd: [][2]string{{"-e", "VAR=value"}, {"-e", "VAR2=value2"}}, + }, + { + name: "multiple with args", + args: args{ + args: []string{"arg1", "arg2"}, + env: map[string]string{"VAR": "value", "VAR2": "value2"}, + quoteNeeded: true, + }, + wantStart: []string{"arg1", "arg2"}, + wantEnd: [][2]string{{"-e", "VAR=value"}, {"-e", "VAR2=value2"}}, + }, + { + name: "multiple with args and equal sign require quoting values", + args: args{ + args: []string{"arg1", "arg2"}, + env: map[string]string{"VAR": "value", "VAR2": "value2=2"}, + quoteNeeded: true, + }, + wantStart: []string{"arg1", "arg2"}, + wantEnd: [][2]string{{"-e", "VAR=value"}, {"-e", "VAR2=\"value2=2\""}}, + }, + { + name: "multiple with args and equal sign do not require quoting values", + args: args{ + args: []string{"arg1", "arg2"}, + env: map[string]string{"VAR": "value", "VAR2": "value2=2"}, + quoteNeeded: false, + }, + wantStart: []string{"arg1", "arg2"}, + wantEnd: [][2]string{{"-e", "VAR=value"}, {"-e", "VAR2=value2=2"}}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := AppendEnv(tt.args.args, tt.args.env, tt.args.quoteNeeded) + var i int + for _, v := range tt.wantStart { + assert.Equal(t, v, got[i]) + i++ + } + for ; i < len(got); i += 2 { + found := false + for k, v := range tt.wantEnd { + if v[0] == got[i] && v[1] == got[i+1] { + tt.wantEnd = append(tt.wantEnd[:k], tt.wantEnd[k+1:]...) + found = true + break + } + } + assert.Equal(t, true, found) + } + assert.Equal(t, 0, len(tt.wantEnd)) + }) + } +} + func TestMain(m *testing.M) { os.Unsetenv("SSH_AUTH_SOCK") os.Exit(m.Run()) diff --git a/internal/metadata/load.go b/internal/metadata/load.go index 25d214a0..e05a94d8 100644 --- a/internal/metadata/load.go +++ b/internal/metadata/load.go @@ -2,7 +2,6 @@ package metadata import ( "io" - "io/ioutil" "os" "path/filepath" @@ -12,7 +11,7 @@ import ( // Load attempts to read a FyneApp metadata from the provided reader. // If this cannot be done an error will be returned. func Load(r io.Reader) (*FyneApp, error) { - str, err := ioutil.ReadAll(r) + str, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/internal/volume/volume.go b/internal/volume/volume.go index 617ff410..c2461a87 100644 --- a/internal/volume/volume.go +++ b/internal/volume/volume.go @@ -7,7 +7,6 @@ import ( "archive/zip" "fmt" "io" - "io/ioutil" "os" "path" "path/filepath" @@ -31,11 +30,11 @@ const ( // Copy copies a resource from src to dest func Copy(src string, dst string) error { - data, err := ioutil.ReadFile(src) + data, err := os.ReadFile(src) if err != nil { return err } - return ioutil.WriteFile(dst, data, 0644) + return os.WriteFile(dst, data, 0644) } // DefaultCacheDirHost returns the default cache dir on the host