-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
125 lines (116 loc) · 3.72 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
// shadow sbt-scalajs' crossProject and CrossType until Scala.js 1.0.0 is released
import sbtcrossproject.{crossProject, CrossType}
import scalajscrossproject.ScalaJSCrossPlugin.autoImport.{
toScalaJSGroupID => _,
_
}
import sys.process._
scalaVersion in ThisBuild := "2.12.4"
version in ThisBuild := {
("git describe --always --dirty=-SNAPSHOT --match v[0-9].*" !!).tail.trim
}
lazy val vendor = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.settings(
scalacOptions ++= Seq("-feature",
"-language:_",
"-unchecked",
"-deprecation",
"-Xlint",
"-encoding",
"utf8"),
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.6.3" % "test",
testFrameworks += new TestFramework("utest.runner.Framework"),
)
.nativeSettings(
scalaVersion := "2.11.12",
nativeLinkStubs := true
)
lazy val vendorJVM = vendor.jvm
lazy val vendorJS = vendor.js
lazy val vendorNative = vendor.native
lazy val shared = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.dependsOn(vendor)
.settings(
testFrameworks += new TestFramework("utest.runner.Framework"),
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.6.3" % "test",
sourceGenerators in Compile += Def.task {
val file = (sourceManaged in Compile).value / "scala" / "BuildInfo.scala"
val content =
s"""package crashbox.ci
|object BuildInfo {
| final val Version: String = "${version.value}"
|}
|""".stripMargin
IO.write(file, content)
Seq(file)
}
)
.jsSettings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.2",
"org.singlespaced" %%% "scalajs-d3" % "0.3.4"
)
)
.nativeSettings(
scalaVersion := "2.11.12",
nativeLinkStubs := true,
sourceGenerators in Compile += Def.task {
val file = (sourceManaged in Compile).value / "scala" / "NativeBuildInfo.scala"
val content =
s"""package crashbox.ci
|object NativeBuildInfo {
| final val Platform: String = "${("uname -s" !!).trim}/${("uname -m" !!).trim}"
| final val NativeVersion: String = "${nativeVersion}"
|}
|""".stripMargin
IO.write(file, content)
Seq(file)
}
)
lazy val sharedJvm = shared.jvm
lazy val sharedJs = shared.js
lazy val sharedNative = shared.native
lazy val server = (project in file("server"))
.enablePlugins(SbtTwirl)
.settings(
name := "crashboxd",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "10.0.11",
"com.typesafe.slick" %% "slick" % "3.2.1",
"org.slf4j" % "slf4j-nop" % "1.6.4",
"org.xerial" % "sqlite-jdbc" % "3.21.0.1"
//"com.h2database" % "h2" % "1.4.196"
)
)
.settings(Js.dependsOnJs(ui))
.dependsOn(sharedJvm)
lazy val ui = (project in file("ui"))
.enablePlugins(ScalaJSPlugin)
.disablePlugins(RevolverPlugin)
.dependsOn(sharedJs)
lazy val cbx = (project in file("cbx"))
.enablePlugins(ScalaNativePlugin)
.settings(
name := "cbx",
scalaVersion := "2.11.12",
nativeMode := "debug",
)
.dependsOn(sharedNative)
lazy val root = (project in file("."))
.aggregate(server,
ui,
cbx,
sharedJvm,
sharedJs,
sharedNative,
vendorJVM,
vendorJS,
vendorNative)
.settings(
publish := {},
publishLocal := {}
)