Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
feat: build new release binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed May 30, 2023
1 parent 7d868ba commit be24cf7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
VERSION = $(shell git describe --tags --always --dirty)

BINARIES=ftl ftl-control-plane ftl-runner-go

COMMON_LOG_IN = common/log/api.go
COMMON_LOG_OUT = common/log/log_level_string.go

Expand Down Expand Up @@ -38,7 +40,11 @@ release:
cd console && npm run build
rm -rf build
mkdir -p build
go build -o build/ftl -tags release -ldflags "-X main.version=$(VERSION)" ./cmd/ftl
for binary in $(BINARIES); do \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/$$binary-linux-amd64 -tags release -ldflags "-X main.version=$(VERSION)" ./cmd/$$binary ; \
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/$$binary-darwin-amd64 -tags release -ldflags "-X main.version=$(VERSION)" ./cmd/$$binary ; \
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/$$binary-darwin-arm64 -tags release -ldflags "-X main.version=$(VERSION)" ./cmd/$$binary ; \
done

.PHONY: generate
generate: $(SQLC_OUT) $(SCHEMA_OUT) $(PROTO_OUT) $(COMMON_LOG_OUT) ## Regenerate source.
Expand Down
4 changes: 4 additions & 0 deletions cmd/ftl-control-plane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (
"github.com/TBD54566975/ftl/controlplane"
)

var version = "dev"

var cli struct {
Version kong.VersionFlag `help:"Show version."`
LogConfig log.Config `embed:"" prefix:"log-"`
ControlPlaneConfig controlplane.Config `embed:""`
}
Expand All @@ -19,6 +22,7 @@ func main() {
kctx := kong.Parse(&cli,
kong.Description(`FTL - Towards a 𝝺-calculus for large-scale systems`),
kong.UsageOnError(),
kong.Vars{"version": version},
)
ctx := log.ContextWithLogger(context.Background(), log.Configure(os.Stderr, cli.LogConfig))
err := controlplane.Start(ctx, cli.ControlPlaneConfig)
Expand Down
8 changes: 6 additions & 2 deletions cmd/ftl-runner-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import (
runner "github.com/TBD54566975/ftl/runner-go"
)

var version = "dev"

var config struct {
LogConfig log.Config `prefix:"log-" embed:""`
RunnerConfig runner.Config `embed:""`
Version kong.VersionFlag `help:"Show version."`
LogConfig log.Config `prefix:"log-" embed:""`
RunnerConfig runner.Config `embed:""`
}

func main() {
Expand All @@ -28,6 +31,7 @@ FTL - Towards a 𝝺-calculus for large-scale systems
The Runner is the component of FTL that coordinates with the ControlPlane to spawn
and route to user code.
`), kong.Vars{
"version": version,
"deploymentdir": filepath.Join(cacheDir, "ftl-runner-go", "deployments"),
})
logger := log.Configure(os.Stderr, config.LogConfig)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ftl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
var version = "dev"

type CLI struct {
Version kong.VersionFlag `help:"Show version information."`
Version kong.VersionFlag `help:"Show version."`
LogConfig log.Config `embed:"" prefix:"log-" group:"Logging:"`
Endpoint *url.URL `default:"http://127.0.0.1:8892" help:"FTL endpoint to bind/connect to." env:"FTL_ENDPOINT"`

Expand Down

0 comments on commit be24cf7

Please sign in to comment.