Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not retrieve metadata in application, specified by package parameters when using package on precompiled binary #5230

Open
2 tasks done
chran554 opened this issue Oct 28, 2024 · 3 comments
Labels
unverified A bug that has been reported but not verified

Comments

@chran554
Copy link

chran554 commented Oct 28, 2024

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

When packageing my application with "fyne package" on a compiled fyne binary, I can not retrieve the metadata from within the application.

How to reproduce

  1. Build application with "go build".
    go build -o metadataapp fynemetadata/main.go
  2. Package application with "fyne package" and metadata parameters.
    fyne package --executable metadataapp --name "Metadata App" --appID="com.dummy.id" --appVersion="1.2.3" --appBuild=42 --icon star-icon.png
  3. Run application with no success to find specified metadata during package.
    open Metadata\ App.app

Screenshots

image

Example code

<project root>
├── fynemetadata
│   └── main.go
├── go.mod
├── go.sum
└── star-icon.png

File: fynemetadata/main.go

package main

import (
	"fmt"

	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func main() {
	application := app.New()
	window := application.NewWindow("Fyne metadata test")
	metadataLabel := widget.NewLabel(fmt.Sprintf("%+v\n", application.Metadata()))
	window.SetContent(container.NewBorder(metadataLabel, nil, nil, nil))
	window.ShowAndRun()
}

Fyne version

fyne cli version: v2.5.2

Go compiler version

go version go1.23.2 darwin/arm64

Operating system and version

Apple M1 Apple silicon, macOS Sonoma 14.6.1 (23G93)

Additional Information

Workaround:
In the case you have access to the code you can specify the source directory at package time.
Qualified guess is that the program will be recompiled (not using the already compiled binary) with extra generated application init file (setting up the metadata).

fyne package --src fynemetadata/ --executable metadataapp --name "Metadata App" --appID="com.dummy.id" --appVersion="1.2.3" --appBuild=42 --icon ../star-icon.png

But that still makes this issue with "fyne package" using precompiled binary valid, since it will miss the metadata in the application.

@chran554 chran554 added the unverified A bug that has been reported but not verified label Oct 28, 2024
@andydotxyz
Copy link
Member

The metadata is injected into the application, to do that it needs to compile it with the appropriate options.

It is not clear why you are pre-compiling separate to the fyne package command, but if that is part of your worflow consider "fyne build" instead of "go build" as that will insert your metadata.

@chran554
Copy link
Author

chran554 commented Oct 30, 2024

ok, maybe it is a matter of documentation to clearify that the parameters are of no use when using executable?

Even better, let the "package" command make the options "executable" and "sourceDir" mutually exclusive with printed error message if you try to specify both? Also print warning or error if you try to use app and metadata parameters when specifying "executable", since they can not be used/are ignored/is of no use?

@andydotxyz
Copy link
Member

We could perhaps take that approach, but it is not quite that simple. The parameters will have effect in many areas - it's just that "App.Metadata()" call which requires "fyne package" or "fyne build" to have been used in binary creation.

The metadata for the OS (except on Windows) is in the packaging format and will have effect irrespective of whether you built it outside the ecosystem.

It would probably be a simpler documentation change to just specify that "fyne package" or "fyne build" must be used to correctly package a fyne app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

2 participants