Skip to content

Commit

Permalink
refactor: move /backend/common to /internal (#946)
Browse files Browse the repository at this point in the history
Effectively none of this code was exclusive to the backend, being used
by the CLI and even frontend.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
alecthomas and github-actions[bot] authored Feb 16, 2024
1 parent 16d623e commit 52e3c27
Show file tree
Hide file tree
Showing 171 changed files with 5,819 additions and 4,847 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ linters-settings:
- pkg: braces.dev/errtrace
desc: "use fmt.Errorf or errors.New"
- pkg: os/exec
desc: "use github.com/TBD54566975/ftl/backend/common/exec"
desc: "use github.com/TBD54566975/ftl/internal/exec"
# wrapcheck:
# ignorePackageGlobs:
# - github.com/TBD54566975/ftl/*
Expand Down
27 changes: 10 additions & 17 deletions Bitfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,27 @@ RELEASE = %{DEST}/release
GO_SOURCES = **/*.go

SCHEMA_IN = backend/schema/**/*.go cmd/ftl-schema/**/*.go
SCHEMA_OUT = protos/xyz/block/ftl/v1/schema/schema.proto
SCHEMA_OUT = backend/protos/xyz/block/ftl/v1/schema/schema.proto

NODE_PROTOC_PLUGINS = frontend/node_modules/.bin/protoc-gen-connect-es \
frontend/node_modules/.bin/protoc-gen-es

PROTO_IN = **/*.proto **/buf.* bin/protoc* bin/buf %{NODE_PROTOC_PLUGINS}
# There's no real way to mechanically generate the list of outputs, so we just
# explicitly list them here.
PROTO_OUT = protos/xyz/block/ftl/v1/ftlv1connect/ftl.connect.go \
protos/xyz/block/ftl/v1/schema/schema.pb.go \
protos/xyz/block/ftl/v1/console/console.pb.go \
protos/xyz/block/ftl/v1/schema/runtime.pb.go \
protos/xyz/block/ftl/v1/ftl.pb.go \
PROTO_OUT = backend/protos/xyz/block/ftl/v1/ftlv1connect/ftl.connect.go \
backend/protos/xyz/block/ftl/v1/schema/schema.pb.go \
backend/protos/xyz/block/ftl/v1/console/console.pb.go \
backend/protos/xyz/block/ftl/v1/schema/runtime.pb.go \
backend/protos/xyz/block/ftl/v1/ftl.pb.go \
frontend/src/protos/xyz/block/ftl/v1/ftl_connect.ts \
frontend/src/protos/xyz/block/ftl/v1/schema/schema_pb.ts \
frontend/src/protos/xyz/block/ftl/v1/schema/runtime_pb.ts \
frontend/src/protos/xyz/block/ftl/v1/ftl_pb.ts \
frontend/src/protos/xyz/block/ftl/v1/console/console_pb.ts \
frontend/src/protos/google/protobuf/timestamp_pb.ts \
frontend/src/protos/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.ts \
frontend/src/protos/opentelemetry/proto/common/v1/common_pb.ts \
frontend/src/protos/opentelemetry/proto/metrics/v1/metrics_pb.ts \
frontend/src/protos/opentelemetry/proto/resource/v1/resource_pb.ts \
frontend/src/protos/opentelemetry/proto/trace/v1/trace_pb.ts
frontend/src/protos/xyz/block/ftl/v1/console/console_pb.ts

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

KT_RUNTIME_IN = kotlin-runtime/ftl-runtime/**/*.{kt,kts} pom.xml kotlin-runtime/ftl-runtime/**/pom.xml
KT_RUNTIME_OUT = kotlin-runtime/ftl-runtime/target/ftl-runtime-1.0-SNAPSHOT.jar
Expand Down Expand Up @@ -111,8 +105,7 @@ kotlin-runtime/scaffolding.zip: kotlin-runtime/scaffolding/**/*
build:
buf format -w
buf lint
(cd protos && buf generate)
(cd backend/common/3rdparty/protos && buf generate)
(cd backend/protos && buf generate)
# There's a build cycle dependency here, so we can't clean: ftl-schema depends on generated .pb.go files
-clean

Expand Down
4 changes: 2 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ deploy-echo-kotlin:
ftl deploy examples/echo-kotlin

regen-schema:
bit protos/xyz/block/ftl/v1/schema/schema.proto
bit protos/xyz/block/ftl/v1/schema/schema.pb.go
bit backend/protos/xyz/block/ftl/v1/schema/schema.proto
bit backend/protos/xyz/block/ftl/v1/schema/schema.pb.go

# Run errtrace on Go files to add stacks
errtrace:
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
controller: watchexec -r -e go -i "frontend" -i "examples/**" -- ftl-controller --key C01H5BRT09Y07547SETZ4HWRA09 --bind http://localhost:8892
regenerate: watchexec -e yaml -e sql -e proto -i "frontend" -i "examples/**" --debounce 1s -- bit protos/xyz/block/ftl/v1/schema/schema.proto protos/xyz/block/ftl/v1/ftlv1connect/ftl.connect.go backend/controller/sql/db.go
regenerate: watchexec -e yaml -e sql -e proto -i "frontend" -i "examples/**" --debounce 1s -- bit backend/protos/xyz/block/ftl/v1/schema/schema.proto backend/protos/xyz/block/ftl/v1/ftlv1connect/ftl.connect.go backend/controller/sql/db.go
runner0: watchexec -r -e go -i "frontend" -i "examples/**" -- ftl-runner --key R01H5BTS6ABP1EHGZSAGJMBV50A --language go --language kotlin --bind http://localhost:8894 --template-dir build/template
runner1: watchexec -r -e go -i "frontend" -i "examples/**" -- ftl-runner --key R01H5BTSGKQ8AZ9S22N9N1SM9HV --language go --language kotlin --bind http://localhost:8895 --template-dir build/template
runner2: watchexec -r -e go -i "frontend" -i "examples/**" -- ftl-runner --key R01H8DD0H13WX636B70WV7D216G --language go --language kotlin --bind http://localhost:8896 --template-dir build/template
Expand Down
4 changes: 2 additions & 2 deletions authn/authn.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

"github.com/zalando/go-keyring"

"github.com/TBD54566975/ftl/backend/common/exec"
"github.com/TBD54566975/ftl/backend/common/log"
"github.com/TBD54566975/ftl/internal/exec"
"github.com/TBD54566975/ftl/internal/log"
)

// GetAuthenticationHeaders returns authentication headers for the given endpoint.
Expand Down
11 changes: 0 additions & 11 deletions backend/common/3rdparty/protos/buf.gen.yaml

This file was deleted.

144 changes: 0 additions & 144 deletions backend/common/3rdparty/protos/google/protobuf/timestamp.proto

This file was deleted.

This file was deleted.

Loading

0 comments on commit 52e3c27

Please sign in to comment.