/
Build.scala
124 lines (109 loc) · 4.39 KB
/
Build.scala
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
import sbt._
import Keys._
import pl.project13.scala.sbt.JmhPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin
import ScalaJSPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType, _}
import scalajscrossproject.ScalaJSCrossPlugin.autoImport._
import Lib._
object NyayaBuild {
private val ghProject = "nyaya"
private val publicationSettings =
Lib.publicationSettings(ghProject)
object Ver {
final val KindProjector = "0.10.3"
final val Monocle = "1.6.0-RC1"
final val MTest = "0.6.9"
final val Scala212 = "2.12.8"
final val Scala213 = "2.13.0"
final val ScalaCollCompat = "2.0.0"
final val Scalaz = "7.2.27"
}
def scalacFlags = Seq(
"-deprecation",
"-unchecked",
"-Ywarn-dead-code",
"-Ywarn-unused",
"-Ywarn-value-discard",
"-feature",
"-language:postfixOps",
"-language:implicitConversions",
"-language:higherKinds",
"-language:existentials")
val commonSettings = ConfigureBoth(
_.settings(
organization := "com.github.japgolly.nyaya",
homepage := Some(url("https://github.com/japgolly/" + ghProject)),
licenses += ("LGPL v2.1+" -> url("http://www.gnu.org/licenses/lgpl-2.1.txt")),
scalaVersion := Ver.Scala213,
crossScalaVersions := Seq(Ver.Scala212, Ver.Scala213),
scalacOptions ++= scalacFlags,
scalacOptions in Test --= Seq("-Ywarn-dead-code"),
testFrameworks := Nil,
shellPrompt in ThisBuild := ((s: State) => Project.extract(s).currentRef.project + "> "),
triggeredMessage := Watched.clearWhenTriggered,
updateOptions := updateOptions.value.withCachedResolution(true),
libraryDependencies += "org.scala-lang.modules" %%% "scala-collection-compat" % Ver.ScalaCollCompat,
addCompilerPlugin("org.typelevel" %% "kind-projector" % Ver.KindProjector)))
def utestSettings = ConfigureBoth(
_.settings(
libraryDependencies += "com.lihaoyi" %%% "utest" % Ver.MTest % "test",
testFrameworks += new TestFramework("utest.runner.Framework")))
.jsConfigure(
// Not mandatory; just faster.
_.settings(jsEnv in Test := PhantomJSEnv().value))
// ==============================================================================================
lazy val root = (project in file("."))
.configure(commonSettings.jvm, preventPublication)
.aggregate(
utilJVM, propJVM, genJVM, testJVM,
utilJS, propJS, genJS, testJS,
benchmark)
lazy val utilJVM = util.jvm
lazy val utilJS = util.js
lazy val util = crossProject(JVMPlatform, JSPlatform)
.in(file("util"))
.configureCross(commonSettings, publicationSettings, utestSettings)
.settings(
moduleName := "nyaya-util",
libraryDependencies += "org.scalaz" %%% "scalaz-core" % Ver.Scalaz)
lazy val propJVM = prop.jvm
lazy val propJS = prop.js
lazy val prop = crossProject(JVMPlatform, JSPlatform)
.in(file("prop"))
.configureCross(commonSettings, publicationSettings)
.dependsOn(util)
.configureCross(utestSettings)
.settings(
moduleName := "nyaya-prop",
libraryDependencies += "org.scalaz" %%% "scalaz-core" % Ver.Scalaz)
lazy val genJVM = gen.jvm
lazy val genJS = gen.js
lazy val gen = crossProject(JVMPlatform, JSPlatform)
.in(file("gen"))
.configureCross(commonSettings, publicationSettings)
.dependsOn(util)
.configureCross(utestSettings)
.settings(
moduleName := "nyaya-gen",
libraryDependencies ++= Seq(
"org.scalaz" %%% "scalaz-core" % Ver.Scalaz,
"com.github.julien-truffaut" %%% "monocle-core" % Ver.Monocle,
"com.github.julien-truffaut" %%% "monocle-macro" % Ver.Monocle % "test"
))
lazy val testJVM = testModule.jvm
lazy val testJS = testModule.js
lazy val testModule = crossProject(JVMPlatform, JSPlatform)
.in(file("test"))
.configureCross(commonSettings, publicationSettings)
.dependsOn(prop, gen)
.configureCross(utestSettings)
.settings(
name := "test",
moduleName := "nyaya-test")
lazy val benchmark = (project in file("benchmark"))
.enablePlugins(JmhPlugin)
.configure(commonSettings.jvm, preventPublication)
.dependsOn(propJVM, genJVM, testJVM)
}