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 30
/
Copy pathbuild.sbt
151 lines (123 loc) · 4.97 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import java.nio.file.{Files, StandardCopyOption}
import com.typesafe.sbt.web.SbtWeb
organization in ThisBuild := "com.lightbend.lagom.sample.chirper"
// the Scala version that will be used for cross-compiled libraries
scalaVersion in ThisBuild := "2.12.8"
// SCALA SUPPORT: Remove the line below
EclipseKeys.projectFlavor in Global := EclipseProjectFlavor.Java
lazy val buildVersion = sys.props.getOrElse("buildVersion", "1.0.0-SNAPSHOT")
version in ThisBuild := buildVersion
val dockerSettings = Seq(
dockerRepository := sys.props.get("dockerRepository"),
rpMemory := 512 * 1024 * 1024,
rpCpu := 0.25
)
lazy val friendApi = project("friend-api")
.settings(
libraryDependencies += lagomJavadslApi
)
lazy val friendImpl = project("friend-impl")
.enablePlugins(LagomJava, SbtReactiveAppPlugin)
.settings(
libraryDependencies ++= Seq(
lagomJavadslPersistenceCassandra,
lagomJavadslTestKit
)
)
.settings(dockerSettings: _*)
.settings(lagomForkedTestSettings: _*)
.dependsOn(friendApi)
lazy val chirpApi = project("chirp-api")
.settings(
libraryDependencies ++= Seq(
lagomJavadslApi,
lagomJavadslJackson
)
)
lazy val chirpImpl = project("chirp-impl")
.enablePlugins(LagomJava, SbtReactiveAppPlugin)
.settings(
libraryDependencies ++= Seq(
lagomJavadslPersistenceCassandra,
lagomJavadslPubSub,
lagomJavadslTestKit
)
)
.settings(lagomForkedTestSettings: _*)
.settings(dockerSettings: _*)
.dependsOn(chirpApi)
lazy val activityStreamApi = project("activity-stream-api")
.settings(
libraryDependencies += lagomJavadslApi
)
.dependsOn(chirpApi)
lazy val activityStreamImpl = project("activity-stream-impl")
.enablePlugins(LagomJava, SbtReactiveAppPlugin)
.settings(
libraryDependencies ++= Seq(
lagomJavadslTestKit
)
)
.settings(dockerSettings: _*)
.dependsOn(activityStreamApi, chirpApi, friendApi)
lazy val frontEnd = project("front-end")
.enablePlugins(PlayJava, LagomPlay, SbtReactiveAppPlugin)
.disablePlugins(PlayLayoutPlugin)
.settings(
routesGenerator := InjectedRoutesGenerator,
libraryDependencies ++= Seq(
"org.webjars" % "foundation" % "5.5.2",
"org.webjars" %% "webjars-play" % "2.6.3",
lagomJavadslClient
),
includeFilter in webpack := "*.js" || "*.jsx",
compile in Compile := (compile in Compile).dependsOn(webpack.toTask("")).value,
mappings in (Compile, packageBin) := {
val compiledJsFiles = (WebKeys.public in Assets).value.listFiles().toSeq
val publicJsFileMappings = compiledJsFiles.map { jsFile =>
jsFile -> s"public/${jsFile.getName}"
}
val webJarsPathPrefix = SbtWeb.webJarsPathPrefix.value
val compiledWebJarsBaseDir = (classDirectory in Assets).value / webJarsPathPrefix
val compiledFilesWebJars = compiledJsFiles.map { compiledJs =>
val compiledJsWebJar = compiledWebJarsBaseDir / compiledJs.getName
Files.copy(compiledJs.toPath, compiledJsWebJar.toPath, StandardCopyOption.REPLACE_EXISTING)
compiledJsWebJar
}
val webJarJsFileMappings = compiledFilesWebJars.map { jsFile =>
jsFile -> s"${webJarsPathPrefix}/${jsFile.getName}"
}
(mappings in (Compile, packageBin)).value ++ publicJsFileMappings ++ webJarJsFileMappings
},
sourceDirectory in Assets := baseDirectory.value / "src" / "main" / "resources" / "assets",
resourceDirectory in Assets := baseDirectory.value / "src" / "main" / "resources" / "public",
PlayKeys.playMonitoredFiles ++=
(sourceDirectories in (Compile, TwirlKeys.compileTemplates)).value :+
(sourceDirectory in Assets).value :+
(resourceDirectory in Assets).value,
WebpackKeys.envVars in webpack += "BUILD_SYSTEM" -> "sbt",
// Remove to use Scala IDE
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources),
rpHttpIngressPaths := Seq("/")
)
.settings(dockerSettings: _*)
lazy val loadTestApi = project("load-test-api")
.settings(
libraryDependencies += lagomJavadslApi
)
lazy val loadTestImpl = project("load-test-impl")
.enablePlugins(LagomJava, SbtReactiveAppPlugin)
.dependsOn(loadTestApi, friendApi, activityStreamApi, chirpApi)
.settings(dockerSettings: _*)
def project(id: String) = Project(id, base = file(id))
.settings(javacOptions in compile ++= Seq("-encoding", "UTF-8", "-source", "1.8", "-target", "1.8", "-Xlint:unchecked", "-Xlint:deprecation"))
.settings(jacksonParameterNamesJavacSettings: _*) // applying it to every project even if not strictly needed.
// See https://github.com/FasterXML/jackson-module-parameter-names
lazy val jacksonParameterNamesJavacSettings = Seq(
javacOptions in compile += "-parameters"
)
// do not delete database files on start
lagomCassandraCleanOnStart in ThisBuild := false
// Kafka can be disabled until we need it
lagomKafkaEnabled in ThisBuild := false
licenses in ThisBuild := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))