Skip to content

Commit

Permalink
chore: fix for local dev rebuilding ftl-runtime.jar on every run (#1049)
Browse files Browse the repository at this point in the history
This was occurring because frontend/local.go was calling `npm install`
explicitly on every run, resulting in changes to the frontend that
invalidated some of the dependencies of the JAR file.

The fix is to use `bit` to build the frontend as well, resulting in its
dependency cache being correct.
  • Loading branch information
alecthomas authored Mar 8, 2024
1 parent 685d34b commit 759b2f3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Bitfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ kotlin-runtime/external-module-template.zip: kotlin-runtime/external-module-temp
# TODO: Figure out how to make Maven build completely offline. Bizarrely "-o" does not do this.
build:
mvn -B -N install
mvn -B -pl :ftl-runtime install
mvn -Dmaven.test.skip=true -B -pl :ftl-runtime install
+clean: mvn -B -pl :ftl-runtime clean

%(dirname %{KT_RUNTIME_RUNNER_TEMPLATE_OUT})%:
Expand Down
2 changes: 1 addition & 1 deletion backend/controller/scaling/localscaling/devel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var templateDirOnce sync.Once
func templateDir(ctx context.Context) string {
templateDirOnce.Do(func() {
// TODO: Figure out how to make maven build offline
err := exec.Command(ctx, log.Debug, internal.GitRoot(""), "bit", "build/template/ftl/jars/ftl-runtime.jar").RunBuffered(ctx)
err := exec.Command(ctx, log.Debug, internal.GitRoot(""), "bit", "--level=trace", "build/template/ftl/jars/ftl-runtime.jar").RunBuffered(ctx)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion deployment/db-migrate/schema
3 changes: 2 additions & 1 deletion frontend/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/url"
"time"

"github.com/TBD54566975/ftl/internal"
"github.com/TBD54566975/ftl/internal/cors"
"github.com/TBD54566975/ftl/internal/exec"
"github.com/TBD54566975/ftl/internal/log"
Expand All @@ -21,7 +22,7 @@ func Server(ctx context.Context, timestamp time.Time, publicURL *url.URL, allowO
logger := log.FromContext(ctx)
logger.Debugf("Building console...")

err := exec.Command(ctx, log.Debug, "frontend", "npm", "install").RunBuffered(ctx)
err := exec.Command(ctx, log.Debug, internal.GitRoot(""), "bit", "frontend/**/*").RunBuffered(ctx)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 759b2f3

Please sign in to comment.