2016-01-31 20:55:18 +01:00
|
|
|
import java.io.FileOutputStream
|
2015-11-21 14:23:06 +01:00
|
|
|
|
2016-02-16 01:03:00 +01:00
|
|
|
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
|
|
|
|
|
|
|
|
|
|
val binaryCompatibilityVersion = "1.0.0-M7"
|
|
|
|
|
|
2016-08-15 16:14:32 +02:00
|
|
|
lazy val IntegrationTest = config("it") extend Test
|
|
|
|
|
|
2016-01-27 11:45:36 +01:00
|
|
|
lazy val releaseSettings = Seq(
|
2015-11-21 14:23:06 +01:00
|
|
|
publishMavenStyle := true,
|
2015-11-21 14:23:07 +01:00
|
|
|
licenses := Seq("Apache 2.0" -> url("http://opensource.org/licenses/Apache-2.0")),
|
|
|
|
|
homepage := Some(url("https://github.com/alexarchambault/coursier")),
|
2016-08-31 21:23:11 +02:00
|
|
|
scmInfo := Some(ScmInfo(
|
|
|
|
|
url("https://github.com/alexarchambault/coursier.git"),
|
|
|
|
|
"scm:git:github.com/alexarchambault/coursier.git",
|
|
|
|
|
Some("scm:git:git@github.com:alexarchambault/coursier.git")
|
|
|
|
|
)),
|
2015-11-21 14:23:06 +01:00
|
|
|
pomExtra := {
|
2015-12-12 19:51:00 +01:00
|
|
|
<developers>
|
|
|
|
|
<developer>
|
|
|
|
|
<id>alexarchambault</id>
|
|
|
|
|
<name>Alexandre Archambault</name>
|
|
|
|
|
<url>https://github.com/alexarchambault</url>
|
|
|
|
|
</developer>
|
|
|
|
|
</developers>
|
2015-12-30 23:55:17 +01:00
|
|
|
},
|
2015-12-12 19:01:37 +01:00
|
|
|
publishTo := {
|
|
|
|
|
val nexus = "https://oss.sonatype.org/"
|
|
|
|
|
if (isSnapshot.value)
|
|
|
|
|
Some("snapshots" at nexus + "content/repositories/snapshots")
|
|
|
|
|
else
|
|
|
|
|
Some("releases" at nexus + "service/local/staging/deploy/maven2")
|
2015-11-21 14:23:06 +01:00
|
|
|
},
|
2016-04-17 22:08:04 +02:00
|
|
|
credentials ++= {
|
2015-11-21 14:23:06 +01:00
|
|
|
Seq("SONATYPE_USER", "SONATYPE_PASS").map(sys.env.get) match {
|
|
|
|
|
case Seq(Some(user), Some(pass)) =>
|
2016-04-17 22:08:04 +02:00
|
|
|
Seq(Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass))
|
2015-11-21 14:23:06 +01:00
|
|
|
case _ =>
|
2016-04-17 22:08:04 +02:00
|
|
|
Seq()
|
2015-11-21 14:23:06 +01:00
|
|
|
}
|
2015-12-12 19:01:37 +01:00
|
|
|
}
|
|
|
|
|
)
|
2015-11-21 14:23:06 +01:00
|
|
|
|
2015-11-21 14:23:08 +01:00
|
|
|
lazy val noPublishSettings = Seq(
|
|
|
|
|
publish := (),
|
|
|
|
|
publishLocal := (),
|
|
|
|
|
publishArtifact := false
|
|
|
|
|
)
|
|
|
|
|
|
2016-10-22 01:35:57 +02:00
|
|
|
def noPublishForScalaVersionSettings(sbv: String*) = Seq(
|
2015-12-31 01:26:09 +01:00
|
|
|
publish := {
|
2016-10-22 01:35:57 +02:00
|
|
|
if (sbv.contains(scalaBinaryVersion.value))
|
2015-12-30 23:55:17 +01:00
|
|
|
()
|
|
|
|
|
else
|
|
|
|
|
publish.value
|
|
|
|
|
},
|
|
|
|
|
publishLocal := {
|
2016-10-22 01:35:57 +02:00
|
|
|
if (sbv.contains(scalaBinaryVersion.value))
|
2015-12-30 23:55:17 +01:00
|
|
|
()
|
|
|
|
|
else
|
|
|
|
|
publishLocal.value
|
|
|
|
|
},
|
|
|
|
|
publishArtifact := {
|
2016-10-22 01:35:57 +02:00
|
|
|
if (sbv.contains(scalaBinaryVersion.value))
|
2015-12-30 23:55:17 +01:00
|
|
|
false
|
|
|
|
|
else
|
|
|
|
|
publishArtifact.value
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2016-08-31 21:23:11 +02:00
|
|
|
lazy val scalaVersionAgnosticCommonSettings = Seq(
|
2016-03-17 17:28:18 +01:00
|
|
|
organization := "io.get-coursier",
|
2015-11-21 14:23:06 +01:00
|
|
|
resolvers ++= Seq(
|
|
|
|
|
"Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases",
|
2016-01-02 14:59:43 +01:00
|
|
|
Resolver.sonatypeRepo("releases")
|
2015-11-28 17:56:55 +01:00
|
|
|
),
|
2016-10-22 22:24:42 +02:00
|
|
|
scalacOptions ++= {
|
|
|
|
|
scalaBinaryVersion.value match {
|
|
|
|
|
case "2.10" | "2.11" =>
|
|
|
|
|
Seq("-target:jvm-1.7")
|
|
|
|
|
case _ =>
|
|
|
|
|
Seq()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
javacOptions ++= {
|
|
|
|
|
scalaBinaryVersion.value match {
|
|
|
|
|
case "2.10" | "2.11" =>
|
|
|
|
|
Seq(
|
|
|
|
|
"-source", "1.7",
|
|
|
|
|
"-target", "1.7"
|
|
|
|
|
)
|
|
|
|
|
case _ =>
|
|
|
|
|
Seq()
|
|
|
|
|
}
|
|
|
|
|
},
|
2015-12-30 01:34:34 +01:00
|
|
|
javacOptions in Keys.doc := Seq()
|
2015-12-31 01:26:09 +01:00
|
|
|
) ++ releaseSettings
|
2015-11-28 17:14:18 +01:00
|
|
|
|
2016-08-31 21:23:11 +02:00
|
|
|
lazy val commonSettings = scalaVersionAgnosticCommonSettings ++ Seq(
|
2016-03-13 22:57:23 +01:00
|
|
|
scalaVersion := "2.11.8",
|
2016-10-31 14:55:11 +01:00
|
|
|
crossScalaVersions := Seq("2.12.0", "2.11.8", "2.10.6"),
|
2015-11-21 14:23:08 +01:00
|
|
|
libraryDependencies ++= {
|
2016-08-31 21:23:11 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.10")
|
2016-10-21 21:50:49 +02:00
|
|
|
Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full))
|
2015-11-21 14:23:08 +01:00
|
|
|
else
|
|
|
|
|
Seq()
|
|
|
|
|
}
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
|
2016-10-31 14:54:50 +01:00
|
|
|
val scalazVersion = "7.2.7"
|
2016-08-31 21:23:11 +02:00
|
|
|
|
2015-11-21 14:23:06 +01:00
|
|
|
lazy val core = crossProject
|
|
|
|
|
.settings(commonSettings: _*)
|
2016-02-16 01:03:00 +01:00
|
|
|
.settings(mimaDefaultSettings: _*)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(
|
2016-01-31 20:55:18 +01:00
|
|
|
name := "coursier",
|
2016-08-17 22:19:25 +02:00
|
|
|
libraryDependencies ++= Seq(
|
2016-08-31 21:23:11 +02:00
|
|
|
"org.scalaz" %%% "scalaz-core" % scalazVersion,
|
2016-10-22 01:35:57 +02:00
|
|
|
"com.lihaoyi" %%% "fastparse" % "0.4.2"
|
2016-08-17 22:19:25 +02:00
|
|
|
),
|
2016-10-22 22:46:47 +02:00
|
|
|
mimaPreviousArtifacts := {
|
|
|
|
|
scalaBinaryVersion.value match {
|
|
|
|
|
case "2.10" | "2.11" =>
|
|
|
|
|
Set("com.github.alexarchambault" %% moduleName.value % binaryCompatibilityVersion)
|
|
|
|
|
case _ =>
|
|
|
|
|
Set()
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-08-31 21:23:11 +02:00
|
|
|
mimaBinaryIssueFilters ++= {
|
2016-02-16 01:03:00 +01:00
|
|
|
import com.typesafe.tools.mima.core._
|
2016-08-31 21:23:11 +02:00
|
|
|
|
2016-02-28 16:36:58 +01:00
|
|
|
Seq(
|
2016-05-28 00:50:07 +02:00
|
|
|
// Since 1.0.0-M13
|
2016-07-23 17:17:17 +02:00
|
|
|
// reworked VersionConstraint
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.core.VersionConstraint$Interval"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.core.VersionConstraint$Preferred"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.core.VersionConstraint$Preferred$"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.core.VersionConstraint$Interval$"),
|
|
|
|
|
ProblemFilters.exclude[FinalClassProblem]("coursier.core.VersionConstraint"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleResultTypeProblem]("coursier.core.VersionConstraint.repr"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem]("coursier.core.VersionConstraint.this"),
|
2016-05-28 00:50:07 +02:00
|
|
|
// Extra `actualVersion` field in `Project`
|
|
|
|
|
ProblemFilters.exclude[MissingTypesProblem]("coursier.core.Project$"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.core.Project.apply"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.core.Project.copy"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.core.Project.this"),
|
2016-07-03 17:21:17 +02:00
|
|
|
// Reworked Ivy pattern handling
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.pattern"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.copy"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.properties"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.parts"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.substitute"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.this"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.substituteProperties"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.propertyRegex"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.apply"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.variableRegex"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.Pattern.optionalPartRegex"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.ivy.Pattern$PatternPart$Literal$"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.ivy.Pattern$PatternPart"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.ivy.Pattern$PatternPart$"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem]("coursier.ivy.IvyRepository.apply"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.ivy.Pattern$PatternPart$Optional$"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.ivy.Pattern$PatternPart$Literal"),
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.ivy.Pattern$PatternPart$Optional"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleResultTypeProblem]("coursier.ivy.IvyRepository.pattern"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem]("coursier.ivy.IvyRepository.copy"),
|
|
|
|
|
ProblemFilters.exclude[DirectMissingMethodProblem]("coursier.ivy.IvyRepository.properties"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleResultTypeProblem]("coursier.ivy.IvyRepository.metadataPattern"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem]("coursier.ivy.IvyRepository.this"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleResultTypeProblem]("coursier.util.Parse.repository"),
|
2016-05-09 02:22:08 +02:00
|
|
|
// Since 1.0.0-M12
|
|
|
|
|
// Extra `authentication` field
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.core.Artifact.apply"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.core.Artifact.copy"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.core.Artifact.this"),
|
|
|
|
|
ProblemFilters.exclude[MissingTypesProblem]("coursier.ivy.IvyRepository$"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.ivy.IvyRepository.apply"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.ivy.IvyRepository.copy"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.ivy.IvyRepository.this"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.maven.MavenRepository.copy"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.maven.MavenRepository.this"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.maven.MavenSource.apply"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.maven.MavenRepository.apply"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.maven.MavenSource.copy"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.maven.MavenSource.this"),
|
2016-04-05 16:24:38 +02:00
|
|
|
// Since 1.0.0-M11
|
2016-04-05 16:24:38 +02:00
|
|
|
// Extra parameter with default value added, problem for forward compatibility only
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.core.ResolutionProcess.next"),
|
2016-04-05 16:24:38 +02:00
|
|
|
// method made final (for - non critical - tail recursion)
|
|
|
|
|
ProblemFilters.exclude[FinalMethodProblem]("coursier.core.ResolutionProcess.next"),
|
2016-02-28 16:36:58 +01:00
|
|
|
// Since 1.0.0-M10
|
2016-02-28 16:36:58 +01:00
|
|
|
ProblemFilters.exclude[IncompatibleResultTypeProblem]("coursier.core.Resolution.withParentConfigurations"),
|
2016-02-28 16:36:58 +01:00
|
|
|
// New singleton object, problem for forward compatibility only
|
|
|
|
|
ProblemFilters.exclude[MissingTypesProblem]("coursier.maven.MavenSource$")
|
|
|
|
|
)
|
2016-01-31 20:55:18 +01:00
|
|
|
}
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
.jvmSettings(
|
2015-11-29 20:20:31 +01:00
|
|
|
libraryDependencies ++=
|
|
|
|
|
Seq(
|
2016-05-29 23:45:58 +02:00
|
|
|
"org.jsoup" % "jsoup" % "1.9.2"
|
2015-11-29 20:20:31 +01:00
|
|
|
) ++ {
|
2016-08-31 21:23:11 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.10") Seq()
|
2015-11-29 20:20:31 +01:00
|
|
|
else Seq(
|
2016-06-19 15:41:04 +02:00
|
|
|
"org.scala-lang.modules" %% "scala-xml" % "1.0.5"
|
2015-11-29 20:20:31 +01:00
|
|
|
)
|
2016-10-22 22:24:42 +02:00
|
|
|
},
|
|
|
|
|
resourceGenerators.in(Compile) += {
|
|
|
|
|
(target, version).map { (dir, ver) =>
|
|
|
|
|
import sys.process._
|
|
|
|
|
|
|
|
|
|
val f = dir / "coursier.properties"
|
|
|
|
|
dir.mkdirs()
|
|
|
|
|
|
|
|
|
|
val p = new java.util.Properties
|
|
|
|
|
|
|
|
|
|
p.setProperty("version", ver)
|
|
|
|
|
p.setProperty("commit-hash", Seq("git", "rev-parse", "HEAD").!!.trim)
|
|
|
|
|
|
|
|
|
|
val w = new FileOutputStream(f)
|
|
|
|
|
p.store(w, "Coursier properties")
|
|
|
|
|
w.close()
|
|
|
|
|
|
|
|
|
|
println(s"Wrote $f")
|
|
|
|
|
|
|
|
|
|
Seq(f)
|
|
|
|
|
}.taskValue
|
|
|
|
|
}
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
.jsSettings(
|
|
|
|
|
libraryDependencies ++= Seq(
|
2016-10-22 22:24:41 +02:00
|
|
|
"org.scala-js" %%% "scalajs-dom" % "0.9.1"
|
2015-11-29 20:20:31 +01:00
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val coreJvm = core.jvm
|
|
|
|
|
lazy val coreJs = core.js
|
|
|
|
|
|
|
|
|
|
lazy val `fetch-js` = project
|
|
|
|
|
.enablePlugins(ScalaJSPlugin)
|
|
|
|
|
.dependsOn(coreJs)
|
|
|
|
|
.settings(commonSettings)
|
|
|
|
|
.settings(noPublishSettings)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "coursier-fetch-js"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val tests = crossProject
|
|
|
|
|
.dependsOn(core)
|
|
|
|
|
.settings(commonSettings: _*)
|
|
|
|
|
.settings(noPublishSettings: _*)
|
2016-08-15 16:14:32 +02:00
|
|
|
.configs(IntegrationTest)
|
|
|
|
|
.settings(Defaults.itSettings: _*)
|
2015-11-29 20:20:31 +01:00
|
|
|
.settings(
|
|
|
|
|
name := "coursier-tests",
|
2016-10-22 01:35:57 +02:00
|
|
|
libraryDependencies += {
|
|
|
|
|
val asyncVersion =
|
|
|
|
|
if (scalaBinaryVersion.value == "2.10")
|
|
|
|
|
"0.9.5"
|
|
|
|
|
else
|
2016-10-31 14:54:50 +01:00
|
|
|
"0.9.6"
|
2016-10-22 01:35:57 +02:00
|
|
|
|
|
|
|
|
"org.scala-lang.modules" %% "scala-async" % asyncVersion % "provided"
|
|
|
|
|
},
|
|
|
|
|
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.4.4" % "test",
|
2015-11-29 20:20:31 +01:00
|
|
|
unmanagedResourceDirectories in Test += (baseDirectory in LocalRootProject).value / "tests" / "shared" / "src" / "test" / "resources",
|
|
|
|
|
testFrameworks += new TestFramework("utest.runner.Framework")
|
|
|
|
|
)
|
|
|
|
|
.jsSettings(
|
2016-10-22 22:43:08 +02:00
|
|
|
scalaJSStage in Global := FastOptStage
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
|
2015-12-30 01:34:41 +01:00
|
|
|
lazy val testsJvm = tests.jvm.dependsOn(cache % "test")
|
2015-11-29 20:20:31 +01:00
|
|
|
lazy val testsJs = tests.js.dependsOn(`fetch-js` % "test")
|
2015-11-21 14:23:06 +01:00
|
|
|
|
2015-12-30 01:34:41 +01:00
|
|
|
lazy val cache = project
|
2015-11-21 14:23:06 +01:00
|
|
|
.dependsOn(coreJvm)
|
|
|
|
|
.settings(commonSettings)
|
2016-02-16 01:03:00 +01:00
|
|
|
.settings(mimaDefaultSettings)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(
|
2015-12-30 01:34:41 +01:00
|
|
|
name := "coursier-cache",
|
2016-08-31 21:23:11 +02:00
|
|
|
libraryDependencies += "org.scalaz" %% "scalaz-concurrent" % scalazVersion,
|
2016-10-22 22:46:47 +02:00
|
|
|
mimaPreviousArtifacts := {
|
|
|
|
|
scalaBinaryVersion.value match {
|
|
|
|
|
case "2.10" | "2.11" =>
|
|
|
|
|
Set("com.github.alexarchambault" %% moduleName.value % binaryCompatibilityVersion)
|
|
|
|
|
case _ =>
|
|
|
|
|
Set()
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-08-31 21:23:11 +02:00
|
|
|
mimaBinaryIssueFilters ++= {
|
2016-02-16 01:03:00 +01:00
|
|
|
import com.typesafe.tools.mima.core._
|
2016-08-31 21:23:11 +02:00
|
|
|
|
2016-02-16 01:03:00 +01:00
|
|
|
Seq(
|
2016-05-31 15:18:29 +02:00
|
|
|
// Since 1.0.0-M13
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.Cache.file"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.Cache.fetch"),
|
2016-05-09 02:22:08 +02:00
|
|
|
// Since 1.0.0-M12
|
|
|
|
|
// Remove deprecated / unused helper method
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.Cache.readFully"),
|
2016-04-05 16:24:39 +02:00
|
|
|
// Since 1.0.0-M11
|
|
|
|
|
// Add constructor parameter on FileError - shouldn't be built by users anyway
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.FileError.this"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.FileError#Recoverable.this"),
|
2016-03-06 14:45:57 +01:00
|
|
|
// Since 1.0.0-M10
|
2016-03-13 22:57:27 +01:00
|
|
|
// methods that should have been private anyway
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay.update"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay.fallbackMode_="),
|
2016-03-06 14:45:57 +01:00
|
|
|
// cache argument type changed from `Seq[(String, File)]` to `File`
|
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem]("coursier.Cache.file"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem]("coursier.Cache.fetch"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleResultTypeProblem]("coursier.Cache.default"),
|
|
|
|
|
ProblemFilters.exclude[IncompatibleMethTypeProblem]("coursier.Cache.validateChecksum"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.Cache.defaultBase"),
|
2016-03-06 14:55:39 +01:00
|
|
|
// New methdos in Cache.Logger
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.Cache#Logger.checkingUpdates"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.Cache#Logger.checkingUpdatesResult"),
|
2016-03-06 15:00:15 +01:00
|
|
|
// Better overload of Cache.Logger.downloadLength, deprecate previous one
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.Cache#Logger.downloadLength"),
|
2016-03-06 14:55:39 +01:00
|
|
|
// Changes to private class TermDisplay#Info
|
|
|
|
|
ProblemFilters.exclude[MissingClassProblem]("coursier.TermDisplay$Info$"),
|
|
|
|
|
ProblemFilters.exclude[AbstractClassProblem]("coursier.TermDisplay$Info"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.downloaded"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.productElement"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.productArity"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.canEqual"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.length"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.display"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.fraction"),
|
2016-02-24 20:17:23 +01:00
|
|
|
// Since 1.0.0-M9
|
|
|
|
|
// Added an optional extra parameter to FileError.NotFound - only
|
|
|
|
|
// its unapply method should break compatibility at the source level.
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.FileError#NotFound.copy"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.FileError#NotFound.this"),
|
|
|
|
|
ProblemFilters.exclude[MissingTypesProblem]("coursier.FileError$NotFound$"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.FileError#NotFound.apply"),
|
|
|
|
|
// Since 1.0.0-M8
|
2016-02-16 01:03:00 +01:00
|
|
|
ProblemFilters.exclude[MissingTypesProblem]("coursier.TermDisplay$Info$"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.apply"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.copy"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.pct"),
|
|
|
|
|
ProblemFilters.exclude[MissingMethodProblem]("coursier.TermDisplay#Info.this")
|
|
|
|
|
)
|
|
|
|
|
}
|
2015-11-29 20:20:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val bootstrap = project
|
2016-08-31 21:23:11 +02:00
|
|
|
.settings(scalaVersionAgnosticCommonSettings)
|
2015-12-30 23:55:17 +01:00
|
|
|
.settings(noPublishSettings)
|
2015-11-29 20:20:31 +01:00
|
|
|
.settings(
|
|
|
|
|
name := "coursier-bootstrap",
|
|
|
|
|
artifactName := {
|
|
|
|
|
val artifactName0 = artifactName.value
|
|
|
|
|
(sv, m, artifact) =>
|
|
|
|
|
if (artifact.`type` == "jar" && artifact.extension == "jar")
|
|
|
|
|
"bootstrap.jar"
|
|
|
|
|
else
|
|
|
|
|
artifactName0(sv, m, artifact)
|
|
|
|
|
},
|
|
|
|
|
crossPaths := false,
|
2015-12-30 01:34:34 +01:00
|
|
|
autoScalaLibrary := false
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val cli = project
|
2015-12-30 01:34:41 +01:00
|
|
|
.dependsOn(coreJvm, cache)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(commonSettings)
|
2016-10-31 14:55:11 +01:00
|
|
|
.settings(noPublishForScalaVersionSettings("2.10", "2.12"))
|
2015-11-29 20:20:31 +01:00
|
|
|
.settings(packAutoSettings)
|
2016-01-31 21:06:05 +01:00
|
|
|
.settings(proguardSettings)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(
|
|
|
|
|
name := "coursier-cli",
|
2015-12-30 23:55:17 +01:00
|
|
|
libraryDependencies ++= {
|
2016-10-22 01:35:57 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
2016-10-20 10:58:05 +02:00
|
|
|
Seq("com.github.alexarchambault" %% "case-app" % "1.1.2")
|
2016-10-22 01:35:57 +02:00
|
|
|
else
|
|
|
|
|
Seq()
|
2015-12-30 23:55:17 +01:00
|
|
|
},
|
2015-12-30 01:34:44 +01:00
|
|
|
resourceGenerators in Compile += packageBin.in(bootstrap).in(Compile).map { jar =>
|
|
|
|
|
Seq(jar)
|
2016-01-31 21:06:05 +01:00
|
|
|
}.taskValue,
|
2016-10-23 00:19:40 +02:00
|
|
|
ProguardKeys.proguardVersion in Proguard := "5.3",
|
2016-01-31 21:06:05 +01:00
|
|
|
ProguardKeys.options in Proguard ++= Seq(
|
|
|
|
|
"-dontwarn",
|
|
|
|
|
"-keep class coursier.cli.Coursier {\n public static void main(java.lang.String[]);\n}",
|
|
|
|
|
"-keep class coursier.cli.IsolatedClassLoader {\n public java.lang.String[] getIsolationTargets();\n}"
|
|
|
|
|
),
|
|
|
|
|
javaOptions in (Proguard, ProguardKeys.proguard) := Seq("-Xmx3172M"),
|
2016-02-20 15:53:09 +01:00
|
|
|
artifactPath in Proguard := (ProguardKeys.proguardDirectory in Proguard).value / "coursier-standalone.jar",
|
|
|
|
|
artifacts ++= {
|
2016-10-22 01:35:57 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
|
|
|
|
Seq(
|
|
|
|
|
Artifact(
|
|
|
|
|
moduleName.value,
|
|
|
|
|
"jar",
|
|
|
|
|
"jar",
|
|
|
|
|
"standalone"
|
|
|
|
|
)
|
2016-02-20 15:53:09 +01:00
|
|
|
)
|
2016-10-22 01:35:57 +02:00
|
|
|
else
|
|
|
|
|
Nil
|
2016-02-20 15:53:09 +01:00
|
|
|
},
|
|
|
|
|
packagedArtifacts <++= {
|
|
|
|
|
(
|
|
|
|
|
moduleName,
|
|
|
|
|
scalaBinaryVersion,
|
2016-04-13 00:34:26 +02:00
|
|
|
ProguardKeys.proguard in Proguard,
|
|
|
|
|
packageBin.in(bootstrap) in Compile
|
2016-02-20 15:53:09 +01:00
|
|
|
).map {
|
2016-04-13 00:34:26 +02:00
|
|
|
(mod, sbv, files, bootstrapJar) =>
|
2016-10-22 01:35:57 +02:00
|
|
|
if (sbv == "2.11") {
|
2016-04-13 00:34:26 +02:00
|
|
|
import java.util.zip.{ ZipEntry, ZipOutputStream, ZipInputStream }
|
|
|
|
|
import java.io.{ ByteArrayOutputStream, FileInputStream, FileOutputStream, File, InputStream, IOException }
|
|
|
|
|
|
|
|
|
|
val f0 = files match {
|
2016-02-20 15:53:09 +01:00
|
|
|
case Seq(f) => f
|
|
|
|
|
case Seq() =>
|
|
|
|
|
throw new Exception("Found no proguarded files. Expected one.")
|
|
|
|
|
case _ =>
|
|
|
|
|
throw new Exception("Found several proguarded files. Don't know how to publish all of them.")
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-13 00:34:26 +02:00
|
|
|
val f = new File(f0.getParentFile, f0.getName.stripSuffix(".jar") + "-with-bootstrap.jar")
|
|
|
|
|
|
|
|
|
|
val is = new FileInputStream(f0)
|
|
|
|
|
val os = new FileOutputStream(f)
|
|
|
|
|
val bootstrapZip = new ZipInputStream(is)
|
|
|
|
|
val outputZip = new ZipOutputStream(os)
|
|
|
|
|
|
|
|
|
|
def readFullySync(is: InputStream) = {
|
|
|
|
|
val buffer = new ByteArrayOutputStream
|
|
|
|
|
val data = Array.ofDim[Byte](16384)
|
|
|
|
|
|
|
|
|
|
var nRead = is.read(data, 0, data.length)
|
|
|
|
|
while (nRead != -1) {
|
|
|
|
|
buffer.write(data, 0, nRead)
|
|
|
|
|
nRead = is.read(data, 0, data.length)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buffer.flush()
|
|
|
|
|
buffer.toByteArray
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def zipEntries(zipStream: ZipInputStream): Iterator[(ZipEntry, Array[Byte])] =
|
|
|
|
|
new Iterator[(ZipEntry, Array[Byte])] {
|
|
|
|
|
var nextEntry = Option.empty[ZipEntry]
|
|
|
|
|
def update() =
|
|
|
|
|
nextEntry = Option(zipStream.getNextEntry)
|
|
|
|
|
|
|
|
|
|
update()
|
|
|
|
|
|
|
|
|
|
def hasNext = nextEntry.nonEmpty
|
|
|
|
|
def next() = {
|
|
|
|
|
val ent = nextEntry.get
|
|
|
|
|
val data = readFullySync(zipStream)
|
|
|
|
|
|
|
|
|
|
update()
|
|
|
|
|
|
|
|
|
|
(ent, data)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ((ent, data) <- zipEntries(bootstrapZip)) {
|
|
|
|
|
outputZip.putNextEntry(ent)
|
|
|
|
|
outputZip.write(data)
|
|
|
|
|
outputZip.closeEntry()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outputZip.putNextEntry(new ZipEntry("bootstrap.jar"))
|
|
|
|
|
outputZip.write(readFullySync(new FileInputStream(bootstrapJar)))
|
|
|
|
|
outputZip.closeEntry()
|
|
|
|
|
|
|
|
|
|
outputZip.close()
|
|
|
|
|
|
|
|
|
|
is.close()
|
|
|
|
|
os.close()
|
|
|
|
|
|
|
|
|
|
|
2016-02-20 15:53:09 +01:00
|
|
|
Map(
|
|
|
|
|
// FIXME Same Artifact as above
|
|
|
|
|
Artifact(
|
|
|
|
|
mod,
|
|
|
|
|
"jar",
|
|
|
|
|
"jar",
|
|
|
|
|
"standalone"
|
|
|
|
|
) -> f
|
|
|
|
|
)
|
2016-10-22 01:35:57 +02:00
|
|
|
} else
|
|
|
|
|
Map.empty[Artifact, File]
|
2016-02-20 15:53:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
2015-11-21 14:23:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val web = project
|
|
|
|
|
.enablePlugins(ScalaJSPlugin)
|
2015-11-29 20:20:31 +01:00
|
|
|
.dependsOn(coreJs, `fetch-js`)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(commonSettings)
|
2015-11-21 14:23:08 +01:00
|
|
|
.settings(noPublishSettings)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(
|
|
|
|
|
libraryDependencies ++= {
|
2016-10-22 01:35:57 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
2016-10-22 22:24:41 +02:00
|
|
|
Seq(
|
|
|
|
|
"be.doeraene" %%% "scalajs-jquery" % "0.9.0",
|
|
|
|
|
"com.github.japgolly.scalajs-react" %%% "core" % "0.9.0"
|
|
|
|
|
)
|
2016-10-22 01:35:57 +02:00
|
|
|
else
|
|
|
|
|
Seq()
|
2015-11-21 14:23:06 +01:00
|
|
|
},
|
|
|
|
|
sourceDirectory := {
|
|
|
|
|
val dir = sourceDirectory.value
|
|
|
|
|
|
2016-10-22 01:35:57 +02:00
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
2015-11-21 14:23:06 +01:00
|
|
|
dir
|
2016-10-22 01:35:57 +02:00
|
|
|
else
|
|
|
|
|
dir / "dummy"
|
2015-11-21 14:23:06 +01:00
|
|
|
},
|
|
|
|
|
test in Test := (),
|
|
|
|
|
testOnly in Test := (),
|
|
|
|
|
resolvers += "Webjars Bintray" at "https://dl.bintray.com/webjars/maven/",
|
|
|
|
|
jsDependencies ++= Seq(
|
|
|
|
|
("org.webjars.bower" % "bootstrap" % "3.3.4" intransitive()) / "bootstrap.min.js" commonJSName "Bootstrap",
|
|
|
|
|
("org.webjars.bower" % "react" % "0.12.2" intransitive()) / "react-with-addons.js" commonJSName "React",
|
|
|
|
|
("org.webjars.bower" % "bootstrap-treeview" % "1.2.0" intransitive()) / "bootstrap-treeview.min.js" commonJSName "Treeview",
|
|
|
|
|
("org.webjars.bower" % "raphael" % "2.1.4" intransitive()) / "raphael-min.js" commonJSName "Raphael"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2015-12-30 01:34:34 +01:00
|
|
|
lazy val doc = project
|
2015-12-30 01:34:41 +01:00
|
|
|
.dependsOn(coreJvm, cache)
|
2015-12-30 01:34:34 +01:00
|
|
|
.settings(commonSettings)
|
|
|
|
|
.settings(noPublishSettings)
|
|
|
|
|
.settings(tutSettings)
|
|
|
|
|
.settings(
|
|
|
|
|
tutSourceDirectory := baseDirectory.value,
|
|
|
|
|
tutTargetDirectory := baseDirectory.value / ".."
|
|
|
|
|
)
|
|
|
|
|
|
2015-12-30 01:34:34 +01:00
|
|
|
// Don't try to compile that if you're not in 2.10
|
|
|
|
|
lazy val plugin = project
|
2015-12-30 01:34:44 +01:00
|
|
|
.dependsOn(coreJvm, cache)
|
2016-08-31 21:23:11 +02:00
|
|
|
.settings(scalaVersionAgnosticCommonSettings)
|
2016-10-31 14:55:11 +01:00
|
|
|
.settings(noPublishForScalaVersionSettings("2.11", "2.12"))
|
2015-12-30 01:34:34 +01:00
|
|
|
.settings(
|
2016-03-19 15:17:45 +01:00
|
|
|
name := "sbt-coursier",
|
2016-08-31 21:23:11 +02:00
|
|
|
sbtPlugin := (scalaBinaryVersion.value == "2.10"),
|
2016-04-01 00:39:30 +02:00
|
|
|
resolvers ++= Seq(
|
|
|
|
|
// added so that 2.10 artifacts of the other modules can be found by
|
|
|
|
|
// the too-naive-for-now inter-project resolver of the coursier SBT plugin
|
|
|
|
|
Resolver.sonatypeRepo("snapshots"),
|
|
|
|
|
// added for sbt-scripted to be fine even with ++2.11.x
|
|
|
|
|
Resolver.typesafeIvyRepo("releases")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.settings(ScriptedPlugin.scriptedSettings)
|
|
|
|
|
.settings(
|
|
|
|
|
scriptedLaunchOpts ++= Seq(
|
|
|
|
|
"-Xmx1024M",
|
|
|
|
|
"-XX:MaxPermSize=256M",
|
2016-04-01 00:39:31 +02:00
|
|
|
"-Dplugin.version=" + version.value,
|
|
|
|
|
"-Dsbttest.base=" + (sourceDirectory.value / "sbt-test").getAbsolutePath
|
2016-04-01 00:39:30 +02:00
|
|
|
),
|
|
|
|
|
scriptedBufferLog := false
|
2015-12-30 01:34:34 +01:00
|
|
|
)
|
|
|
|
|
|
2016-05-09 11:28:11 +02:00
|
|
|
val http4sVersion = "0.8.6"
|
|
|
|
|
|
2016-08-05 17:37:23 +02:00
|
|
|
lazy val `http-server` = project
|
2016-04-05 16:24:39 +02:00
|
|
|
.settings(commonSettings)
|
|
|
|
|
.settings(packAutoSettings)
|
2016-10-31 14:55:11 +01:00
|
|
|
.settings(noPublishForScalaVersionSettings("2.10", "2.12"))
|
2016-04-05 16:24:39 +02:00
|
|
|
.settings(
|
2016-08-05 20:37:25 +02:00
|
|
|
name := "http-server-java7",
|
2016-10-22 01:35:57 +02:00
|
|
|
libraryDependencies ++= {
|
|
|
|
|
if (scalaBinaryVersion.value == "2.11")
|
|
|
|
|
Seq(
|
|
|
|
|
"org.http4s" %% "http4s-blazeserver" % http4sVersion,
|
|
|
|
|
"org.http4s" %% "http4s-dsl" % http4sVersion,
|
|
|
|
|
"org.slf4j" % "slf4j-nop" % "1.7.21",
|
|
|
|
|
"com.github.alexarchambault" %% "case-app" % "1.1.2"
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
Seq()
|
|
|
|
|
}
|
2016-04-05 16:24:39 +02:00
|
|
|
)
|
|
|
|
|
|
2016-08-22 00:40:01 +02:00
|
|
|
lazy val okhttp = project
|
|
|
|
|
.dependsOn(cache)
|
|
|
|
|
.settings(commonSettings)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "coursier-okhttp",
|
|
|
|
|
libraryDependencies ++= Seq(
|
|
|
|
|
"com.squareup.okhttp" % "okhttp-urlconnection" % "2.7.5"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2015-11-21 14:23:06 +01:00
|
|
|
lazy val `coursier` = project.in(file("."))
|
2016-08-22 00:40:01 +02:00
|
|
|
.aggregate(coreJvm, coreJs, `fetch-js`, testsJvm, testsJs, cache, bootstrap, cli, plugin, web, doc, `http-server`, okhttp)
|
2015-11-21 14:23:06 +01:00
|
|
|
.settings(commonSettings)
|
2015-11-21 14:23:08 +01:00
|
|
|
.settings(noPublishSettings)
|
2015-12-12 19:01:37 +01:00
|
|
|
.settings(releaseSettings)
|
2016-05-29 23:45:55 +02:00
|
|
|
.settings(
|
|
|
|
|
moduleName := "coursier-root"
|
|
|
|
|
)
|