This repository has been archived by the owner on May 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.sbt
102 lines (80 loc) · 3.51 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import akka.grpc.gen.scaladsl.play.{ PlayScalaClientCodeGenerator, PlayScalaServerCodeGenerator }
organization in ThisBuild := "com.example"
version in ThisBuild := "1.0-SNAPSHOT"
// the Scala version that will be used for cross-compiled libraries
scalaVersion in ThisBuild := "2.12.8"
val macwire = "com.softwaremill.macwire" %% "macros" % "2.3.0" % "provided"
val scalaTest = "org.scalatest" %% "scalatest" % "3.0.4" % Test
val lagomGrpcTestkit = "com.lightbend.play" %% "lagom-scaladsl-grpc-testkit" % "0.6.0"
lagomServiceEnableSsl in ThisBuild := true
val `hello-impl-HTTPS-port` = 11000
// ALL SETTINGS HERE ARE TEMPORARY WORKAROUNDS FOR KNOWN ISSUES OR WIP
def workaroundSettings: Seq[sbt.Setting[_]] = Seq(
// Lagom still can't register a service under the gRPC name so we hard-code t
// he port and the use the value to add the entry on the Service Registry
lagomServiceHttpsPort := `hello-impl-HTTPS-port`
)
lazy val `lagom-scala-grpc-example` = (project in file("."))
.aggregate(`hello-api`, `hello-impl`, `hello-proxy-api`, `hello-proxy-impl`)
lazy val `hello-api` = (project in file("hello-api"))
.settings(
libraryDependencies += lagomScaladslApi
)
lazy val `hello-impl` = (project in file("hello-impl"))
.enablePlugins(LagomScala)
.enablePlugins(AkkaGrpcPlugin) // enables source generation for gRPC
.enablePlugins(PlayAkkaHttp2Support) // enables serving HTTP/2 and gRPC
.settings(
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
akkaGrpcGeneratedSources :=
Seq(
AkkaGrpc.Server,
AkkaGrpc.Client // the client is only used in tests. See https://github.com/akka/akka-grpc/issues/410
),
akkaGrpcExtraGenerators in Compile += PlayScalaServerCodeGenerator,
).settings(
workaroundSettings:_*
).settings(
libraryDependencies ++= Seq(
lagomScaladslTestKit,
macwire,
scalaTest,
lagomGrpcTestkit
)
).settings(lagomForkedTestSettings: _*)
.dependsOn(`hello-api`)
lazy val `hello-proxy-api` = (project in file("hello-proxy-api"))
.settings(
libraryDependencies +=lagomScaladslApi
)
lazy val `hello-proxy-impl` = (project in file("hello-proxy-impl"))
.enablePlugins(LagomScala)
.enablePlugins(AkkaGrpcPlugin) // enables source generation for gRPC
.settings(
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
akkaGrpcExtraGenerators += PlayScalaClientCodeGenerator,
).settings(
libraryDependencies ++= Seq(
lagomScaladslTestKit,
macwire,
scalaTest
)
)
.dependsOn(`hello-proxy-api`, `hello-api`)
// This sample application doesn't need either Kafka or Cassandra so we disable them
// to make the devMode startup faster.
lagomCassandraEnabled in ThisBuild := false
lagomKafkaEnabled in ThisBuild := false
// This adds an entry on the LagomDevMode Service Registry. With this information on
// the Service Registry a client using Service Discovery to Lookup("helloworld.GreeterService")
// will get "https://localhost:11000" and then be able to send a request.
// See declaration and usages of `hello-impl-HTTPS-port`.
lagomUnmanagedServices in ThisBuild := Map("helloworld.GreeterService" -> s"https://localhost:${`hello-impl-HTTPS-port`}")
//----------------------------------
// Documentation for this project:
// sbt "project docs" "~ paradox"
// open docs/target/paradox/site/main/index.html
lazy val docs = (project in file("docs"))
.enablePlugins(ParadoxPlugin)
//----------------------------------
ThisBuild / scalacOptions ++= List("-encoding", "utf8", "-deprecation", "-feature", "-unchecked")