From 353a506a0996a915003a0c3eb5974252826dc98f Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Sat, 2 Sep 2023 09:19:35 +0200 Subject: [PATCH 1/2] Fix Android release that generates a .aab file Creating Android release generates a .aab file. The Build() function was working with *.apk files only. So the AAB file was not copied and triggered a SELinux error. The copy sh command failed also. This commit fixes the problem by changing the pattern to match on copy, and the package name using ".aab" suffix. NOTE: it could be better to use filepath.Glob() to find files and use os.Rename() instead. --- internal/command/android.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/command/android.go b/internal/command/android.go index c1ec675..97745b1 100644 --- a/internal/command/android.go +++ b/internal/command/android.go @@ -80,6 +80,7 @@ func (cmd *android) Build(image containerImage) (string, error) { log.Info("[i] Packaging app...") packageName := fmt.Sprintf("%s.apk", cmd.defaultContext.Name) + pattern := "*.apk" err := prepareIcon(cmd.defaultContext, image) if err != nil { @@ -88,6 +89,8 @@ func (cmd *android) Build(image containerImage) (string, error) { if cmd.defaultContext.Release { err = fyneRelease(cmd.defaultContext, image) + packageName = fmt.Sprintf("%s.aab", cmd.defaultContext.Name) + pattern = "*.aab" } else { err = fynePackage(cmd.defaultContext, image) } @@ -101,8 +104,9 @@ func (cmd *android) Build(image containerImage) (string, error) { // https://github.com/fyne-io/fyne/blob/v1.4.0/cmd/fyne/internal/mobile/build_androidapp.go#L297 // To avoid to duplicate the fyne tool sanitize logic here, the location of // the dist package to move will be detected using a matching pattern - command := fmt.Sprintf("mv %q/*.apk %q", + command := fmt.Sprintf("mv %q/%s %q", volume.JoinPathContainer(cmd.defaultContext.WorkDirContainer(), cmd.defaultContext.Package), + pattern, volume.JoinPathContainer(cmd.defaultContext.TmpDirContainer(), image.ID(), packageName), ) From 9c86531fbf6d88f4532a0ecc83b48bd721c48cec Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 31 Dec 2024 12:20:44 +0000 Subject: [PATCH 2/2] Use a staticcheck that understands some of the test deps --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae2bd28..bee2e51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: go-version: "1.23.x" - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@v0.4.7 + run: go install honnef.co/go/tools/cmd/staticcheck@v0.5.1 - name: Install goimports run: go install golang.org/x/tools/cmd/goimports@latest