fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.04k stars 1.39k forks source link

Add debug option and verbose output for all commands executed by fyne while building a release #3069

Open vkuznet opened 2 years ago

vkuznet commented 2 years ago

Is your feature request related to a problem? Please describe:

I found that I can't get new release on macOS (darwin) while executing the following command:

fyne release -os darwin -appID com.example.app -appVersion 1.0 -appBuild 1 -profile development -category utilities --cert W123X123XYZ
2022/06/14 13:15:15 Fyne error:  Codesign failed
2022/06/14 13:15:15   Cause: exit status 1
2022/06/14 13:15:15   At: /Users/vk/Work/Languages/Go/gopath/pkg/mod/fyne.io/fyne/v2@v2.1.4/cmd/fyne/internal/commands/release.go:308
unable to codesign application bundle

Upon fyne codebase inspection I found that it runs few commands behind the scene and it would be extremely helpful to get verbose output of this commands, especially if there is an error. This can be achieved by adding debug option to release which will provide the following:

Is it possible to construct a solution with the existing API?

No

Describe the solution you'd like to see:

fyne release -debug ...

# and it will provide something like:
Command executed: codesign ...
Stdout of command output: bla-bla
Stderr of command output: error-error
Status of command: 1
vkuznet commented 2 years ago

In addition, we need option to control fyne release build. So far, using developer certificates obtained from XCode, I got the following error:

fyne release -os ios -appID io.github.vkuznet -appVersion 1.0 -appBuild 1 -profile developer -cert W2R3312345
xcrun xcodebuild -configuration Release -project /var/folders/vp/p89gqpvd4f93zzqpz4g5jnvm0000gp/T/fyne-work-874026040/main.xcodeproj -allowProvisioningUpdates DEVELOPMENT_TEAM=67N29KRRR5 failed: exit status 65
...
error: No profile for team 'Fist Last Name (Personal Team)' matching 'developer' found: Xcode couldn't find any provisioning profiles matching '67N29KRRR5/developer'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the Signing & Capabilities tab of the target editor. (in target 'main' from project 'main')

The xcrun command comes from https://github.com/fyne-io/fyne/blob/master/cmd/fyne/internal/mobile/build_iosapp.go#L118-L126 where the DEVELOPMENT_TEAM argument is passed to command. To avoid incompatibility with Xcode using development certificate we should not use it. Instead, I found from this thread that the following parameter is required CODE_SIGNING_ALLOWED=NO. When I added it to xcrun I was able to build ipa file using my development certificate. Therefore, this option should be allowed in debug mode instead of DEVELOPMENT_TEAM. Moreover, you should provide ability to avoid codesinging of the app in development/debug mode. All of that requests fall into this category to provide flexible options during debug option.