forked from tototoshi/scala-csv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
125 lines (101 loc) · 2.75 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
import scala.sys.process._
Global / onChangedBuildSource := ReloadOnSourceChanges
name := "scala-csv"
version := "1.3.6"
scalaVersion := "2.11.12"
crossScalaVersions := Seq("2.12.10", "2.11.12", "2.10.7", "2.13.1")
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.1.0" % Test,
"org.scalacheck" %% "scalacheck" % "1.14.2" % 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",
"-language:_"
)
scalacOptions ++= PartialFunction.condOpt(CrossVersion.partialVersion(scalaVersion.value)){
case Some((2, v)) if v >= 11 => Seq("-Ywarn-unused")
}.toList.flatten
(sources in Test) := {
val s = (sources in Test).value
val exclude = Set("CsvBenchmark.scala")
if (enableScalameter.value) {
s
} else {
s.filterNot(f => exclude(f.getName))
}
}
testFrameworks += new TestFramework(
"org.scalameter.ScalaMeterFramework"
)
parallelExecution in Test := false
logBuffered := false
javacOptions in compile += "-Xlint"
javacOptions in compile ++= {
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")
}
publishArtifact in Test := 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>