forked from sbt/librarymanagement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
141 lines (134 loc) · 5.07 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
138
139
140
141
import Dependencies._
import Path._
//import com.typesafe.tools.mima.core._, ProblemFilters._
def baseVersion = "1.0.0-SNAPSHOT"
def commonSettings: Seq[Setting[_]] = Seq(
scalaVersion := scala212,
// publishArtifact in packageDoc := false,
resolvers += Resolver.typesafeIvyRepo("releases"),
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers += "bintray-sbt-maven-releases" at "https://dl.bintray.com/sbt/maven-releases/",
// concurrentRestrictions in Global += Util.testExclusiveRestriction,
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
crossScalaVersions := Seq(scala211, scala212),
resolvers += Resolver.sonatypeRepo("public"),
scalacOptions := {
val old = scalacOptions.value
scalaVersion.value match {
case sv if sv.startsWith("2.10") =>
old diff List("-Xfuture", "-Ywarn-unused", "-Ywarn-unused-import")
case sv if sv.startsWith("2.11") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import")
case _ => old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
}
},
publishArtifact in Compile := true,
publishArtifact in Test := false,
parallelExecution in Test := false
)
val mimaSettings = Def settings (
mimaPreviousArtifacts := Set(organization.value %% moduleName.value % "1.0.0"),
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq(
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler#SbtUrlInfo.this"),
exclude[IncompatibleMethTypeProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler#SbtUrlInfo.this"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler.checkStatusCode")
)
}
)
lazy val lmRoot = (project in file("."))
.aggregate(lmCore, lmIvy)
.settings(
inThisBuild(
Seq(
homepage := Some(url("https://github.com/sbt/librarymanagement")),
description := "Library management module for sbt",
scmInfo := {
val slug = "sbt/librarymanagement"
Some(ScmInfo(url(s"https://github.com/$slug"), s"[email protected]:$slug.git"))
},
bintrayPackage := "librarymanagement",
scalafmtOnCompile := true,
scalafmtVersion := "1.2.0",
git.baseVersion := baseVersion,
version := {
val v = version.value
if (v contains "SNAPSHOT") git.baseVersion.value
else v
}
)),
commonSettings,
name := "LM Root",
publish := {},
publishLocal := {},
publishArtifact in Compile := false,
publishArtifact := false,
customCommands
)
lazy val lmCore = (project in file("core"))
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
.settings(
commonSettings,
name := "librarymanagement-core",
libraryDependencies ++= Seq(
jsch,
scalaReflect.value,
scalaCompiler.value,
launcherInterface,
gigahorseOkhttp,
okhttpUrlconnection,
sjsonnewScalaJson.value % Optional,
scalaTest,
scalaCheck
),
libraryDependencies ++= scalaXml.value,
resourceGenerators in Compile += Def
.task(
Util.generateVersionFile(
version.value,
resourceManaged.value,
streams.value,
(compile in Compile).value
)
)
.taskValue,
managedSourceDirectories in Compile +=
baseDirectory.value / "src" / "main" / "contraband-scala",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats,
// WORKAROUND sbt/sbt#2205 include managed sources in packageSrc
mappings in (Compile, packageSrc) ++= {
val srcs = (managedSources in Compile).value
val sdirs = (managedSourceDirectories in Compile).value
val base = baseDirectory.value
(((srcs --- sdirs --- base) pair (relativeTo(sdirs) | relativeTo(base) | flat)) toSeq)
},
mimaSettings,
)
.configure(addSbtIO, addSbtUtilLogging, addSbtUtilPosition, addSbtUtilCache)
lazy val lmIvy = (project in file("ivy"))
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
.dependsOn(lmCore)
.settings(
commonSettings,
name := "librarymanagement-ivy",
libraryDependencies ++= Seq(ivy, scalaTest, scalaCheck),
managedSourceDirectories in Compile +=
baseDirectory.value / "src" / "main" / "contraband-scala",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats,
scalacOptions in (Compile, console) --=
Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint"),
mimaSettings,
)
def customCommands: Seq[Setting[_]] = Seq(
commands += Command.command("release") { state =>
// "clean" ::
"+compile" ::
"+publishSigned" ::
"reload" ::
state
}
)