wails: MacOS: wails build -o outputName ignored.

Description

When building an application on MacOS the -o arg is ignored, and the configuration value in the code is used.

To Reproduce

macos:
    runs-on: macos-latest
    steps:
      # Checkout code
      - uses: actions/checkout@v3
        with:
          repository: letheanVPN/desktop
          submodules: recursive
      - uses: dAppServer/wails-build-action@v2
        with:
          build-name: letheanTest
          build-platform: darwin/universal
          wails-build-webview2: "embed"
          wails-version: "v2.3.1"
          go-version: ^1.18
          sign: "false"

Expected behaviour

The output name to be the same as provided with -o

Screenshots

image

Attempted Fixes

No response

System Details

https://github.com/dAppServer/wails-build-action/actions/runs/3885309312/jobs/6629024935

Additional context

linux and windows will use the -o value; not sure if you build from Linux for macOS if it builds fine or not.

https://github.com/dAppServer/wails-build-action/actions/runs/3885309312 Workflow file to test the GHA: https://github.com/dAppServer/wails-build-action/blob/11-action-fails-with-wails-231-on-macos-due-to-ditto-error/.github/workflows/lethean-desktop.yml

Workflow file to test using GHA: https://github.com/dAppServer/wails-build-action/blob/main/.github/workflows/lethean-desktop.yml

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 17 (15 by maintainers)

Most upvoted comments

I think I’ll have time to get the testing done on this over the weekend. There is a draft PR at #2358; the patch is surprisingly tiny.

p.s if you add GitHub sponsors I’ll make sure my project donates enough to buy a bottle of something for your trouble.

Thank you, but I’m doing this for the love. I’m just happy to help out.

Thanks, well, we donated trees in your name instead. (it’s about 100 trees in case you are wondering)

image https://donate.trees.org/team/400781

Thanks for working on this 😃

This isn’t a huge check-in, but as I’ve been fixing this I keep getting tripped up by the difference between the Universal and the individual architecture builds, so I decided I need to add tests for the build.go file and validate I’m not introducing regressions, and well, here - https://github.com/gwynforthewyn/wails/commit/fcbefc924eb8b8410573bb18bab035a10540ac2f

It took me a few hours to figure that out : )

I’ve been taking a look at this, and I’d like to develop the fix. Here’s what I’ve figured out so far.

Building a macOS app comes in two parts: compiling the go binary, and packaging the .app.

go binary

In v2/pkg/commands/build/build.go, in the execBuildApplication function, building the go binary has 2 logical branches for darwin; the if statement is on https://github.com/wailsapp/wails/blob/master/v2/pkg/commands/build/build.go#L266

If we are building a “universal” build (compiling for both arm64 and amd64 architectures), then on https://github.com/wailsapp/wails/blob/master/v2/pkg/commands/build/build.go#L311 the go compilation’s OutputFile name is set to the value of the -o flag; if only one architecture is being built, this doesn’t happen presently.

macos packaging the .app

Packaging the app for darwin takes place in https://github.com/wailsapp/wails/blob/master/v2/pkg/commands/build/packager.go#L64, and doesn’t seem to check if there’s a filename been set with the -o flag.