-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
125 lines (114 loc) · 4.9 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 sbt._
import sbt.Keys._
import xerial.sbt.Sonatype._
import ReleaseTransformations._
// https://github.com/xerial/sbt-sonatype/issues/71
ThisBuild / publishTo := sonatypePublishTo.value
ThisBuild / versionScheme := Some("pvp")
lazy val scalaV = settingKey[ScalaVer]("Current Scala Version")
lazy val commons = Seq(
organization := "com.github.andyglow",
homepage := Some(new URL("http://github.com/andyglow/scala-patch")),
startYear := Some(2019),
organizationName := "andyglow",
scalaVersion := (ScalaVer.fromEnv getOrElse ScalaVer._212).full,
crossScalaVersions := ScalaVer.values.map(_.full),
scalaV := ScalaVer.fromString(scalaVersion.value) getOrElse ScalaVer._212,
scalacOptions := CompilerOptions(scalaV.value),
Compile / unmanagedSourceDirectories ++= {
val bd = baseDirectory.value
def extraDirs(suffix: String): Seq[File] = Seq(bd / "src" / "main" / s"scala$suffix")
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, y)) if y <= 12 => extraDirs("-2.12-")
case Some((2, y)) if y >= 13 => extraDirs("-2.13+")
case _ => Nil
}
},
Test / unmanagedSourceDirectories ++= {
val bd = baseDirectory.value
def extraDirs(suffix: String): Seq[File] = Seq(bd / "src" / "test" / s"scala$suffix")
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, y)) if y <= 12 => extraDirs("-2.12-")
case Some((2, y)) if y >= 13 => extraDirs("-2.13+")
case _ => Nil
}
},
Compile / doc / scalacOptions ++= Seq("-groups", "-implicits", "-no-link-warnings"),
licenses := Seq(("LGPL-3.0", url("http://opensource.org/licenses/LGPL-3.0"))),
sonatypeProfileName := "com.github.andyglow",
publishMavenStyle := true,
sonatypeProjectHosting := Some(GitHubHosting("andyglow", "scala-patch", "[email protected]")),
scmInfo := Some(
ScmInfo(url("https://github.com/andyglow/scala-patch"), "scm:[email protected]:andyglow/scala-patch.git")
),
developers := List(
Developer(
id = "andyglow",
name = "Andriy Onyshchuk",
email = "[email protected]",
url = url("https://ua.linkedin.com/in/andyglow")
)
),
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
ReleaseStep(action = Command.process("publishSigned", _), enableCrossBuild = true),
setNextVersion,
commitNextVersion,
ReleaseStep(action = Command.process("sonatypeReleaseAll", _), enableCrossBuild = true),
pushChanges
),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.13" % Test
)
lazy val core = (project in file("modules/core"))
.enablePlugins(spray.boilerplate.BoilerplatePlugin)
.settings(
commons,
name := "scala-gpl",
scalacOptions ++= Seq("-language:implicitConversions", "-language:higherKinds")
)
lazy val macros = (project in file("modules/macros"))
.dependsOn(core)
.settings(
commons,
name := "scala-gpl-macros",
scalacOptions ++= Seq("-language:experimental.macros"),
libraryDependencies ++= Seq(
(scalaVersion apply ("org.scala-lang" % "scala-reflect" % _ % Compile)).value.withSources.withJavadoc
)
)
lazy val generic =
(project in file("modules/generic")).dependsOn(core, macros).settings(commons, name := "scala-gpl-generic")
lazy val texts = (project in file("modules/texts"))
.dependsOn(core)
.settings(
commons,
name := "scala-gpl-patch-text",
libraryDependencies += "org.bitbucket.cowwoc" % "diff-match-patch" % "1.2"
)
lazy val structuredMatchers = (project in file("modules/scalatest-structured-matchers"))
.dependsOn(core, generic)
.settings(
commons,
name := "scalatest-structured-matchers",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.13"
)
lazy val examples = (project in file("examples"))
.dependsOn(core, generic)
.settings(commons, name := "scala-gpl-examples", publish / skip := true, publishArtifact := false)
lazy val root = (project in file("."))
.aggregate(core, macros, generic, texts, structuredMatchers, examples)
.settings(
commons,
publish / skip := true,
publishArtifact := false,
update / aggregate := false,
name := "scala-gpl-root"
)