Skip to content

Commit

Permalink
feat: remove old kotlin and map it to the new runtime (#2381)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored Aug 15, 2024
1 parent 7029173 commit b8d399c
Show file tree
Hide file tree
Showing 96 changed files with 59 additions and 4,371 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.box
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN hermit install openjre-18.0.2.1_1
RUN hermit uninstall openjre
RUN hermit install jbr
RUN go version
RUN mvn -f kotlin-runtime/ftl-runtime -B --version
RUN mvn -f jvm-runtime/ftl-runtime -B --version

WORKDIR /src

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.controller
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /src

# Seed some of the most common tools - this will be cached
RUN go version
RUN mvn -f kotlin-runtime/ftl-runtime -B --version
RUN mvn -f jvm-runtime/ftl-runtime -B --version
RUN node --version

# Download Go dependencies separately so Docker will cache them
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.runner
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN hermit install openjre-18.0.2.1_1
RUN hermit uninstall openjre
RUN hermit install jbr
RUN go version
RUN mvn -f kotlin-runtime/ftl-runtime -B --version
RUN mvn -f jvm-runtime/ftl-runtime -B --version

WORKDIR /src

Expand Down
5 changes: 1 addition & 4 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ set shell := ["bash", "-c"]
WATCHEXEC_ARGS := "-d 1s -e proto -e go -e sql -f sqlc.yaml"
RELEASE := "build/release"
VERSION := `git describe --tags --always | 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/compile/main-work-template common-runtime/scaffolding go-runtime/scaffolding kotlin-runtime/scaffolding kotlin-runtime/external-module-template"
ZIP_DIRS := "go-runtime/compile/build-template go-runtime/compile/external-module-template go-runtime/compile/main-work-template common-runtime/scaffolding go-runtime/scaffolding"
FRONTEND_OUT := "frontend/dist/index.html"
EXTENSION_OUT := "extensions/vscode/dist/extension.js"
PROTOS_IN := "backend/protos/xyz/block/ftl/v1/schema/schema.proto backend/protos/xyz/block/ftl/v1/console/console.proto backend/protos/xyz/block/ftl/v1/ftl.proto backend/protos/xyz/block/ftl/v1/schema/runtime.proto"
Expand All @@ -30,7 +28,6 @@ clean:
rm -rf build
rm -rf frontend/node_modules
find . -name '*.zip' -exec rm {} \;
mvn -f kotlin-runtime/ftl-runtime clean
mvn -f jvm-runtime/ftl-runtime clean

# Live rebuild the ftl binary whenever source changes.
Expand Down
4 changes: 1 addition & 3 deletions buildengine/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ func buildModule(ctx context.Context, projectRootDir string, sch *schema.Schema,
switch module.Config.Language {
case "go":
err = buildGoModule(ctx, projectRootDir, sch, module, filesTransaction)
case "java":
case "java", "kotlin":
err = buildJavaModule(ctx, module)
case "kotlin":
err = buildKotlinModule(ctx, sch, module)
case "rust":
err = buildRustModule(ctx, sch, module)
default:
Expand Down
39 changes: 39 additions & 0 deletions buildengine/build_java.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package buildengine
import (
"context"
"fmt"
"path/filepath"

"github.com/beevik/etree"

"github.com/TBD54566975/ftl"
"github.com/TBD54566975/ftl/internal/exec"
"github.com/TBD54566975/ftl/internal/log"
)
Expand All @@ -21,3 +25,38 @@ func buildJavaModule(ctx context.Context, module Module) error {

return nil
}

// SetPOMProperties updates the ftl.version properties in the
// pom.xml file in the given base directory.
func SetPOMProperties(ctx context.Context, baseDir string) error {
logger := log.FromContext(ctx)
ftlVersion := ftl.Version
if ftlVersion == "dev" {
ftlVersion = "1.0-SNAPSHOT"
}

pomFile := filepath.Clean(filepath.Join(baseDir, "pom.xml"))

logger.Debugf("Setting ftl.version in %s to %s", pomFile, ftlVersion)

tree := etree.NewDocument()
if err := tree.ReadFromFile(pomFile); err != nil {
return fmt.Errorf("unable to read %s: %w", pomFile, err)
}
root := tree.Root()
properties := root.SelectElement("properties")
if properties == nil {
return fmt.Errorf("unable to find <properties> in %s", pomFile)
}
version := properties.SelectElement("ftl.version")
if version == nil {
return fmt.Errorf("unable to find <properties>/<ftl.version> in %s", pomFile)
}
version.SetText(ftlVersion)

err := tree.WriteToFile(pomFile)
if err != nil {
return fmt.Errorf("unable to write %s: %w", pomFile, err)
}
return nil
}
237 changes: 0 additions & 237 deletions buildengine/build_kotlin.go

This file was deleted.

Loading

0 comments on commit b8d399c

Please sign in to comment.