Client build scripts fixes and server stub with local devzone.
All checks were successful
Linting and tests / Linting (push) Successful in 6s
All checks were successful
Linting and tests / Linting (push) Successful in 6s
This commit is contained in:
@@ -16,7 +16,7 @@ tasks:
|
||||
cmds:
|
||||
- task: ::ensure-builddir
|
||||
- task: cleanup
|
||||
- fyne build --release -o ../../../.build/{{ .ClientBinary }} --pprof --pprof-port 6060 {{ .MetadataParams }}
|
||||
- fyne build --release -o ../../../_build/{{ .ClientBinary }} --pprof --pprof-port 6060 {{ .MetadataParams }}
|
||||
|
||||
build-debug:
|
||||
desc: "Build client in debug mode."
|
||||
@@ -25,7 +25,7 @@ tasks:
|
||||
cmds:
|
||||
- task: ::ensure-builddir
|
||||
- task: cleanup
|
||||
- fyne build -o ../../../.build/{{ .ClientBinary }} --tags debug {{ .MetadataParams }}
|
||||
- fyne build -o ../../../_build/{{ .ClientBinary }} --tags debug {{ .MetadataParams }}
|
||||
|
||||
# build-production:
|
||||
# desc: "Build production package for current OS."
|
||||
@@ -92,7 +92,7 @@ tasks:
|
||||
cleanup:
|
||||
desc: "Cleanup build environment."
|
||||
cmds:
|
||||
- rm .build/{{ .ClientBinary }}
|
||||
- rm _build/{{ .ClientBinary }}
|
||||
ignore_error: true
|
||||
|
||||
ensure-dist-dir:
|
||||
@@ -105,10 +105,10 @@ tasks:
|
||||
desc: "Launch client."
|
||||
cmds:
|
||||
- task: build
|
||||
- .build/{{ .ClientBinary }}
|
||||
- _build/{{ .ClientBinary }}
|
||||
|
||||
run-debug:
|
||||
desc: "Launch client in debug mode."
|
||||
cmds:
|
||||
- task: build-debug
|
||||
- .build/{{ .ClientBinary }}
|
||||
- _build/{{ .ClientBinary }}
|
||||
|
@@ -23,7 +23,7 @@ func main() {
|
||||
|
||||
lgr := app.NewLogger("module", "main")
|
||||
lgr.Info(
|
||||
"Starting Bunker...",
|
||||
"Starting Bunker client...",
|
||||
"version", app.Fyne().Metadata().Custom["Version"],
|
||||
"build_no", app.Fyne().Metadata().Custom["Build"],
|
||||
"commit", app.Fyne().Metadata().Custom["Commit"],
|
||||
|
@@ -9,7 +9,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"bunker/commons"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/app"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -19,6 +22,8 @@ var (
|
||||
|
||||
// Application is a lifecycle controlling structure for application.
|
||||
type Application struct {
|
||||
ctx context.Context
|
||||
cancelFunc context.CancelFunc
|
||||
fyneApp fyne.App
|
||||
baseLogger *slog.Logger
|
||||
appLogger *slog.Logger
|
||||
@@ -96,7 +101,7 @@ func (a *Application) connectDependencies() error {
|
||||
|
||||
// ContextWithTimeout returns context.Context with requested timeout.
|
||||
func (a *Application) ContextWithTimeout(timeout time.Duration) context.Context {
|
||||
ctx, cancelFunc := context.WithTimeout(context.Background(), timeout)
|
||||
ctx, cancelFunc := context.WithTimeout(a.ctx, timeout)
|
||||
|
||||
// As we do not need to call cancelFunc - make linter happy.
|
||||
// This probably will lead to context leak, so it should be investigated.
|
||||
@@ -106,11 +111,13 @@ func (a *Application) ContextWithTimeout(timeout time.Duration) context.Context
|
||||
}
|
||||
|
||||
func (a *Application) initialize() {
|
||||
a.ctx, a.cancelFunc = context.WithCancel(context.Background())
|
||||
|
||||
a.initializeLogger()
|
||||
|
||||
a.services = make([]Service, 0)
|
||||
a.fyneApp = app.NewWithID(commons.ClientAppID)
|
||||
|
||||
a.initializeFyne()
|
||||
a.services = make([]Service, 0)
|
||||
}
|
||||
|
||||
func (a *Application) launchStartupTasks() error {
|
||||
@@ -167,7 +174,6 @@ func (a *Application) launchStartupTasks() error {
|
||||
func (a *Application) Shutdown() error {
|
||||
a.appLogger.Info("Stopping pztrn's Bunker...")
|
||||
|
||||
// Сначала тушим фичи.
|
||||
for _, service := range a.services {
|
||||
if !strings.Contains(service.Name(), "features/") {
|
||||
continue
|
||||
@@ -180,7 +186,6 @@ func (a *Application) Shutdown() error {
|
||||
}
|
||||
}
|
||||
|
||||
// Потом тушим ядро.
|
||||
for _, service := range a.services {
|
||||
if !strings.Contains(service.Name(), "core/") {
|
||||
continue
|
||||
@@ -198,7 +203,7 @@ func (a *Application) Shutdown() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Start запускает приложение.
|
||||
// Start starts application.
|
||||
func (a *Application) Start() error {
|
||||
if err := a.connectDependencies(); err != nil {
|
||||
return fmt.Errorf("%w: %w", errApplication, err)
|
||||
|
@@ -1,17 +1,10 @@
|
||||
package application
|
||||
|
||||
import (
|
||||
"bunker/commons"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/app"
|
||||
)
|
||||
|
||||
// Fyne возвращает экземпляр Fyne для взаимодействия с ним.
|
||||
// Fyne returns Fyne instance.
|
||||
func (a *Application) Fyne() fyne.App {
|
||||
return a.fyneApp
|
||||
}
|
||||
|
||||
func (a *Application) initializeFyne() {
|
||||
a.fyneApp = app.NewWithID(commons.ClientAppID)
|
||||
}
|
||||
|
Reference in New Issue
Block a user