The v3 migration put application.Get() in backend/events and a ServiceStartup hook in backend/explore, both of which cmd/indexbuild reaches. v3's application package is GTK/WebKit bindings on Linux, so the index-artifact job — a plain golang container with CGO_ENABLED=0, on the stated grounds that neither command imports the app — stopped compiling with "undefined: pointer". That job owns the ~205 GB dump checkpoint, so it is the worst place to learn this. Both are behind the indexbuild tag now: the one app.Event.Emit lives in runtime_wails.go, runtime_indexbuild.go answers ErrNoRuntime (what the app itself returns before Run, so Deliver's callers need no second path), and explore's ServiceStartup moves to its own tagged file. TestIndexToolsDoNotImportWails walks `go list -deps -tags indexbuild` so the claim the workflow makes is checked rather than assumed.
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
//go:build !indexbuild
|
|
|
|
package events
|
|
|
|
import (
|
|
"github.com/wailsapp/wails/v3/pkg/application"
|
|
)
|
|
|
|
// emitRuntime pushes an event through the running Wails application.
|
|
//
|
|
// It is the app's half of a two-file split, and the split exists for a
|
|
// build constraint rather than a design one: v3's application package
|
|
// is cgo on Linux, so anything importing it needs GTK and WebKit
|
|
// headers to compile. cmd/indexbuild and cmd/indexexport reach this
|
|
// package through backend/explore and are built in a plain golang
|
|
// container with CGO_ENABLED=0 (.gitea/workflows/index-artifact.yml),
|
|
// where that is not available and not wanted. See
|
|
// runtime_indexbuild.go for the other half.
|
|
func emitRuntime(name string, data ...any) error {
|
|
// application.Get() returns nil when no app is running — under
|
|
// test, before Run, and after shutdown. It does not terminate the
|
|
// process, which is what the v2 probe of the private "events"
|
|
// context key existed to avoid.
|
|
app := application.Get()
|
|
if app == nil {
|
|
return ErrNoRuntime
|
|
}
|
|
|
|
app.Event.Emit(name, data...)
|
|
|
|
return nil
|
|
}
|