2024-06-14 01:49:25 +02:00
|
|
|
# Copyright 2024, Command Line Inc.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2024-05-10 05:24:24 +02:00
|
|
|
version: "3"
|
|
|
|
|
|
|
|
vars:
|
2024-07-18 07:39:22 +02:00
|
|
|
APP_NAME: "TheNextWave"
|
2024-05-10 05:24:24 +02:00
|
|
|
BIN_DIR: "bin"
|
2024-06-14 03:11:21 +02:00
|
|
|
VERSION:
|
|
|
|
sh: node version.cjs
|
2024-05-10 05:24:24 +02:00
|
|
|
|
2024-06-12 02:42:10 +02:00
|
|
|
tasks:
|
2024-07-18 07:39:22 +02:00
|
|
|
electron:dev:
|
|
|
|
desc: Run the Electron application directly.
|
2024-07-18 03:42:49 +02:00
|
|
|
cmds:
|
2024-07-18 07:39:22 +02:00
|
|
|
- WAVETERM_DEV=1 yarn dev
|
2024-07-18 03:42:49 +02:00
|
|
|
deps:
|
|
|
|
- generate
|
|
|
|
- build:server
|
|
|
|
- build:wsh
|
2024-05-10 05:24:24 +02:00
|
|
|
|
2024-07-18 07:39:22 +02:00
|
|
|
electron:start:
|
|
|
|
desc: Run the Electron application via the Vite dev server (enables hot reloading).
|
2024-05-10 05:24:24 +02:00
|
|
|
cmds:
|
2024-07-18 07:39:22 +02:00
|
|
|
- WAVETERM_DEV=1 yarn start
|
2024-06-14 01:49:25 +02:00
|
|
|
deps:
|
2024-07-18 03:42:49 +02:00
|
|
|
- generate
|
2024-06-14 01:49:25 +02:00
|
|
|
- build:server
|
2024-06-21 23:44:11 +02:00
|
|
|
- build:wsh
|
2024-05-10 05:24:24 +02:00
|
|
|
|
2024-07-18 07:39:22 +02:00
|
|
|
package:
|
|
|
|
desc: Package the application for the current platform.
|
2024-05-10 05:24:24 +02:00
|
|
|
cmds:
|
2024-07-18 07:39:22 +02:00
|
|
|
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never
|
2024-05-10 05:24:24 +02:00
|
|
|
deps:
|
2024-07-18 03:42:49 +02:00
|
|
|
- generate
|
2024-06-12 02:42:10 +02:00
|
|
|
- build:server
|
2024-06-21 23:44:11 +02:00
|
|
|
- build:wsh
|
2024-05-10 05:24:24 +02:00
|
|
|
|
2024-07-18 03:42:49 +02:00
|
|
|
generate:
|
2024-07-18 07:39:22 +02:00
|
|
|
desc: Generate Typescript bindings for the Go backend.
|
2024-07-18 03:42:49 +02:00
|
|
|
cmds:
|
|
|
|
- go run cmd/generate/main-generate.go
|
|
|
|
- go run cmd/generatewshclient/main-generatewshclient.go
|
|
|
|
sources:
|
|
|
|
- "cmd/generate/*.go"
|
|
|
|
- "pkg/service/**/*.go"
|
|
|
|
- "pkg/wstore/*.go"
|
|
|
|
- "pkg/wshrpc/**/*.go"
|
2024-07-18 07:39:22 +02:00
|
|
|
generates:
|
|
|
|
- frontend/types/gotypes.d.ts
|
|
|
|
- pkg/wshrpc/wshclient/wshclient.go
|
2024-07-18 03:42:49 +02:00
|
|
|
|
2024-06-12 02:42:10 +02:00
|
|
|
build:server:
|
2024-07-18 07:39:22 +02:00
|
|
|
desc: Build the wavesrv component.
|
2024-07-18 03:42:49 +02:00
|
|
|
deps:
|
2024-07-18 07:39:22 +02:00
|
|
|
- build:server:darwin
|
|
|
|
- build:server:other
|
|
|
|
|
|
|
|
build:server:darwin:
|
|
|
|
desc: Build the wavesrv component for Darwin platforms (generates artifacts for both arm64 and amd64).
|
|
|
|
status:
|
|
|
|
- exit {{if eq OS "darwin"}}1{{else}}0{{end}}
|
|
|
|
cmds:
|
2024-07-18 03:42:49 +02:00
|
|
|
- task: build:server:internal
|
|
|
|
vars:
|
|
|
|
GOARCH: arm64
|
|
|
|
- task: build:server:internal
|
|
|
|
vars:
|
|
|
|
GOARCH: amd64
|
2024-07-18 07:39:22 +02:00
|
|
|
|
|
|
|
build:server:other:
|
|
|
|
desc: Build the wavesrv component for non-Darwin platforms (only generates artifacts for the current architecture).
|
|
|
|
status:
|
|
|
|
- exit {{if eq OS "darwin"}}0{{else}}1{{end}}
|
|
|
|
cmds:
|
|
|
|
- task: build:server:internal
|
|
|
|
vars:
|
|
|
|
GOARCH:
|
|
|
|
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
|
|
|
|
GO_LDFLAGS: -linkmode 'external' -extldflags=-static
|
|
|
|
|
2024-07-18 03:42:49 +02:00
|
|
|
|
|
|
|
build:server:internal:
|
|
|
|
requires:
|
|
|
|
vars:
|
|
|
|
- GOARCH
|
2024-05-10 05:24:24 +02:00
|
|
|
cmds:
|
2024-07-18 07:39:22 +02:00
|
|
|
- CGO_ENABLED=1 GOARCH={{.GOARCH}} go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "{{.GO_LDFLAGS}} -X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wavesrv.{{.GOARCH}}{{exeExt}} cmd/server/main-server.go
|
2024-05-10 05:24:24 +02:00
|
|
|
sources:
|
2024-06-12 02:42:10 +02:00
|
|
|
- "cmd/server/*.go"
|
|
|
|
- "pkg/**/*.go"
|
2024-05-10 05:24:24 +02:00
|
|
|
generates:
|
2024-07-18 03:42:49 +02:00
|
|
|
- dist/bin/wavesrv.{{.GOARCH}}{{exeExt}}
|
2024-05-10 05:24:24 +02:00
|
|
|
deps:
|
2024-06-12 02:42:10 +02:00
|
|
|
- go:mod:tidy
|
2024-07-18 03:42:49 +02:00
|
|
|
internal: true
|
2024-05-10 05:24:24 +02:00
|
|
|
|
2024-06-21 23:44:11 +02:00
|
|
|
build:wsh:
|
2024-07-18 07:39:22 +02:00
|
|
|
desc: Build the wsh component for all possible targets.
|
2024-07-18 03:42:49 +02:00
|
|
|
deps:
|
|
|
|
- task: build:wsh:internal
|
|
|
|
vars:
|
|
|
|
GOOS: darwin
|
|
|
|
GOARCH: arm64
|
|
|
|
- task: build:wsh:internal
|
|
|
|
vars:
|
|
|
|
GOOS: darwin
|
|
|
|
GOARCH: amd64
|
|
|
|
- task: build:wsh:internal
|
|
|
|
vars:
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: arm64
|
|
|
|
- task: build:wsh:internal
|
|
|
|
vars:
|
|
|
|
GOOS: linux
|
|
|
|
GOARCH: amd64
|
|
|
|
- task: build:wsh:internal
|
|
|
|
vars:
|
|
|
|
GOOS: windows
|
|
|
|
GOARCH: amd64
|
|
|
|
- task: build:wsh:internal
|
|
|
|
vars:
|
|
|
|
GOOS: windows
|
|
|
|
GOARCH: arm64
|
|
|
|
|
|
|
|
build:wsh:internal:
|
|
|
|
vars:
|
|
|
|
EXT:
|
|
|
|
sh: echo {{if eq .GOOS "windows"}}.exe{{end}}
|
|
|
|
requires:
|
|
|
|
vars:
|
|
|
|
- GOOS
|
|
|
|
- GOARCH
|
|
|
|
- VERSION
|
2024-06-21 23:44:11 +02:00
|
|
|
sources:
|
|
|
|
- "cmd/wsh/**/*.go"
|
|
|
|
- "pkg/**/*.go"
|
|
|
|
generates:
|
2024-07-18 03:42:49 +02:00
|
|
|
- dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.GOARCH}}{{.EXT}}
|
|
|
|
cmds:
|
2024-07-18 07:39:22 +02:00
|
|
|
- (CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')" -o dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.GOARCH}}{{.EXT}} cmd/wsh/main-wsh.go)
|
2024-06-21 23:44:11 +02:00
|
|
|
deps:
|
|
|
|
- go:mod:tidy
|
2024-07-18 03:42:49 +02:00
|
|
|
internal: true
|
2024-06-21 23:44:11 +02:00
|
|
|
|
2024-05-10 05:24:24 +02:00
|
|
|
go:mod:tidy:
|
2024-07-18 07:39:22 +02:00
|
|
|
desc: Runs `go mod tidy`
|
2024-05-10 05:24:24 +02:00
|
|
|
internal: true
|
|
|
|
generates:
|
|
|
|
- go.sum
|
|
|
|
sources:
|
|
|
|
- go.mod
|
|
|
|
cmds:
|
|
|
|
- go mod tidy
|