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 2
/
Copy pathbuild.sbt
95 lines (77 loc) · 3.12 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
import akka.grpc.gen.javadsl.play.{ PlayJavaClientCodeGenerator, PlayJavaServerCodeGenerator }
import sbt.Def
import sbt.Keys.dependencyOverrides
organization in ThisBuild := "com.example"
version in ThisBuild := "1.0-SNAPSHOT"
// the Java version that will be used for cross-compiled libraries
scalaVersion in ThisBuild := "2.12.8"
lagomServiceEnableSsl in ThisBuild := true
val `hello-impl-HTTPS-port` = 11000
val lagomGrpcTestkit = "com.lightbend.play" %% "lagom-javadsl-grpc-testkit" % "0.6.0"
lazy val `lagom-java-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(common)
.settings(
libraryDependencies ++= Seq(
lagomJavadslApi
)
)
lazy val `hello-impl` = (project in file("hello-impl"))
.enablePlugins(LagomJava)
.enablePlugins(AkkaGrpcPlugin) // enables source generation for gRPC
.enablePlugins(PlayAkkaHttp2Support) // enables serving HTTP/2 and gRPC
.settings(common)
.settings(
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Java),
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 += PlayJavaServerCodeGenerator,
// WORKAROUND: Lagom still can't register a service under the gRPC name so we hard-code
// the port and the use the value to add the entry on the Service Registry
lagomServiceHttpsPort := `hello-impl-HTTPS-port`,
libraryDependencies ++= Seq(
lagomJavadslTestKit,
lagomLogback,
lagomGrpcTestkit
)
).settings(lagomForkedTestSettings: _*)
.dependsOn(`hello-api`)
lazy val `hello-proxy-api` = (project in file("hello-proxy-api"))
.settings(common)
.settings(
libraryDependencies ++= Seq(
lagomJavadslApi
)
)
lazy val `hello-proxy-impl` = (project in file("hello-proxy-impl"))
.enablePlugins(LagomJava)
.enablePlugins(AkkaGrpcPlugin) // enables source generation for gRPC
.settings(common)
.settings(
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Java),
akkaGrpcExtraGenerators += PlayJavaClientCodeGenerator,
).settings(
libraryDependencies ++= Seq(
lagomJavadslTestKit,
lagomLogback
)
)
.dependsOn(`hello-proxy-api`, `hello-api`)
// 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)
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`}")
def common = Seq(
javacOptions in Compile ++= Seq("-Xlint:unchecked", "-Xlint:deprecation", "-parameters", "-Werror")
)