forked from scallop/scallop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
106 lines (104 loc) · 3.52 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
import sbtcrossproject.crossProject
lazy val commonSettings = Seq(
organization := "org.rogach",
name := "scallop",
version := {
val versionRegexp = """[0-9]+\.[0-9]+\.[0-9]+""".r
val libraryDependenciesString =
scala.io.Source.fromFile("README.md").getLines.filter(_.contains("libraryDependencies")).mkString
versionRegexp.findFirstIn(libraryDependenciesString).get
},
scalaVersion := "2.13.0",
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.8", "2.13.0"),
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-feature",
"-language:postfixOps",
"-language:reflectiveCalls",
"-language:existentials",
"-language:implicitConversions",
"-Xlint"
),
unmanagedSourceDirectories in Compile += {
val base = baseDirectory.value.getParentFile / "src" / "main"
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, v)) if v >= 13 =>
base / s"scala-2.13+"
case _ =>
base / s"scala-2.13-"
}
},
licenses := Seq(
"MIT License" -> url("http://www.opensource.org/licenses/mit-license.php")
),
homepage := Some(url("https://github.com/scallop/scallop")),
scmInfo := Some(
ScmInfo(
browseUrl = url("http://github.com/scallop/scallop"),
connection = "scm:git:[email protected]:scallop/scallop.git"
)
),
boilerplateSource in Compile := baseDirectory.value.getParentFile / "src" / "main" / "boilerplate",
pomExtra := (
<developers>
<developer>
<id>clhodapp</id>
<name>Chris Hodapp</name>
<url>http://clhodapp.net</url>
</developer>
<developer>
<id>rogach</id>
<name>Platon Pronko</name>
<url>http://rogach.org</url>
</developer>
</developers>
),
pomIncludeRepository := { x => false },
publishTo := {
val snapshot = false
if (snapshot)
Some("snapshots" at "https://oss.sonatype.org/content/repositories/snapshots")
else
Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
},
publishMavenStyle := true,
publishArtifact in Test := false,
scalacOptions in (Compile, doc) ++= Opts.doc.sourceUrl("https://github.com/scallop/scallop/blob/develop/€{FILE_PATH}.scala"),
parallelExecution in Test := false,
siteSubdirName in SiteScaladoc := "",
git.remoteRepo := "[email protected]:scallop/scallop.git"
)
lazy val scallop =
crossProject(JVMPlatform, NativePlatform, JSPlatform)
.crossType(new sbtcrossproject.CrossType {
def projectDir(crossBase: File, projectType: String): File =
crossBase / projectType
def projectDir(crossBase: File, platform: sbtcrossproject.Platform): File =
crossBase / platform.identifier
def sharedSrcDir(projectBase: File, conf: String): Option[File] =
Some(projectBase.getParentFile / "src" / conf / "scala")
})
.in(file("."))
.settings(commonSettings)
.enablePlugins(SiteScaladocPlugin, GhpagesPlugin)
.configure(_.enablePlugins(spray.boilerplate.BoilerplatePlugin))
.jvmSettings(
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.0.8" % Test
),
// fix for paths to source files in scaladoc
doc in Compile := {
import sys.process._
Seq("bash","-c",""" for x in $(find jvm/target/scala-2.12/api/ -type f); do sed -i "s_`pwd`/__" $x; done """).!
(doc in Compile).value
},
scalacOptions in Test -= "-Xlint"
)
.nativeSettings(
scalaVersion := "2.11.12",
crossScalaVersions := Seq("2.11.12")
)
.jsSettings(
scalaJSUseMainModuleInitializer in Test := true
)