2015-08-19 09:56:08 +02:00
|
|
|
import Dependencies._
|
2017-06-14 07:56:08 +02:00
|
|
|
import Path._
|
2017-07-26 12:40:54 +02:00
|
|
|
import com.typesafe.tools.mima.core._, ProblemFilters._
|
2015-08-19 09:56:08 +02:00
|
|
|
|
2017-06-28 08:27:41 +02:00
|
|
|
def baseVersion = "1.0.0-SNAPSHOT"
|
2015-08-19 09:56:08 +02:00
|
|
|
|
|
|
|
|
def commonSettings: Seq[Setting[_]] = Seq(
|
2017-01-07 06:43:52 +01:00
|
|
|
scalaVersion := scala212,
|
2015-08-19 09:56:08 +02:00
|
|
|
// publishArtifact in packageDoc := false,
|
|
|
|
|
resolvers += Resolver.typesafeIvyRepo("releases"),
|
|
|
|
|
resolvers += Resolver.sonatypeRepo("snapshots"),
|
2016-10-07 20:36:32 +02:00
|
|
|
resolvers += "bintray-sbt-maven-releases" at "https://dl.bintray.com/sbt/maven-releases/",
|
2015-08-19 09:56:08 +02:00
|
|
|
// concurrentRestrictions in Global += Util.testExclusiveRestriction,
|
|
|
|
|
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
2017-01-07 06:43:52 +01:00
|
|
|
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
|
|
|
|
|
crossScalaVersions := Seq(scala211, scala212),
|
2015-09-07 10:40:23 +02:00
|
|
|
resolvers += Resolver.sonatypeRepo("public"),
|
2017-06-14 07:56:08 +02:00
|
|
|
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")
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-02-14 17:47:07 +01:00
|
|
|
publishArtifact in Compile := true,
|
2017-04-26 22:41:50 +02:00
|
|
|
publishArtifact in Test := false,
|
2017-06-14 07:56:08 +02:00
|
|
|
parallelExecution in Test := false
|
2015-08-19 09:56:08 +02:00
|
|
|
)
|
|
|
|
|
|
2017-07-20 18:13:35 +02:00
|
|
|
val mimaSettings = Def settings (
|
|
|
|
|
mimaPreviousArtifacts := Set(organization.value %% moduleName.value % "1.0.0-X18")
|
|
|
|
|
)
|
|
|
|
|
|
2017-04-26 22:55:38 +02:00
|
|
|
lazy val lmRoot = (project in file("."))
|
2017-07-12 00:39:06 +02:00
|
|
|
.aggregate(lmCore, lmIvy)
|
2017-04-26 22:55:38 +02:00
|
|
|
.settings(
|
|
|
|
|
inThisBuild(
|
|
|
|
|
Seq(
|
|
|
|
|
homepage := Some(url("https://github.com/sbt/librarymanagement")),
|
|
|
|
|
description := "Library management module for sbt",
|
2017-06-21 14:47:35 +02:00
|
|
|
scmInfo := Some(ScmInfo(
|
|
|
|
|
url("https://github.com/sbt/librarymanagement"), "git@github.com:sbt/librarymanagement.git"
|
|
|
|
|
)),
|
2017-04-26 22:55:38 +02:00
|
|
|
bintrayPackage := "librarymanagement",
|
2017-07-20 03:32:39 +02:00
|
|
|
// scalafmtOnCompile := true,
|
2017-06-14 07:56:08 +02:00
|
|
|
// scalafmtVersion 1.0.0-RC3 has regression
|
2017-07-20 03:32:39 +02:00
|
|
|
// scalafmtVersion := "0.6.8",
|
2017-06-28 08:27:41 +02:00
|
|
|
git.baseVersion := baseVersion,
|
|
|
|
|
version := {
|
|
|
|
|
val v = version.value
|
|
|
|
|
if (v contains "SNAPSHOT") git.baseVersion.value
|
|
|
|
|
else v
|
|
|
|
|
}
|
2017-04-26 22:55:38 +02:00
|
|
|
)),
|
2015-08-19 09:56:08 +02:00
|
|
|
commonSettings,
|
2015-09-05 11:32:07 +02:00
|
|
|
name := "LM Root",
|
2015-08-19 09:56:08 +02:00
|
|
|
publish := {},
|
2015-09-02 09:25:37 +02:00
|
|
|
publishLocal := {},
|
2015-09-07 10:40:23 +02:00
|
|
|
publishArtifact in Compile := false,
|
2016-05-10 06:34:40 +02:00
|
|
|
publishArtifact := false,
|
|
|
|
|
customCommands
|
2015-08-19 09:56:08 +02:00
|
|
|
)
|
|
|
|
|
|
2017-07-12 00:39:06 +02:00
|
|
|
lazy val lmCore = (project in file("core"))
|
|
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
2017-04-26 22:55:38 +02:00
|
|
|
.settings(
|
2015-08-19 09:56:08 +02:00
|
|
|
commonSettings,
|
2017-07-12 00:39:06 +02:00
|
|
|
name := "librarymanagement-core",
|
|
|
|
|
libraryDependencies ++= Seq(jsch,
|
2017-06-10 10:13:31 +02:00
|
|
|
scalaReflect.value,
|
|
|
|
|
scalaCompiler.value,
|
|
|
|
|
launcherInterface,
|
|
|
|
|
gigahorseOkhttp,
|
|
|
|
|
okhttpUrlconnection,
|
|
|
|
|
sjsonnewScalaJson.value % Optional,
|
2017-07-08 14:57:15 +02:00
|
|
|
scalaTest,
|
|
|
|
|
scalaCheck),
|
2016-11-02 16:22:55 +01:00
|
|
|
libraryDependencies ++= scalaXml.value,
|
2017-06-21 14:47:35 +02:00
|
|
|
resourceGenerators in Compile += Def.task(
|
|
|
|
|
Util.generateVersionFile(
|
|
|
|
|
version.value, resourceManaged.value, streams.value, (compile in Compile).value
|
|
|
|
|
)
|
|
|
|
|
).taskValue,
|
2017-06-14 07:56:08 +02:00
|
|
|
// mimaBinaryIssueFilters ++= Seq(),
|
2017-07-02 01:27:54 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
|
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-01-05 14:33:19 +01:00
|
|
|
contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats,
|
2016-12-14 11:26:53 +01:00
|
|
|
// 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)
|
2017-07-20 18:13:35 +02:00
|
|
|
},
|
|
|
|
|
mimaSettings,
|
2017-07-26 12:40:54 +02:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// method urlFactory()okhttp3.OkUrlFactory in object sbt.librarymanagement.Http does not have a correspondent in current version
|
|
|
|
|
// Was private[sbt] and manually checked to be unused in Zinc or sbt
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("sbt.librarymanagement.Http.urlFactory"),
|
|
|
|
|
// method open(java.net.URL)java.net.HttpURLConnection in object sbt.librarymanagement.Http does not have a correspondent in current version
|
|
|
|
|
// Was private[sbt] and manually checked to be unused in Zinc or sbt
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("sbt.librarymanagement.Http.open"),
|
2017-07-28 07:37:01 +02:00
|
|
|
// New methods added to LM API
|
2017-07-28 08:11:20 +02:00
|
|
|
ProblemFilters.exclude[ReversedMissingMethodProblem]("sbt.librarymanagement.ModuleDescriptor.moduleSettings"),
|
|
|
|
|
// New methods added to LM API
|
|
|
|
|
ProblemFilters.exclude[ReversedMissingMethodProblem]("sbt.librarymanagement.ModuleDescriptor.extraInputHash"),
|
2017-07-28 08:18:27 +02:00
|
|
|
// method globalLockIsoString()sjsonnew.IsoString in trait sbt.internal.librarymanagement.formats.GlobalLockFormat is present only in current version
|
|
|
|
|
// method xsbtiLoggerIsoString()sjsonnew.IsoString in trait sbt.internal.librarymanagement.formats.LoggerFormat is present only in current version
|
|
|
|
|
// These only fail in Scala 2.11
|
|
|
|
|
// We're _probably_ ok to add these between sbt 1 RC2 and RC3,
|
|
|
|
|
// but it's dangerous territory in general
|
|
|
|
|
// see typesafehub/migration-manager#183 for an example of what happens..
|
|
|
|
|
ProblemFilters.exclude[ReversedMissingMethodProblem]("sbt.internal.librarymanagement.formats.GlobalLockFormat.globalLockIsoString"),
|
|
|
|
|
ProblemFilters.exclude[ReversedMissingMethodProblem]("sbt.internal.librarymanagement.formats.LoggerFormat.xsbtiLoggerIsoString"),
|
2017-07-26 12:40:54 +02:00
|
|
|
)
|
2017-04-26 22:55:38 +02:00
|
|
|
)
|
2017-06-21 17:22:56 +02:00
|
|
|
.configure(addSbtIO, addSbtUtilLogging, addSbtUtilPosition, addSbtUtilCache)
|
2017-07-12 00:39:06 +02:00
|
|
|
|
|
|
|
|
lazy val lmIvy = (project in file("ivy"))
|
2017-04-26 22:55:38 +02:00
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
2017-07-12 00:39:06 +02:00
|
|
|
.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"),
|
2017-07-20 18:13:35 +02:00
|
|
|
mimaSettings,
|
2017-07-26 12:40:54 +02:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// method UnknownResolver()java.lang.String in object sbt.internal.librarymanagement.SbtIvyLogger does not have a correspondent in current version
|
|
|
|
|
// Was in a private object in sbt.internal and manually checked to be unused in Zinc or sbt
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.SbtIvyLogger.UnknownResolver")
|
|
|
|
|
)
|
2017-07-12 00:39:06 +02:00
|
|
|
)
|
2016-05-10 06:34:40 +02:00
|
|
|
|
|
|
|
|
def customCommands: Seq[Setting[_]] = Seq(
|
|
|
|
|
commands += Command.command("release") { state =>
|
|
|
|
|
// "clean" ::
|
2017-07-06 15:05:04 +02:00
|
|
|
"+compile" ::
|
|
|
|
|
"+publishSigned" ::
|
2017-04-26 22:55:38 +02:00
|
|
|
"reload" ::
|
|
|
|
|
state
|
2016-05-10 06:34:40 +02:00
|
|
|
}
|
|
|
|
|
)
|