generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: replace bit with Justfile (#1109)
This was way more work and way more irritating than I hoped it would be. I was hoping to switch back to make, but make doesn't support spaces in filenames. Then I tried ninja, which doesn't support "|" in filenames. Finally, I tried just using Just, but the lack of a dependency system meant that really slow targets like the kt-runtime and npm made it unreasonably painful. So in the end I wrote a [little tool](https://github.com/alecthomas/mktg) which acts like a single "make" target entry, executing the provided command if any input is newer than all outputs. This gives us fairly fast incremental builds with little complexity.
- Loading branch information
1 parent
ac7953b
commit cc18bf3
Showing
20 changed files
with
77 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,65 @@ | ||
set positional-arguments | ||
|
||
# Start a hot-reloading dev cluster | ||
dev: install-jars | ||
goreman -logtime=false start | ||
RELEASE := "build/release" | ||
VERSION := `git describe --tags --always --dirty | sed -e 's/^v//'` | ||
KT_RUNTIME_OUT := "kotlin-runtime/ftl-runtime/target/ftl-runtime-1.0-SNAPSHOT.jar" | ||
KT_RUNTIME_RUNNER_TEMPLATE_OUT := "build/template/ftl/jars/ftl-runtime.jar" | ||
RUNNER_TEMPLATE_ZIP := "backend/controller/scaling/localscaling/template.zip" | ||
TIMESTAMP := `date +%s` | ||
SCHEMA_OUT := "backend/protos/xyz/block/ftl/v1/schema/schema.proto" | ||
ZIP_DIRS := "go-runtime/compile/build-template go-runtime/compile/external-module-template go-runtime/scaffolding kotlin-runtime/scaffolding kotlin-runtime/external-module-template" | ||
FRONTEND_OUT := "frontend/dist/index.html" | ||
|
||
# Install all JARs to local Maven repository and local build directory | ||
install-jars: | ||
bit 'kotlin-runtime/**/*.jar' | ||
_help: | ||
@just -l | ||
|
||
# Deploy the Go time module | ||
deploy-time: | ||
ftl deploy examples/time | ||
# Run errtrace on Go files to add stacks | ||
errtrace: | ||
git ls-files -z -- '*.go' | grep -zv /_ | xargs -0 errtrace -w && go mod tidy | ||
|
||
# Deploy the Kotlin echo module | ||
deploy-echo-kotlin: | ||
ftl deploy examples/echo-kotlin | ||
# Build everything | ||
build-all: build-frontend build-generate build-kt-runtime build-protos build-sqlc build-zips | ||
just build ftl | ||
|
||
regen-schema: | ||
bit backend/protos/xyz/block/ftl/v1/schema/schema.proto | ||
bit backend/protos/xyz/block/ftl/v1/schema/schema.pb.go | ||
# Run "go generate" on all packages | ||
build-generate: | ||
go generate -x ./... | ||
|
||
# Run errtrace on Go files to add stacks | ||
errtrace: | ||
git ls-files -z -- '*.go' | grep -zv /_ | xargs -0 errtrace -w && go mod tidy | ||
# Build command-line tools | ||
build +tools: build-protos build-sqlc build-zips build-frontend | ||
for tool in $@; do go build -o "{{RELEASE}}/$tool" -tags release -ldflags "-X github.com/TBD54566975/ftl.Version={{VERSION}} -X github.com/TBD54566975/ftl.Timestamp={{TIMESTAMP}}" "./cmd/$tool"; done | ||
|
||
export DATABASE_URL := "postgres://postgres:secret@localhost:54320/ftl?sslmode=disable" | ||
|
||
# Explicitly initialise the database | ||
init-db: | ||
dbmate drop || true | ||
dbmate create | ||
dbmate --migrations-dir backend/controller/sql/schema up | ||
|
||
# Regenerate SQLC code | ||
build-sqlc: | ||
sqlc generate --experimental | ||
|
||
# Build the ZIP files that are embedded in the FTL release binaries | ||
build-zips: build-kt-runtime | ||
for dir in {{ZIP_DIRS}}; do (cd $dir && rm -f $(basename ${dir}.zip) && zip -q --symlinks -r ../$(basename ${dir}).zip .); done | ||
|
||
# Rebuild frontend | ||
build-frontend: npm-install | ||
mktg {{FRONTEND_OUT}} : frontend/src -- "cd frontend && npm run build" | ||
|
||
# Build the Kotlin runtime (if necessary) | ||
build-kt-runtime: | ||
mkdir -p $(dirname {{KT_RUNTIME_RUNNER_TEMPLATE_OUT}}) | ||
mktg {{KT_RUNTIME_OUT}} : kotlin-runtime/ftl-runtime -- mvn -f kotlin-runtime/ftl-runtime -Dmaven.test.skip=true -B install | ||
install -m 0600 {{KT_RUNTIME_OUT}} {{KT_RUNTIME_RUNNER_TEMPLATE_OUT}} | ||
mktg {{RUNNER_TEMPLATE_ZIP}} : {{KT_RUNTIME_RUNNER_TEMPLATE_OUT}} -- "cd build/template && zip -q --symlinks -r ../../{{RUNNER_TEMPLATE_ZIP}} ." | ||
|
||
# Install Node dependencies | ||
npm-install: | ||
mktg frontend/node_modules : frontend/package.json frontend/src -- "cd frontend && npm install" | ||
|
||
# Regenerate protos | ||
build-protos: npm-install | ||
mktg {{SCHEMA_OUT}} : backend/schema -- "ftl-schema > {{SCHEMA_OUT}} && buf format -w && buf lint && cd backend/protos && buf generate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.dbmate-2.13.0.pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.mktg-0.3.0.pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters