forked from scala-stm/scala-stm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
114 lines (106 loc) · 3.95 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
def projectVersion = "0.11.1"
def mimaVersion = "0.11.0"
// sonatype plugin requires that these are in global
ThisBuild / version := projectVersion
ThisBuild / organization := "org.scala-stm"
lazy val root = crossProject(JVMPlatform, JSPlatform).in(file("."))
.settings(commonSettings)
.settings(publishSettings)
.settings(
name := "scala-stm",
mimaPreviousArtifacts := Set(organization.value %% name.value % mimaVersion)
)
.jvmSettings(
crossScalaVersions := Seq("3.0.0", "2.13.5", "2.12.13", "2.11.12"),
)
.jsSettings(
crossScalaVersions := scalaVersion.value :: Nil,
)
////////////////////
// basic settings //
////////////////////
lazy val deps = new {
val test = new {
val junit = "4.13.1"
val scalaTest = "3.2.9"
val scalaTestPlus = s"$scalaTest.0"
}
}
lazy val commonSettings = Seq(
// organization := "org.scala-stm",
// version := projectVersion,
description := "A library for Software Transactional Memory in Scala",
homepage := Some(url("https://nbronson.github.com/scala-stm/")),
licenses := Seq("""BSD 3-Clause "New" or "Revised" License""" -> url("https://spdx.org/licenses/BSD-3-Clause")),
scalaVersion := "2.13.5",
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-Xsource:2.13"),
scalacOptions ++= {
if (scalaVersion.value.startsWith("2.11")) Nil else Seq("-Xlint:-unused,_")
},
javacOptions in (Compile, compile) ++= {
val javaVersion = if (scalaVersion.value.startsWith("2.11")) "1.6" else "1.8"
Seq("-source", javaVersion, "-target", javaVersion)
},
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % deps.test.scalaTest % Test,
"org.scalatestplus" %% "junit-4-13" % deps.test.scalaTestPlus % Test,
"junit" % "junit" % deps.test.junit % Test,
),
// skip exhaustive tests
testOptions += Tests.Argument("-l", "slow"),
// test of TxnExecutor.transformDefault must be run by itself
parallelExecution in Test := false,
unmanagedSourceDirectories in Compile ++= {
val sourceDirPl = (sourceDirectory in Compile).value
val sourceDirSh = file(
sourceDirPl.getPath.replace("/jvm/" , "/shared/").replace("/js/", "/shared/")
)
val sv = CrossVersion.partialVersion(scalaVersion.value)
val (sub1, sub2) = sv match {
case Some((2, n)) if n >= 13 => ("scala-2.13+", "scala-2.14-")
case Some((3, _)) => ("scala-2.13+", "scala-2.14+")
case _ => ("scala-2.13-", "scala-2.14-")
}
Seq(sourceDirPl / sub1, sourceDirPl / sub2, sourceDirSh / sub1, sourceDirSh / sub2)
},
unmanagedSourceDirectories in Test ++= {
val sourceDirPl = (sourceDirectory in Test).value
val sourceDirSh = file(
sourceDirPl.getPath.replace("/jvm/" , "/shared/").replace("/js/", "/shared/")
)
val sv = CrossVersion.partialVersion(scalaVersion.value)
val (sub1, sub2) = sv match {
case Some((2, n)) if n >= 13 => ("scala-2.13+", "scala-2.14-")
case Some((3, _)) => ("scala-2.13+", "scala-2.14+")
case _ => ("scala-2.13-", "scala-2.14-")
}
Seq(sourceDirPl / sub1, sourceDirPl / sub2, sourceDirSh / sub1, sourceDirSh / sub2)
},
)
////////////////
// publishing //
////////////////
lazy val publishSettings = Seq(
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
developers := List(
Developer(
id = "nbronson",
name = "Nathan Bronson",
email = "[email protected]",
url = url("https://github.com/nbronson")
),
Developer(
id = "sciss",
name = "Hanns Holger Rutz",
email = "[email protected]",
url = url("https://www.sciss.de")
)
),
scmInfo := {
val h = "github.com"
val a = s"scala-stm/${name.value}"
Some(ScmInfo(url(s"https://$h/$a"), s"scm:git@$h:$a.git"))
},
)