This repository has been archived by the owner on Jul 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
110 lines (97 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
import org.scalajs.core.tools.linker.ModuleInitializer
import sbt.inConfig
import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}
import scoverage.ScoverageKeys.coverageEnabled
resolvers += Resolver.sonatypeRepo("snapshots")
val ScalaFixScalacOptions = Seq(
"-Ywarn-adapted-args", // for NoAutoTupling
"-Ywarn-unused", // for RemoveUnused
)
val ScalaFixScalacOptionsOff = Seq(
"-Xfatal-warnings", // it should be disabled for scalafix
)
val mainClassString = "pl.writeonly.re.main.Main"
val mainClassSome = Some(mainClassString)
scalaVersion := "2.11.12"
scapegoatVersion in ThisBuild := "1.3.8"
scalacOptions ++= scalacOptionsFor(scalaVersion.value)
val ScalaPropsVersion = "0.5.5"
val SloggingVersion = "0.6.1"
val ScalazVersion = "7.2.27"
val SharedSettings = Seq(
scalaVersion := "2.11.12",
scalacOptions ++= scalacOptionsFor(scalaVersion.value),
scalacOptions ++= ScalaFixScalacOptions,
scalacOptions --= ScalaFixScalacOptionsOff,
mainClass in (Compile, run) := Some("pl.writeonly.re.main.Main"),
testFrameworks += new TestFramework("utest.runner.Framework"),
resolvers += Opts.resolver.sonatypeReleases,
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.6.5" % "test",
libraryDependencies ++= Seq(
"com.github.scalaprops" %%% "scalaprops" % ScalaPropsVersion % "test,it",
"com.github.scalaprops" %%% "scalaprops-scalazlaws" % ScalaPropsVersion % "test,it",
),
libraryDependencies += "org.scalaz" %%% "scalaz-core" % ScalazVersion,
libraryDependencies ++= Seq(
"biz.enef" %%% "slogging" % SloggingVersion,
),
libraryDependencies += "com.lihaoyi" %%% "fastparse" % "1.0.0",
scalaJSUseMainModuleInitializer := true,
scalaJSMainModuleInitializer := Some(
ModuleInitializer.mainMethod(mainClassString, "main")
),
addCompilerPlugin(scalafixSemanticdb),
wartremoverErrors ++= Warts.unsafe,
scapegoatVersion := "1.3.8",
)
val jsSettings = Seq(
coverageEnabled := true,
mainClass in Compile := mainClassSome,
scalaJSUseMainModuleInitializer := true,
// scalaJSModuleKind := ModuleKind.CommonJSModule,
libraryDependencies ++= Seq(
// "biz.enef" %%% "slogging-winston" % SloggingVersion,
// "biz.enef" %%% "slogging-http" % SloggingVersion,
),
)
val jvmSettings = Seq(
coverageEnabled := true,
mainClass in Compile := mainClassSome,
libraryDependencies ++= Seq(
"biz.enef" %% "slogging-slf4j" % SloggingVersion,
"ch.qos.logback" % "logback-classic" % "1.2.3",
"io.vavr" % "vavr" % "0.10.2",
),
)
val nativeSettings = Seq(
nativeLinkStubs := true,
// nativeLinkingOptions += "-lglib-2.0",
libraryDependencies ++= Seq(
// "biz.enef" %%% "slogging-glib" % SloggingVersion,
// "biz.enef" %%% "slogging-syslog" % SloggingVersion,
),
)
lazy val re = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.withoutSuffixFor(NativePlatform)
.crossType(CrossType.Full)
.settings(SharedSettings)
.jsSettings(jsSettings)
.jvmSettings(jvmSettings)
.nativeSettings(nativeSettings)
// IntegrationTest
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.settings(
inConfig(IntegrationTest)(scalafixConfigSettings(IntegrationTest)),
inConfig(IntegrationTest)(ScalafmtPlugin.scalafmtConfigSettings),
// inConfig(IntegrationTest)(scalariformItSettings),
unmanagedSourceDirectories in IntegrationTest ++= CrossType.Full.sharedSrcDir(baseDirectory.value, "it").toSeq
)
.jsSettings(inConfig(IntegrationTest)(ScalaJSPlugin.testConfigSettings))
.nativeSettings(inConfig(IntegrationTest)(Defaults.testSettings))
// PropsTest
.settings(scalapropsCoreSettings)
//.nativeSettings(scalapropsNativeSettings)
lazy val reJS = re.js.enablePlugins(ScalaJSPlugin)
lazy val reJVM = re.jvm
lazy val reNative = re.native.enablePlugins(ScalaNativePlugin)