forked from tototoshi/scala-csv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
137 lines (112 loc) · 3.13 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
133
134
135
136
137
import scala.sys.process._
Global / onChangedBuildSource := ReloadOnSourceChanges
name := "scala-csv"
version := "1.3.11-SNAPSHOT"
scalaVersion := "2.13.8"
crossScalaVersions := Seq("2.12.15", "2.11.12", "2.10.7", "2.13.8", "3.1.2")
TaskKey[Unit]("checkScalariform") := {
val diff = "git diff".!!
if(diff.nonEmpty){
sys.error("Working directory is dirty!\n" + diff)
}
}
organization := "com.github.tototoshi"
libraryDependencies ++= {
Seq(
"org.scalatest" %% "scalatest" % "3.2.12" % Test,
if (scalaVersion.value.startsWith("2.")) "org.scalacheck" %% "scalacheck" % "1.14.3" % Test
else "org.scalacheck" %% "scalacheck" % "1.16.0" % Test
)
}
val enableScalameter = settingKey[Boolean]("")
enableScalameter := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, v)) =>
11 <= v && v <= 13
case _ =>
false
}
}
libraryDependencies ++= {
if (enableScalameter.value) {
Seq("com.storm-enroute" %% "scalameter" % "0.19" % "test")
} else {
Nil
}
}
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-language:implicitConversions"
)
scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)){
case Some((2, v)) if v >= 11 => Seq("-Ywarn-unused")
}.toList.flatten
Test / sources := {
val s = (Test / sources).value
val exclude = Set("CsvBenchmark.scala")
if (enableScalameter.value) {
s
} else {
s.filterNot(f => exclude(f.getName))
}
}
testFrameworks += new TestFramework(
"org.scalameter.ScalaMeterFramework"
)
Test / parallelExecution := false
logBuffered := false
compile / javacOptions += "-Xlint"
compile / javacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, v)) if v <= 11 =>
Seq("-target", "6", "-source", "6")
case _ =>
if (scala.util.Properties.isJavaAtLeast("9")) {
// if Java9
Nil
} else {
Seq("-target", "8")
}
}
}
initialCommands := """
|import com.github.tototoshi.csv._
""".stripMargin
publishMavenStyle := true
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
Test / publishArtifact := false
pomExtra := <url>http://github.com/tototoshi/scala-csv</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:tototoshi/scala-csv.git</url>
<connection>scm:git:[email protected]:tototoshi/scala-csv.git</connection>
</scm>
<developers>
<developer>
<id>tototoshi</id>
<name>Toshiyuki Takahashi</name>
<url>http://tototoshi.github.com</url>
</developer>
</developers>
Compile / unmanagedSourceDirectories += {
val dir = CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, v)) if v <= 12 =>
"scala-2.13-"
case _ =>
"scala-2.13+"
}
baseDirectory.value / "src" / "main" / dir
}