Skip to content

Commit

Permalink
Remove Lagom-pb, Akka gRPC and use Akka persistence and scalapb-grpc(#…
Browse files Browse the repository at this point in the history
…123)

remove lagom-pb, Akka gRPC and mainly use Akka persistence and scalapb-grpc

Co-authored-by: zen <[email protected]>
Co-authored-by: Kelvin Mungai <[email protected]>
  • Loading branch information
3 people authored Nov 17, 2020
1 parent 9e72707 commit efe03c3
Show file tree
Hide file tree
Showing 98 changed files with 5,052 additions and 3,707 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ logs
*.iml
project/metals.sbt
.protogen/
.protogen_test/
.DS_Store
protos/chief_of_state/target
.target/
.vscode/
metals.sbt
/tmp/
20 changes: 1 addition & 19 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ all:
# target running it all
BUILD +test-all
BUILD +docker-build
BUILD +sbt-publish

sbt-publish:
FROM +code

ARG VERSION=dev

# sbt publish
RUN --push \
--secret JFROG_USERNAME=+secrets/JFROG_USERNAME \
--secret JFROG_PASSWORD=+secrets/JFROG_PASSWORD \
sbt publish

code:
# copy relevant files in, save as a base image
Expand Down Expand Up @@ -44,8 +32,8 @@ code:
project/Dependencies.scala \
project/DockerSettings.scala \
project/plugins.sbt \
project/ProtocRuntime.scala \
project/Publish.scala \
project/protoc.sbt \
./project/

# clean & install dependencies
Expand All @@ -59,9 +47,6 @@ code:
COPY --chown $BUILD_USR:root code/service/src ./code/service/src
COPY --chown $BUILD_USR:root code/plugin/src ./code/plugin/src

# save base image for use downstream
SAVE IMAGE

docker-stage:
# package the jars/executables
FROM +code
Expand Down Expand Up @@ -101,7 +86,6 @@ test-local:
ARG CODECOV_TOKEN=""
ENV CODECOV_TOKEN=${CODECOV_TOKEN}
RUN sbt coverage test coverageAggregate
SAVE IMAGE

codecov:
FROM +test-local
Expand All @@ -127,5 +111,3 @@ sbt:
apt-get update && \
apt-get install sbt && \
sbt sbtVersion

SAVE IMAGE
73 changes: 49 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
import play.grpc.gen.scaladsl.PlayScalaServerCodeGenerator

parallelExecution in test := false
enablePlugins(DockerComposePlugin)
dockerImageCreationTask := (Docker / publishLocal in `chiefofstate`).value
dockerImageCreationTask := (Docker / publishLocal in chiefofstate).value

lazy val root: Project = project
.in(file("."))
.enablePlugins(NoPublish)
.aggregate(protogen, `chiefofstate`, `chiefofstateplugins`)
.aggregate(protogen, chiefofstate, chiefofstateplugins, protogenTest)

lazy val `chiefofstate`: Project = project
lazy val chiefofstate: Project = project
.in(file("code/service"))
.enablePlugins(LagomScala)
.enablePlugins(PlayAkkaHttp2Support)
.enablePlugins(Common)
.enablePlugins(BuildSettings)
.enablePlugins(DockerSettings)
.enablePlugins(NoPublish)
.settings(
name := "chiefofstate",
javaAgents += Dependencies.Compile.KanelaAgent
)
.dependsOn(protogen, `chiefofstateplugins`)
.settings(name := "chiefofstate")
.dependsOn(protogen, chiefofstateplugins, protogenTest % "test->compile")

lazy val `chiefofstateplugins` = project
lazy val chiefofstateplugins = project
.in(file("code/plugin"))
.enablePlugins(Common)
.enablePlugins(LagomScala)
.enablePlugins(BuildSettings)
.enablePlugins(DockerSettings)
.enablePlugins(NoPublish)
.settings(
name := "chiefofstateplugins",
name := "chiefofstate-plugins",
description := "Chief of State Plugins"
)
.dependsOn(protogen)

lazy val protogen: Project = project
.in(file("code/.protogen"))
.enablePlugins(AkkaGrpcPlugin)
.enablePlugins(ProtocRuntime)
.enablePlugins(Common)
.enablePlugins(BuildSettings)
.enablePlugins(NoPublish)
.settings(name := "protogen")
.settings(
Expand All @@ -52,13 +48,42 @@ lazy val protogen: Project = project
file("proto/internal"),
// includes external protobufs (like google dependencies)
baseDirectory.value / "target/protobuf_external"
),
PB.targets := Seq(
scalapb.gen(
flatPackage = false,
javaConversions = false,
grpc = true
) -> (sourceManaged in Compile).value / "scalapb"
)
)
),
// Using Scala
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
akkaGrpcExtraGenerators in Compile += PlayScalaServerCodeGenerator,
akkaGrpcGeneratedSources := Seq(AkkaGrpc.Server),
akkaGrpcCodeGeneratorSettings += "server_power_apis",
akkaGrpcCodeGeneratorSettings := akkaGrpcCodeGeneratorSettings.value.filterNot(_ == "flat_package")
)
)

lazy val protogenTest: Project = project
.in(file("code/.protogen_test"))
.enablePlugins(Common)
.enablePlugins(BuildSettings)
.enablePlugins(NoPublish)
.settings(name := "protogen_test")
.settings(
inConfig(Compile)(
Seq(
PB.protoSources := Seq(
file("proto/test")
),
PB.includePaths := Seq(
file("proto/test"),
// includes external protobufs (like google dependencies)
baseDirectory.value / "target/protobuf_external"
),
PB.targets := Seq(
scalapb.gen(
flatPackage = false,
javaConversions = false,
grpc = true
) -> (sourceManaged in Compile).value / "scalapb"
)
)
)
)

This file was deleted.

This file was deleted.

Loading

0 comments on commit efe03c3

Please sign in to comment.