forked from Chymyst/chymyst-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
133 lines (114 loc) · 5.09 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
126
127
128
129
130
131
132
/*
Root project: buildAll (not executable)
Aggregates: core, benchmark
Benchmark: executable (sbt benchmark/run)
Make the main JAR of the Chymyst Core library: sbt core/package
*/
/* To compile with printed names and types:
$ sbt
> set scalacOptions in ThisBuild ++= Seq("-Xprint:namer", "-Xprint:typer")
> compile
> exit
*/
val commonSettings = Defaults.coreDefaultSettings ++ Seq(
organization := "io.chymyst",
version := "0.1.8-SNAPSHOT",
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8", "2.12.1"),
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases"),
"Typesafe releases" at "http://repo.typesafe.com/typesafe/releases"
),
licenses := Seq("Apache License, Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://chymyst.github.io/chymyst-core/")),
description := "Declarative concurrency framework for Scala - the core library implementing the abstract chemical machine / join calculus",
// scmInfo := Some(ScmInfo(url("[email protected]:Chymyst/chymyst-core.git"), "scm:git:[email protected]:Chymyst/chymyst-core.git", None)),
// developers := List(Developer(id = "winitzki", name = "Sergei Winitzki", email = "[email protected]", url("https://sites.google.com/site/winitzki"))),
scalacOptions ++= Seq(// https://tpolecat.github.io/2014/04/11/scalac-flags.html
"-deprecation",
"-unchecked",
"-encoding", "UTF-8",
"-feature",
// "-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
// "-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args", // Makes calling a() fail to substitute a Unit argument into a.apply(x: Unit)
"-Ywarn-dead-code", // N.B. doesn't work well with the ??? hole
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture",
"-Ywarn-unused"
) ++ (//target:jvm-1.8 supported from 2.11.5, warn-unused-import deprecated in 2.12
if (scalaVersion.value startsWith "2.11") {
val revision = scalaVersion.value.split('.').last.toInt
Seq("-Ywarn-unused-import") ++ (
if (revision >= 5) {
Seq("-target:jvm-1.8")
}
else {
Nil
})
}
else Nil
)
++ (
if (scalaVersion.value startsWith "2.12") Seq("-target:jvm-1.8", "-Ypartial-unification") // (SI-2712 pertains to partial-unification)
else Nil
)
)
tutSettings
lazy val errorsForWartRemover = Seq(Wart.EitherProjectionPartial, Wart.Enumeration, Wart.Equals, Wart.ExplicitImplicitTypes, Wart.FinalCaseClass, Wart.FinalVal, Wart.LeakingSealed, Wart.Return, Wart.StringPlusAny, Wart.TraversableOps, Wart.TryPartial)
lazy val warningsForWartRemover = Seq(Wart.JavaConversions) //Seq(Wart.Any, Wart.AsInstanceOf, Wart.ImplicitConversion, Wart.IsInstanceOf, Wart.JavaConversions, Wart.Option2Iterable, Wart.OptionPartial, Wart.NoNeedForMonad, Wart.Nothing, Wart.Product, Wart.Serializable, Wart.ToString, Wart.While)
val rootProject = Some(buildAll)
lazy val buildAll = (project in file("."))
.settings(commonSettings: _*)
.settings(
name := "buildAll"
)
.aggregate(core, benchmark)
lazy val core = (project in file("core"))
.settings(commonSettings: _*)
.settings(
name := "chymyst-core",
wartremoverWarnings in(Compile, compile) ++= warningsForWartRemover,
wartremoverErrors in(Compile, compile) ++= errorsForWartRemover,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalatest" %% "scalatest" % "3.0.0" % Test,
"org.scalacheck" %% "scalacheck" % "1.13.4" % Test,
"com.lihaoyi" %% "utest" % "0.4.5" % Test,
// the "scala-compiler" is a necessary dependency only if we want to debug macros;
// the project does not actually depend on scala-compiler.
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "test"
)
, testFrameworks += new TestFramework("utest.runner.Framework")
// , parallelExecution in Test := false
// , concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)
)
// Benchmarks - users do not need to depend on this.
lazy val benchmark = (project in file("benchmark"))
.settings(commonSettings: _*)
.settings(
name := "benchmark",
aggregate in assembly := false,
// unmanagedJars in Compile += file("lib/JiansenJoin-0.3.6-JoinRun-0.1.0.jar"),// they say it's no longer needed
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
parallelExecution in Test := false,
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.0" % Test
)
).dependsOn(core)
// Publishing to Sonatype Maven repository
publishMavenStyle := true
// pomIncludeRepository := { _ => false } // not sure we need this. http://www.scala-sbt.org/release/docs/Using-Sonatype.html says we might need it because "sometimes we have optional dependencies for special features".
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishArtifact in Test := false