-
Notifications
You must be signed in to change notification settings - Fork 79
/
build.sbt
120 lines (111 loc) · 3.87 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
// shadow sbt-scalajs' crossProject and CrossType from Scala.js 0.6.x
import sbtcrossproject.CrossPlugin.autoImport.{ crossProject, CrossType }
val monocleVersion = "2.0.4"
val acyclicVersion = "0.2.0"
val crossScalaVersionList = Seq("2.12.15", "2.13.8")
val sharedSettings = Seq(
crossScalaVersions := crossScalaVersionList,
scalaVersion := crossScalaVersionList.last,
version := "0.4.3",
scalacOptions ++=
"-encoding" :: "UTF-8" ::
"-unchecked" ::
"-deprecation" ::
"-explaintypes" ::
"-feature" ::
"-language:_" ::
"-Xfuture" ::
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
"-Xlint:-unused" :: // too many false positives for unused because of acyclic, macros, local vals in tests
"-Ypartial-unification" ::
"-Yno-adapted-args" ::
"-Ywarn-infer-any" ::
"-Ywarn-value-discard" ::
"-Ywarn-nullary-override" ::
"-Ywarn-nullary-unit" ::
Nil
case Some((2, 13)) =>
"-Xlint:-unused" :: // too many false positives for unused because of acyclic, macros, local vals in tests
Nil
case _ => Nil
}),
)
lazy val scalarx = crossProject(JSPlatform, JVMPlatform)
.settings(sharedSettings)
.settings(
organization := "com.lihaoyi",
name := "scalarx",
libraryDependencies ++= Seq(
"com.github.julien-truffaut" %%% "monocle-core" % monocleVersion,
"com.github.julien-truffaut" %%% "monocle-macro" % monocleVersion % "test",
"com.lihaoyi" %%% "utest" % "0.7.11" % "test",
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
"org.scala-lang.modules" %%% "scala-collection-compat" % "2.6.0",
"com.lihaoyi" %% "acyclic" % acyclicVersion % "provided"
),
addCompilerPlugin("com.lihaoyi" %% "acyclic" % acyclicVersion),
testFrameworks += new TestFramework("utest.runner.Framework"),
autoCompilerPlugins := true,
// Sonatype
publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
pomExtra :=
<url>https://github.com/lihaoyi/scala.rx</url>
<licenses>
<license>
<name>MIT license</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<developers>
<developer>
<id>lihaoyi</id>
<name>Li Haoyi</name>
<url>https://github.com/lihaoyi</url>
</developer>
</developers>
).jsSettings(
scalaJSStage in Test := FullOptStage,
scalacOptions += {
val local = baseDirectory.value.toURI
val remote = s"https://raw.githubusercontent.com/lihaoyi/scala.rx/${git.gitHeadCommit.value.get}/"
s"-P:scalajs:mapSourceURI:$local->$remote"
}
)
lazy val js = scalarx.js
lazy val jvm = scalarx.jvm
lazy val bench =
crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.settings(sharedSettings)
.dependsOn(scalarx)
.settings(
resolvers += ("jitpack" at "https://jitpack.io"),
libraryDependencies ++=
"com.github.fdietze.bench" %%% "bench" % "087e511" ::
Nil,
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, major)) if major == 11 => (
"-Xdisable-assertions" ::
/* "-optimise" :: */
/* "-Yclosure-elim" :: */
/* "-Yinline" :: */
Nil
)
case Some((2, major)) if major >= 12 => (
"-Xdisable-assertions" ::
"-opt:l:method" ::
"-opt:l:inline" ::
"-opt-inline-from:**" ::
Nil
)
case _ => Seq.empty
}
},
)
.jsSettings(
scalaJSStage in Compile := FullOptStage,
scalaJSUseMainModuleInitializer := true,
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
)