fix(build): keep the index tools free of the Wails application
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.
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"golang.org/x/sync/singleflight"
|
||||
|
||||
"yellowjacket/backend/database"
|
||||
@@ -144,19 +143,9 @@ func (e *Service) CAALimiter() *RateLimiter {
|
||||
return e.caaLimiter
|
||||
}
|
||||
|
||||
// ServiceStartup is v3's service lifecycle hook: it runs once the
|
||||
// runtime exists, and ctx is cancelled when the app shuts down. It
|
||||
// replaces v2's SetContext, which had to be called by hand from
|
||||
// OnStartup and was exported, so it was also bound to the frontend.
|
||||
func (e *Service) ServiceStartup(
|
||||
ctx context.Context,
|
||||
_ application.ServiceOptions,
|
||||
) error {
|
||||
e.ctx = ctx
|
||||
e.index.SetContext(ctx)
|
||||
|
||||
return nil
|
||||
}
|
||||
// The v3 service lifecycle hook that fills e.ctx lives in
|
||||
// servicestartup.go, behind a build tag: naming
|
||||
// application.ServiceOptions is what would drag cgo into cmd/indexbuild.
|
||||
|
||||
// StartIndexBuild kicks off the background search index build.
|
||||
// Call this after the library scan completes so the indexer doesn't
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//go:build !indexbuild
|
||||
|
||||
package explore
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
// ServiceStartup is v3's service lifecycle hook: it runs once the
|
||||
// runtime exists, and ctx is cancelled when the app shuts down. It
|
||||
// replaces v2's SetContext, which had to be called by hand from
|
||||
// OnStartup and was exported, so it was also bound to the frontend.
|
||||
//
|
||||
// It is the one thing in this package that names the Wails application,
|
||||
// and it is behind a build tag for the reason
|
||||
// backend/events/runtime_wails.go states: cmd/indexbuild imports this
|
||||
// package and is built without cgo, GTK or WebKit. Nothing under the
|
||||
// indexbuild tag runs a Wails app, so the hook — and the context it
|
||||
// installs — is simply absent there.
|
||||
func (e *Service) ServiceStartup(
|
||||
ctx context.Context,
|
||||
_ application.ServiceOptions,
|
||||
) error {
|
||||
e.ctx = ctx
|
||||
e.index.SetContext(ctx)
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user