-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
80 lines (72 loc) · 2.88 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
import java.text.SimpleDateFormat
import java.util.Date
import Dependencies._
import com.typesafe.sbt.SbtNativePackager.autoImport.NativePackagerHelper._
import scala.util.Try
lazy val commonSettings = Seq(
organization := "com.thenetcircle",
scalaVersion := "2.12.8",
crossScalaVersions := Seq(scalaVersion.value, "2.11.12"),
crossVersion := CrossVersion.binary,
scalacOptions ++= Seq("-unchecked", "-deprecation"),
libraryDependencies ++= commonDependencies,
scalafmtOnCompile := true,
scalafmtVersion := "1.2.0"
)
lazy val root = (project in file("."))
.enablePlugins(JavaAppPackaging)
.settings(commonSettings)
.settings(
maintainer := "Baineng Ma <[email protected]>",
packageDescription := "A event distributing system stay among services",
packageSummary := "A event distributing system stay among services",
mappings in (Compile, packageDoc) := Seq(),
name := "runner",
mainClass in Compile := Some("com.thenetcircle.event_bus.Runner"),
discoveredMainClasses in Compile := Seq("com.thenetcircle.event_bus.admin.Admin"),
// integrate admin frontend static files
mappings in Universal ++= directory("admin/frontend/dist"),
bashScriptExtraDefines += """addJava "-Dapp.admin.static_dir=$(dirname $0)/../dist""""
)
.aggregate(core, admin) // run commands on each sub project
.dependsOn(core, admin) // does the actual aggregation
lazy val core = (project in file("core"))
.enablePlugins(BuildInfoPlugin)
.settings(commonSettings)
.settings(
libraryDependencies ++= coreDependencies,
buildInfoPackage := "com.thenetcircle.event_bus",
buildInfoObject := "BuildInfo",
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
scalaVersion,
sbtVersion,
BuildInfoKey.action("date")(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date())),
BuildInfoKey.action("commit")(Try(Process("git rev-parse HEAD").!!.stripLineEnd).getOrElse("?"))
)
)
lazy val buildFrontend = taskKey[Unit]("Build admin frontend")
lazy val admin = (project in file("admin/backend"))
.settings(commonSettings)
/*.settings(
buildFrontend := {
val frontendHomeDir = baseDirectory.value / ".." / "frontend"
def runNpmCommand(command: String) = {
println(s"""Running command "npm $command" in directory $frontendHomeDir""")
Process(s"npm $command", frontendHomeDir).!
}
if (runNpmCommand("install") != 0) throw new Exception("Npm install failed.")
if (runNpmCommand("run build") != 0) throw new Exception("Npm build failed.")
},
compile in Compile := (compile in Compile).dependsOn(buildFrontend).value
)*/
.dependsOn(core)
lazy val integrationTest = (project in file("integration-test"))
.settings(commonSettings)
.settings(
libraryDependencies ++= integrationTestDependencies,
parallelExecution := false
// fork in Test := true
)
.dependsOn(admin, core)