mirror of https://github.com/sbt/sbt.git
commit
bfe36c7ec7
|
|
@ -22,7 +22,8 @@ install:
|
|||
Set-Location -Path ..
|
||||
}
|
||||
build_script:
|
||||
- sbt ++2.11.11 clean compile coreJVM/publishLocal http-server/publishLocal
|
||||
- sbt ++2.11.11 clean compile coreJVM/publishLocal
|
||||
- sbt ++2.12.1 http-server/publishLocal
|
||||
- sbt ++2.10.6 clean compile
|
||||
- sbt ++2.12.1 coreJVM/publishLocal cache/publishLocal extra/publishLocal # to make the scripted sbt 1.0 tests happy
|
||||
- sbt ++2.10.6 coreJVM/publishLocal cache/publishLocal extra/publishLocal # to make the scripted sbt 0.13 tests happy
|
||||
|
|
|
|||
48
build.sbt
48
build.sbt
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import Aliases._
|
||||
import CoursierSettings._
|
||||
import Settings._
|
||||
import Publish._
|
||||
|
||||
parallelExecution.in(Global) := false
|
||||
|
|
@ -137,7 +137,7 @@ lazy val web = project
|
|||
if (scalaBinaryVersion.value == "2.11")
|
||||
dir
|
||||
else
|
||||
dir / "dummy"
|
||||
dir / "target" / "dummy"
|
||||
},
|
||||
noTests,
|
||||
webjarBintrayRepository,
|
||||
|
|
@ -163,10 +163,10 @@ lazy val web = project
|
|||
|
||||
lazy val doc = project
|
||||
.dependsOn(coreJvm, cache)
|
||||
.enablePlugins(TutPlugin)
|
||||
.settings(
|
||||
shared,
|
||||
dontPublish,
|
||||
tutSettings,
|
||||
tutSourceDirectory := baseDirectory.value,
|
||||
tutTargetDirectory := baseDirectory.in(LocalRootProject).value
|
||||
)
|
||||
|
|
@ -194,11 +194,17 @@ lazy val `sbt-launcher` = project
|
|||
.settings(
|
||||
shared,
|
||||
generatePack,
|
||||
libs ++= Seq(
|
||||
Deps.caseApp,
|
||||
Deps.sbtLauncherInterface,
|
||||
Deps.typesafeConfig
|
||||
)
|
||||
dontPublishIn("2.10", "2.12"),
|
||||
libs ++= {
|
||||
if (scalaBinaryVersion.value == "2.11")
|
||||
Seq(
|
||||
Deps.caseApp,
|
||||
Deps.sbtLauncherInterface,
|
||||
Deps.typesafeConfig
|
||||
)
|
||||
else
|
||||
Nil
|
||||
}
|
||||
)
|
||||
|
||||
lazy val `http-server` = project
|
||||
|
|
@ -206,12 +212,18 @@ lazy val `http-server` = project
|
|||
shared,
|
||||
generatePack,
|
||||
name := "http-server",
|
||||
libs ++= Seq(
|
||||
Deps.http4sBlazeServer,
|
||||
Deps.http4sDsl,
|
||||
Deps.slf4jNop,
|
||||
Deps.caseApp12
|
||||
)
|
||||
dontPublishIn("2.10", "2.11"),
|
||||
libs ++= {
|
||||
if (scalaBinaryVersion.value == "2.12")
|
||||
Seq(
|
||||
Deps.http4sBlazeServer,
|
||||
Deps.http4sDsl,
|
||||
Deps.slf4jNop,
|
||||
Deps.caseApp12
|
||||
)
|
||||
else
|
||||
Nil
|
||||
}
|
||||
)
|
||||
|
||||
lazy val okhttp = project
|
||||
|
|
@ -223,9 +235,10 @@ lazy val okhttp = project
|
|||
)
|
||||
|
||||
lazy val echo = project
|
||||
.settings(shared)
|
||||
.settings(pureJava)
|
||||
|
||||
lazy val jvm = project
|
||||
.dummy
|
||||
.aggregate(
|
||||
coreJvm,
|
||||
testsJvm,
|
||||
|
|
@ -248,6 +261,7 @@ lazy val jvm = project
|
|||
)
|
||||
|
||||
lazy val js = project
|
||||
.dummy
|
||||
.aggregate(
|
||||
coreJs,
|
||||
`fetch-js`,
|
||||
|
|
@ -261,7 +275,7 @@ lazy val js = project
|
|||
)
|
||||
|
||||
lazy val coursier = project
|
||||
.in(file("."))
|
||||
.in(root)
|
||||
.aggregate(
|
||||
coreJvm,
|
||||
coreJs,
|
||||
|
|
@ -306,7 +320,7 @@ lazy val addBootstrapInProguardedJar = {
|
|||
}
|
||||
|
||||
lazy val proguardedCli = Seq(
|
||||
ProguardKeys.proguardVersion.in(Proguard) := "5.3",
|
||||
ProguardKeys.proguardVersion.in(Proguard) := SharedVersions.proguard,
|
||||
ProguardKeys.options.in(Proguard) ++= Seq(
|
||||
"-dontwarn",
|
||||
"-keep class coursier.cli.Coursier {\n public static void main(java.lang.String[]);\n}",
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ object Properties {
|
|||
p.load(
|
||||
getClass
|
||||
.getClassLoader
|
||||
.getResourceAsStream("coursier.properties")
|
||||
.getResourceAsStream("coursier/coursier.properties")
|
||||
)
|
||||
p
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package coursier.echo;
|
||||
|
||||
public class Echo {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
boolean isFirst = true;
|
||||
|
||||
for (String arg : args) {
|
||||
|
||||
if (isFirst)
|
||||
isFirst = false;
|
||||
else
|
||||
System.out.print(" ");
|
||||
|
||||
System.out.print(arg);
|
||||
}
|
||||
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
object Echo {
|
||||
def main(args: Array[String]): Unit =
|
||||
println(args.mkString(" "))
|
||||
}
|
||||
|
|
@ -19,13 +19,13 @@ import scalaz.concurrent.Task
|
|||
final case class AuthOptions(
|
||||
@ExtraName("u")
|
||||
@ValueDescription("user")
|
||||
user: String,
|
||||
user: String = "",
|
||||
@ExtraName("P")
|
||||
@ValueDescription("password")
|
||||
password: String,
|
||||
password: String = "",
|
||||
@ExtraName("r")
|
||||
@ValueDescription("realm")
|
||||
realm: String
|
||||
realm: String = ""
|
||||
) {
|
||||
def checks(): Unit = {
|
||||
if (user.nonEmpty && password.isEmpty)
|
||||
|
|
@ -50,21 +50,21 @@ final case class AuthOptions(
|
|||
|
||||
final case class VerbosityOptions(
|
||||
@ExtraName("v")
|
||||
verbose: Int @@ Counter,
|
||||
verbose: Int @@ Counter = Tag.of(0),
|
||||
@ExtraName("q")
|
||||
quiet: Boolean
|
||||
quiet: Boolean = false
|
||||
) {
|
||||
lazy val verbosityLevel = Tag.unwrap(verbose) - (if (quiet) 1 else 0)
|
||||
}
|
||||
|
||||
final case class HttpServerOptions(
|
||||
@Recurse
|
||||
auth: AuthOptions,
|
||||
auth: AuthOptions = AuthOptions(),
|
||||
@Recurse
|
||||
verbosity: VerbosityOptions,
|
||||
verbosity: VerbosityOptions = VerbosityOptions(),
|
||||
@ExtraName("d")
|
||||
@ValueDescription("served directory")
|
||||
directory: String,
|
||||
directory: String = ".",
|
||||
@ExtraName("h")
|
||||
@ValueDescription("host")
|
||||
host: String = "0.0.0.0",
|
||||
|
|
@ -72,15 +72,15 @@ final case class HttpServerOptions(
|
|||
@ValueDescription("port")
|
||||
port: Int = 8080,
|
||||
@ExtraName("s")
|
||||
acceptPost: Boolean,
|
||||
acceptPost: Boolean = false,
|
||||
@ExtraName("t")
|
||||
acceptPut: Boolean,
|
||||
acceptPut: Boolean = false,
|
||||
@ExtraName("w")
|
||||
@HelpMessage("Accept write requests. Equivalent to -s -t")
|
||||
acceptWrite: Boolean,
|
||||
acceptWrite: Boolean = false,
|
||||
@ExtraName("l")
|
||||
@HelpMessage("Generate content listing pages for directories")
|
||||
listPages: Boolean
|
||||
listPages: Boolean = false
|
||||
)
|
||||
|
||||
object HttpServer {
|
||||
|
|
@ -18,4 +18,12 @@ object Aliases {
|
|||
|
||||
def ShadingPlugin = coursier.ShadingPlugin
|
||||
|
||||
def root = file(".")
|
||||
|
||||
|
||||
implicit class ProjectOps(val proj: Project) extends AnyVal {
|
||||
def dummy: Project =
|
||||
proj.in(file(s"target/${proj.id}"))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ object CrossDeps {
|
|||
// The setting / .value hoop-and-loop is necessary because of the expansion of the %%% macro, which references
|
||||
// other settings.
|
||||
|
||||
def fastParse = setting("com.lihaoyi" %%% "fastparse" % "0.4.2")
|
||||
def fastParse = setting("com.lihaoyi" %%% "fastparse" % SharedVersions.fastParse)
|
||||
def scalazCore = setting("org.scalaz" %%% "scalaz-core" % SharedVersions.scalaz)
|
||||
def scalaJsDom = setting("org.scala-js" %%% "scalajs-dom" % "0.9.1")
|
||||
def utest = setting("com.lihaoyi" %%% "utest" % "0.4.5")
|
||||
def scalaJsDom = setting("org.scala-js" %%% "scalajs-dom" % "0.9.2")
|
||||
def utest = setting("com.lihaoyi" %%% "utest" % "0.4.7")
|
||||
def scalaJsJquery = setting("be.doeraene" %%% "scalajs-jquery" % "0.9.1")
|
||||
def scalaJsReact = setting("com.github.japgolly.scalajs-react" %%% "core" % "0.9.0")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ import sbt.Keys._
|
|||
object Deps {
|
||||
|
||||
def quasiQuotes = "org.scalamacros" %% "quasiquotes" % "2.1.0"
|
||||
def fastParse = "com.lihaoyi" %% "fastparse" % "0.4.2"
|
||||
def fastParse = "com.lihaoyi" %% "fastparse" % SharedVersions.fastParse
|
||||
def jsoup = "org.jsoup" % "jsoup" % "1.10.2"
|
||||
def scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.6"
|
||||
def scalazConcurrent = "org.scalaz" %% "scalaz-concurrent" % SharedVersions.scalaz
|
||||
def caseApp = "com.github.alexarchambault" %% "case-app" % "1.1.3"
|
||||
def caseApp12 = "com.github.alexarchambault" %% "case-app" % "1.2.0-M2"
|
||||
def caseApp12 = "com.github.alexarchambault" %% "case-app" % "1.2.0-M3"
|
||||
def http4sBlazeServer = "org.http4s" %% "http4s-blaze-server" % SharedVersions.http4s
|
||||
def http4sDsl = "org.http4s" %% "http4s-dsl" % SharedVersions.http4s
|
||||
def slf4jNop = "org.slf4j" % "slf4j-nop" % "1.7.22"
|
||||
def slf4jNop = "org.slf4j" % "slf4j-nop" % "1.7.25"
|
||||
def okhttpUrlConnection = "com.squareup.okhttp" % "okhttp-urlconnection" % "2.7.5"
|
||||
def sbtLauncherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0"
|
||||
def typesafeConfig = "com.typesafe" % "config" % "1.3.1"
|
||||
def argonautShapeless = "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M4"
|
||||
def argonautShapeless = "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M5"
|
||||
|
||||
def scalaAsync = Def.setting {
|
||||
|
||||
|
|
@ -56,6 +56,6 @@ object Deps {
|
|||
"com.google.code.findbugs" % "jsr305" % "2.0.2",
|
||||
"org.ow2.asm" % "asm-commons" % "5.0.3",
|
||||
"org.ow2.asm" % "asm-util" % "5.0.3",
|
||||
"org.slf4j" % "slf4j-api" % "1.7.12"
|
||||
"org.slf4j" % "slf4j-api" % "1.7.25"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ object HttpUtil {
|
|||
buffer.toByteArray
|
||||
}
|
||||
|
||||
def fetch(url: String, log: Logger): String = {
|
||||
def fetch(url: String, log: Logger, extraHeaders: Seq[(String, String)] = Nil): String = {
|
||||
|
||||
val url0 = new URL(url)
|
||||
|
||||
|
|
@ -36,7 +36,8 @@ object HttpUtil {
|
|||
try {
|
||||
conn = url0.openConnection()
|
||||
httpConn = conn.asInstanceOf[HttpURLConnection]
|
||||
httpConn.setRequestProperty("Accept", "application/vnd.travis-ci.2+json")
|
||||
for ((k, v) <- extraHeaders)
|
||||
httpConn.setRequestProperty(k, v)
|
||||
is = conn.getInputStream
|
||||
|
||||
(readFully(is), httpConn.getResponseCode)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,21 @@ import com.typesafe.tools.mima.plugin.MimaKeys._
|
|||
|
||||
object Mima {
|
||||
|
||||
def binaryCompatibilityVersion = "1.0.0-RC1"
|
||||
// Important: the line with the "binary compatibility versions" comment below is matched during releases
|
||||
def binaryCompatibilityVersions = Set(
|
||||
"1.0.0-RC1",
|
||||
"1.0.0-RC2",
|
||||
"1.0.0-RC3",
|
||||
"" // binary compatibility versions
|
||||
)
|
||||
|
||||
|
||||
lazy val previousArtifacts = Seq(
|
||||
mimaPreviousArtifacts := {
|
||||
Set(organization.value %% moduleName.value % binaryCompatibilityVersion)
|
||||
binaryCompatibilityVersions.collect {
|
||||
case ver if ver.nonEmpty =>
|
||||
organization.value %% moduleName.value % ver
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.regex.Pattern
|
|||
import com.typesafe.sbt.pgp.PgpKeys
|
||||
import sbt._
|
||||
import sbt.Keys._
|
||||
import sbt.Package.ManifestAttributes
|
||||
import sbtrelease.ReleasePlugin.autoImport._
|
||||
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
|
||||
|
||||
|
|
@ -205,10 +206,12 @@ object Release {
|
|||
val baseDir = Project.extract(state).get(baseDirectory.in(ThisBuild))
|
||||
val pluginsSbtFile = baseDir / "project" / "plugins.sbt"
|
||||
val projectPluginsSbtFile = baseDir / "project" / "project" / "plugins.sbt"
|
||||
val projectProjectPluginsSbtFile = baseDir / "project" / "project" / "project" / "plugins.sbt"
|
||||
|
||||
val files = Seq(
|
||||
pluginsSbtFile,
|
||||
projectPluginsSbtFile
|
||||
projectPluginsSbtFile,
|
||||
projectProjectPluginsSbtFile
|
||||
)
|
||||
|
||||
for (f <- files) {
|
||||
|
|
@ -228,6 +231,42 @@ object Release {
|
|||
state
|
||||
}
|
||||
|
||||
val mimaVersionsPattern = s"(?m)^(\\s+)${Pattern.quote("\"\" // binary compatibility versions")}$$".r
|
||||
|
||||
val updateMimaVersions = ReleaseStep { state =>
|
||||
|
||||
val vcs = state.vcs
|
||||
|
||||
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
||||
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
||||
}
|
||||
|
||||
val baseDir = Project.extract(state).get(baseDirectory.in(ThisBuild))
|
||||
val mimaScalaFile = baseDir / "project" / "Mima.scala"
|
||||
|
||||
val content = Source.fromFile(mimaScalaFile)(Codec.UTF8).mkString
|
||||
|
||||
mimaVersionsPattern.findAllIn(content).toVector match {
|
||||
case Seq() => sys.error(s"Found no matches in $mimaScalaFile")
|
||||
case Seq(_) =>
|
||||
case _ => sys.error(s"Found too many matches in $mimaScalaFile")
|
||||
}
|
||||
|
||||
val newContent = mimaVersionsPattern.replaceAllIn(
|
||||
content,
|
||||
m => {
|
||||
val indent = m.group(1)
|
||||
indent + "\"" + releaseVer + "\",\n" +
|
||||
indent + "\"\" // binary compatibility versions"
|
||||
}
|
||||
)
|
||||
|
||||
Files.write(mimaScalaFile.toPath, newContent.getBytes(StandardCharsets.UTF_8))
|
||||
vcs.add(mimaScalaFile.getAbsolutePath).!!(state.log)
|
||||
|
||||
state
|
||||
}
|
||||
|
||||
val commitUpdates = ReleaseStep(
|
||||
action = { state =>
|
||||
|
||||
|
|
@ -255,6 +294,40 @@ object Release {
|
|||
}
|
||||
)
|
||||
|
||||
val addReleaseToManifest = ReleaseStep { state =>
|
||||
|
||||
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
||||
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
||||
}
|
||||
|
||||
val tag = "v" + releaseVer
|
||||
|
||||
reapply(
|
||||
Seq(
|
||||
// Tag will be one commit after the one with which the publish was really made, because of the commit
|
||||
// updating scripts / plugins.
|
||||
packageOptions += ManifestAttributes("Vcs-Release-Tag" -> tag)
|
||||
),
|
||||
state
|
||||
)
|
||||
}
|
||||
|
||||
// tagRelease from sbt-release seem to use the next version (snapshot one typically) rather than the released one :/
|
||||
val reallyTagRelease = ReleaseStep { state =>
|
||||
|
||||
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
||||
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
||||
}
|
||||
|
||||
val sign = Project.extract(state).get(releaseVcsSign)
|
||||
|
||||
val tag = "v" + releaseVer
|
||||
|
||||
state.vcs.tag(tag, s"Releasing $tag", sign).!(state.log)
|
||||
|
||||
state
|
||||
}
|
||||
|
||||
|
||||
val settings = Seq(
|
||||
releaseProcess := Seq[ReleaseStep](
|
||||
|
|
@ -266,6 +339,7 @@ object Release {
|
|||
saveInitialVersion,
|
||||
setReleaseVersion,
|
||||
commitReleaseVersion,
|
||||
addReleaseToManifest,
|
||||
publishArtifacts,
|
||||
releaseStepCommand("sonatypeRelease"),
|
||||
updateScripts,
|
||||
|
|
@ -274,11 +348,13 @@ object Release {
|
|||
releaseStepCommand("tut"),
|
||||
stageReadme,
|
||||
updatePluginsSbt,
|
||||
updateMimaVersions,
|
||||
commitUpdates,
|
||||
tagRelease,
|
||||
reallyTagRelease,
|
||||
setNextVersion,
|
||||
commitNextVersion,
|
||||
ReleaseStep(_.reload),
|
||||
releaseStepCommand("mimaReportBinaryIssues"),
|
||||
pushChanges
|
||||
),
|
||||
releasePublishArtifactsAction := PgpKeys.publishSigned.value
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import xerial.sbt.Pack.{packAutoSettings, packExcludeArtifactTypes}
|
|||
|
||||
import Aliases._
|
||||
|
||||
object CoursierSettings {
|
||||
object Settings {
|
||||
|
||||
lazy val scalazBintrayRepository = {
|
||||
resolvers += "Scalaz Bintray Repo" at "https://dl.bintray.com/scalaz/releases"
|
||||
|
|
@ -73,12 +73,12 @@ object CoursierSettings {
|
|||
resourceGenerators.in(Compile) += Def.task {
|
||||
import sys.process._
|
||||
|
||||
val dir = target.value
|
||||
val dir = classDirectory.in(Compile).value / "coursier"
|
||||
val ver = version.value
|
||||
|
||||
val f = dir / "coursier.properties"
|
||||
dir.mkdirs()
|
||||
|
||||
|
||||
val p = new java.util.Properties
|
||||
|
||||
p.setProperty("version", ver)
|
||||
|
|
@ -88,7 +88,7 @@ object CoursierSettings {
|
|||
p.store(w, "Coursier properties")
|
||||
w.close()
|
||||
|
||||
println(s"Wrote $f")
|
||||
state.value.log.info(s"Wrote $f")
|
||||
|
||||
Seq(f)
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ object CoursierSettings {
|
|||
if (sbtScalaVersionMatch.value)
|
||||
baseDirectory.value
|
||||
else
|
||||
baseDirectory.value / "dummy"
|
||||
baseDirectory.value / "target" / "dummy"
|
||||
},
|
||||
publish := {
|
||||
if (sbtScalaVersionMatch.value)
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
object SharedVersions {
|
||||
|
||||
val scalaz = "7.2.8"
|
||||
def fastParse = "0.4.2"
|
||||
def http4s = "0.15.12a"
|
||||
def proguard = "5.3.3"
|
||||
def scalaz = "7.2.12"
|
||||
|
||||
val http4s = "0.15.9a"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,11 +51,14 @@ object Travis {
|
|||
job: JobDetails
|
||||
)
|
||||
|
||||
val extraHeaders = Seq(
|
||||
"Accept" -> "application/vnd.travis-ci.2+json"
|
||||
)
|
||||
|
||||
def builds(repo: String, log: Logger): List[Build] = {
|
||||
|
||||
val url = s"https://api.travis-ci.org/repos/$repo/builds"
|
||||
val resp = HttpUtil.fetch(url, log)
|
||||
val resp = HttpUtil.fetch(url, log, extraHeaders)
|
||||
|
||||
resp.decodeEither[Builds] match {
|
||||
case Left(err) =>
|
||||
|
|
@ -69,7 +72,7 @@ object Travis {
|
|||
def job(id: JobId, log: Logger): Job = {
|
||||
|
||||
val url = s"https://api.travis-ci.org/jobs/${id.value}"
|
||||
val resp = HttpUtil.fetch(url, log)
|
||||
val resp = HttpUtil.fetch(url, log, extraHeaders)
|
||||
|
||||
resp.decodeEither[Job] match {
|
||||
case Left(err) =>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
|
||||
plugins_(
|
||||
"io.get-coursier" % "sbt-coursier" % coursierVersion,
|
||||
"com.typesafe" % "sbt-mima-plugin" % "0.1.13",
|
||||
"com.typesafe" % "sbt-mima-plugin" % "0.1.14",
|
||||
"org.xerial.sbt" % "sbt-pack" % "0.8.2",
|
||||
"com.jsuereth" % "sbt-pgp" % "1.0.0",
|
||||
"com.typesafe.sbt" % "sbt-proguard" % "0.2.2",
|
||||
"com.github.gseitz" % "sbt-release" % "1.0.4",
|
||||
"com.jsuereth" % "sbt-pgp" % "1.0.1",
|
||||
"com.typesafe.sbt" % "sbt-proguard" % "0.2.3",
|
||||
"com.github.gseitz" % "sbt-release" % "1.0.5",
|
||||
"org.scala-js" % "sbt-scalajs" % "0.6.16",
|
||||
"org.scoverage" % "sbt-scoverage" % "1.4.0",
|
||||
"io.get-coursier" % "sbt-shading" % coursierVersion,
|
||||
"org.xerial.sbt" % "sbt-sonatype" % "1.1",
|
||||
"org.tpolecat" % "tut-plugin" % "0.4.8"
|
||||
"com.timushev.sbt" % "sbt-updates" % "0.3.0",
|
||||
"org.tpolecat" % "tut-plugin" % "0.5.1"
|
||||
)
|
||||
|
||||
libs ++= Seq(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % coursierVersion)
|
||||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.0")
|
||||
|
||||
// important: this line is matched / substituted during releases (via sbt-release)
|
||||
def coursierVersion = "1.0.0-RC3"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % coursierVersion)
|
||||
|
||||
// important: this line is matched / substituted during releases (via sbt-release)
|
||||
def coursierVersion = "1.0.0-RC3"
|
||||
|
||||
// required for just released things
|
||||
resolvers += Resolver.sonatypeRepo("releases")
|
||||
|
|
@ -7,6 +7,8 @@ import java.net.{MalformedURLException, URL}
|
|||
import coursier.core.Authentication
|
||||
import sbt.{CrossVersion, ModuleID, Resolver}
|
||||
|
||||
import scalaz.{-\/, \/-}
|
||||
|
||||
import SbtCompatibility._
|
||||
|
||||
object FromSbt {
|
||||
|
|
@ -189,14 +191,25 @@ object FromSbt {
|
|||
|
||||
mavenCompatibleBaseOpt0 match {
|
||||
case None =>
|
||||
Some(IvyRepository(
|
||||
|
||||
val repo = IvyRepository.parse(
|
||||
"file://" + r.patterns.artifactPatterns.head,
|
||||
metadataPatternOpt = Some("file://" + r.patterns.ivyPatterns.head),
|
||||
changing = Some(true),
|
||||
properties = ivyProperties,
|
||||
dropInfoAttributes = true,
|
||||
authentication = authentication
|
||||
))
|
||||
) match {
|
||||
case -\/(err) =>
|
||||
sys.error(
|
||||
s"Cannot parse Ivy patterns ${r.patterns.artifactPatterns.head} and ${r.patterns.ivyPatterns.head}: $err"
|
||||
)
|
||||
case \/-(repo) =>
|
||||
repo
|
||||
}
|
||||
|
||||
Some(repo)
|
||||
|
||||
case Some(mavenCompatibleBase) =>
|
||||
mavenRepositoryOpt("file://" + mavenCompatibleBase, log, authentication)
|
||||
}
|
||||
|
|
@ -209,14 +222,25 @@ object FromSbt {
|
|||
|
||||
mavenCompatibleBaseOpt0 match {
|
||||
case None =>
|
||||
Some(IvyRepository(
|
||||
|
||||
val repo = IvyRepository.parse(
|
||||
r.patterns.artifactPatterns.head,
|
||||
metadataPatternOpt = Some(r.patterns.ivyPatterns.head),
|
||||
changing = None,
|
||||
properties = ivyProperties,
|
||||
dropInfoAttributes = true,
|
||||
authentication = authentication
|
||||
))
|
||||
) match {
|
||||
case -\/(err) =>
|
||||
sys.error(
|
||||
s"Cannot parse Ivy patterns ${r.patterns.artifactPatterns.head} and ${r.patterns.ivyPatterns.head}: $err"
|
||||
)
|
||||
case \/-(repo) =>
|
||||
repo
|
||||
}
|
||||
|
||||
Some(repo)
|
||||
|
||||
case Some(mavenCompatibleBase) =>
|
||||
mavenRepositoryOpt(mavenCompatibleBase, log, authentication)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package coursier
|
||||
|
||||
import java.io.{File, InputStream, OutputStreamWriter}
|
||||
import java.io.{File, OutputStreamWriter}
|
||||
import java.net.URL
|
||||
import java.util.concurrent.{ExecutorService, Executors}
|
||||
|
||||
|
|
@ -9,14 +9,11 @@ import coursier.extra.Typelevel
|
|||
import coursier.ivy.{IvyRepository, PropertiesPattern}
|
||||
import coursier.Keys._
|
||||
import coursier.Structure._
|
||||
import coursier.internal.FileUtil
|
||||
import coursier.util.{Config, Print}
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId
|
||||
import sbt.{ClasspathDep, Classpaths, Def, ProjectRef, Resolver, UpdateReport}
|
||||
import sbt.{Classpaths, Def, Resolver, UpdateReport}
|
||||
import sbt.Keys._
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import scala.util.Try
|
||||
import scalaz.{-\/, \/-}
|
||||
|
|
@ -47,43 +44,45 @@ object Tasks {
|
|||
structure(state).allProjectRefs.filter(p => deps(p.project))
|
||||
}
|
||||
|
||||
def coursierResolversTask: Def.Initialize[sbt.Task[Seq[Resolver]]] =
|
||||
(
|
||||
externalResolvers,
|
||||
sbtPlugin,
|
||||
sbtResolver,
|
||||
bootResolvers,
|
||||
overrideBuildResolvers
|
||||
).map { (extRes, isSbtPlugin, sbtRes, bootResOpt, overrideFlag) =>
|
||||
bootResOpt.filter(_ => overrideFlag).getOrElse {
|
||||
var resolvers = extRes
|
||||
if (isSbtPlugin)
|
||||
resolvers = Seq(
|
||||
sbtRes,
|
||||
Classpaths.sbtPluginReleases
|
||||
) ++ resolvers
|
||||
resolvers
|
||||
}
|
||||
def coursierResolversTask: Def.Initialize[sbt.Task[Seq[Resolver]]] = Def.task {
|
||||
|
||||
val extRes = externalResolvers.value
|
||||
val isSbtPlugin = sbtPlugin.value
|
||||
val sbtRes = sbtResolver.value
|
||||
val bootResOpt = bootResolvers.value
|
||||
val overrideFlag = overrideBuildResolvers.value
|
||||
|
||||
bootResOpt.filter(_ => overrideFlag).getOrElse {
|
||||
var resolvers = extRes
|
||||
if (isSbtPlugin)
|
||||
resolvers = Seq(
|
||||
sbtRes,
|
||||
Classpaths.sbtPluginReleases
|
||||
) ++ resolvers
|
||||
resolvers
|
||||
}
|
||||
}
|
||||
|
||||
def coursierRecursiveResolversTask: Def.Initialize[sbt.Task[Seq[Resolver]]] =
|
||||
(
|
||||
sbt.Keys.state,
|
||||
sbt.Keys.thisProjectRef
|
||||
).flatMap { (state, projectRef) =>
|
||||
Def.taskDyn {
|
||||
|
||||
val state = sbt.Keys.state.value
|
||||
val projectRef = sbt.Keys.thisProjectRef.value
|
||||
|
||||
val projects = allRecursiveInterDependencies(state, projectRef)
|
||||
|
||||
coursierResolvers
|
||||
val t = coursierResolvers
|
||||
.forAllProjects(state, projectRef +: projects)
|
||||
.map(_.values.toVector.flatten)
|
||||
|
||||
Def.task(t.value)
|
||||
}
|
||||
|
||||
def coursierFallbackDependenciesTask: Def.Initialize[sbt.Task[Seq[(Module, String, URL, Boolean)]]] =
|
||||
(
|
||||
sbt.Keys.state,
|
||||
sbt.Keys.thisProjectRef
|
||||
).flatMap { (state, projectRef) =>
|
||||
Def.taskDyn {
|
||||
|
||||
val state = sbt.Keys.state.value
|
||||
val projectRef = sbt.Keys.thisProjectRef.value
|
||||
|
||||
val projects = allRecursiveInterDependencies(state, projectRef)
|
||||
|
||||
|
|
@ -91,9 +90,8 @@ object Tasks {
|
|||
.forAllProjects(state, projectRef +: projects)
|
||||
.map(_.values.toVector.flatten)
|
||||
|
||||
for {
|
||||
allDependencies <- allDependenciesTask
|
||||
} yield {
|
||||
Def.task {
|
||||
val allDependencies = allDependenciesTask.value
|
||||
|
||||
FromSbt.fallbackDependencies(
|
||||
allDependencies,
|
||||
|
|
@ -104,10 +102,10 @@ object Tasks {
|
|||
}
|
||||
|
||||
def coursierProjectTask: Def.Initialize[sbt.Task[Project]] =
|
||||
(
|
||||
sbt.Keys.state,
|
||||
sbt.Keys.thisProjectRef
|
||||
).flatMap { (state, projectRef) =>
|
||||
Def.taskDyn {
|
||||
|
||||
val state = sbt.Keys.state.value
|
||||
val projectRef = sbt.Keys.thisProjectRef.value
|
||||
|
||||
// should projectID.configurations be used instead?
|
||||
val configurations = ivyConfigurations.in(projectRef).get(state)
|
||||
|
|
@ -143,9 +141,9 @@ object Tasks {
|
|||
res
|
||||
}
|
||||
|
||||
for {
|
||||
allDependencies <- allDependenciesTask
|
||||
} yield {
|
||||
Def.task {
|
||||
|
||||
val allDependencies = allDependenciesTask.value
|
||||
|
||||
val configMap = configurations.map(cfg => cfg.name -> cfg.extendsConfigs.map(_.name)).toMap
|
||||
|
||||
|
|
@ -167,14 +165,16 @@ object Tasks {
|
|||
}
|
||||
|
||||
def coursierInterProjectDependenciesTask: Def.Initialize[sbt.Task[Seq[Project]]] =
|
||||
(
|
||||
sbt.Keys.state,
|
||||
sbt.Keys.thisProjectRef
|
||||
).flatMap { (state, projectRef) =>
|
||||
Def.taskDyn {
|
||||
|
||||
val state = sbt.Keys.state.value
|
||||
val projectRef = sbt.Keys.thisProjectRef.value
|
||||
|
||||
val projects = allRecursiveInterDependencies(state, projectRef)
|
||||
|
||||
coursierProject.forAllProjects(state, projects).map(_.values.toVector)
|
||||
val t = coursierProject.forAllProjects(state, projects).map(_.values.toVector)
|
||||
|
||||
Def.task(t.value)
|
||||
}
|
||||
|
||||
def coursierPublicationsTask(
|
||||
|
|
@ -408,8 +408,10 @@ object Tasks {
|
|||
}
|
||||
|
||||
def parentProjectCacheTask: Def.Initialize[sbt.Task[Map[Seq[sbt.Resolver],Seq[coursier.ProjectCache]]]] =
|
||||
(sbt.Keys.state,
|
||||
sbt.Keys.thisProjectRef).flatMap{ (state, projectRef) =>
|
||||
Def.taskDyn {
|
||||
|
||||
val state = sbt.Keys.state.value
|
||||
val projectRef = sbt.Keys.thisProjectRef.value
|
||||
|
||||
val projectDeps = structure(state).allProjects
|
||||
.find(_.id == projectRef.project)
|
||||
|
|
@ -418,16 +420,27 @@ object Tasks {
|
|||
|
||||
val projects = structure(state).allProjectRefs.filter(p => projectDeps(p.project))
|
||||
|
||||
coursierRecursiveResolvers.forAllProjects(state, projects).flatMap{ m =>
|
||||
coursierResolution.forAllProjects(state, m.keys.toSeq).map{ n =>
|
||||
n.foldLeft(Map.empty[Seq[Resolver], Seq[ProjectCache]]){ case (caches, (ref, resolution)) =>
|
||||
m.get(ref).fold(caches)(resolvers =>
|
||||
caches.updated(resolvers, resolution.projectCache +: caches.getOrElse(resolvers, Seq.empty)))
|
||||
val t =
|
||||
for {
|
||||
m <- coursierRecursiveResolvers.forAllProjects(state, projects)
|
||||
n <- coursierResolution.forAllProjects(state, m.keys.toSeq)
|
||||
} yield
|
||||
n.foldLeft(Map.empty[Seq[Resolver], Seq[ProjectCache]]) {
|
||||
case (caches, (ref, resolution)) =>
|
||||
m.get(ref).fold(caches) { resolvers =>
|
||||
caches.updated(
|
||||
resolvers,
|
||||
resolution.projectCache +: caches.getOrElse(resolvers, Nil)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Def.task(t.value)
|
||||
}
|
||||
|
||||
private val noOptionalFilter: Option[Dependency => Boolean] = Some(dep => !dep.optional)
|
||||
private val typelevelOrgSwap: Option[Dependency => Dependency] = Some(Typelevel.swap(_))
|
||||
|
||||
|
||||
def resolutionTask(
|
||||
sbtClassifiers: Boolean = false
|
||||
|
|
@ -509,7 +522,7 @@ object Tasks {
|
|||
|
||||
val startRes = Resolution(
|
||||
currentProject.dependencies.map(_._2).toSet,
|
||||
filter = Some(dep => !dep.optional),
|
||||
filter = noOptionalFilter,
|
||||
userActivations =
|
||||
if (userEnabledProfiles.isEmpty)
|
||||
None
|
||||
|
|
@ -521,7 +534,7 @@ object Tasks {
|
|||
forcedScalaModules(so, sv) ++
|
||||
interProjectDependencies.map(_.moduleVersion),
|
||||
projectCache = parentProjectCache,
|
||||
mapDependencies = if (typelevel) Some(Typelevel.swap(_)) else None
|
||||
mapDependencies = if (typelevel) typelevelOrgSwap else None
|
||||
)
|
||||
|
||||
if (verbosityLevel >= 2) {
|
||||
|
|
@ -1063,7 +1076,7 @@ object Tasks {
|
|||
reportsCache.getOrElseUpdate(
|
||||
ReportCacheKey(
|
||||
currentProject,
|
||||
res.copy(filter = None),
|
||||
res,
|
||||
withClassifiers,
|
||||
sbtClassifiers
|
||||
),
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ cd "$(dirname "$0")/.."
|
|||
# synchronously fill cache so that two runs of this script don't try to download
|
||||
# a same file at the same time (and one of them fail because of locks)
|
||||
./coursier fetch \
|
||||
"io.get-coursier:http-server_2.11:$VERSION" \
|
||||
"io.get-coursier:http-server_2.12:$VERSION" \
|
||||
-r https://dl.bintray.com/scalaz/releases
|
||||
|
||||
./coursier launch \
|
||||
"io.get-coursier:http-server_2.11:$VERSION" \
|
||||
"io.get-coursier:http-server_2.12:$VERSION" \
|
||||
-- \
|
||||
-d tests/jvm/src/test/resources/test-repo/http/abc.com \
|
||||
-u user -P pass -r realm \
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# see https://stackoverflow.com/questions/2224350/powershell-start-job-working-directory/2246542#2246542
|
||||
Set-Location $args[0]
|
||||
& java -jar -noverify coursier launch io.get-coursier:http-server_2.11:1.0.0-SNAPSHOT -- -d tests/jvm/src/test/resources/test-repo/http/abc.com -u user -P pass -r realm --port 8080 --list-pages -v
|
||||
& java -jar -noverify coursier launch io.get-coursier:http-server_2.12:1.0.0-SNAPSHOT -- -d tests/jvm/src/test/resources/test-repo/http/abc.com -u user -P pass -r realm --port 8080 --list-pages -v
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# see https://stackoverflow.com/questions/2224350/powershell-start-job-working-directory/2246542#2246542
|
||||
Set-Location $args[0]
|
||||
& java -jar -noverify coursier launch io.get-coursier:http-server_2.11:1.0.0-SNAPSHOT -- -d tests/jvm/src/test/resources/test-repo/http/abc.com -u user -P pass -r realm --port 8081 -v
|
||||
& java -jar -noverify coursier launch io.get-coursier:http-server_2.12:1.0.0-SNAPSHOT -- -d tests/jvm/src/test/resources/test-repo/http/abc.com -u user -P pass -r realm --port 8081 -v
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ launchTestRepo() {
|
|||
|
||||
integrationTestsRequirements() {
|
||||
# Required for ~/.ivy2/local repo tests
|
||||
sbt ++2.11.11 coreJVM/publishLocal http-server/publishLocal
|
||||
sbt ++2.11.11 coreJVM/publishLocal
|
||||
|
||||
sbt ++2.12.1 http-server/publishLocal
|
||||
|
||||
# Required for HTTP authentication tests
|
||||
launchTestRepo --port 8080 --list-pages
|
||||
|
|
@ -179,7 +181,7 @@ publish() {
|
|||
testBootstrap() {
|
||||
if is211; then
|
||||
sbt ++${SCALA_VERSION} echo/publishLocal cli/pack
|
||||
cli/target/pack/bin/coursier bootstrap -o cs-echo io.get-coursier:echo_2.11:1.0.0-SNAPSHOT
|
||||
cli/target/pack/bin/coursier bootstrap -o cs-echo io.get-coursier:echo:1.0.0-SNAPSHOT
|
||||
if [ "$(./cs-echo foo)" != foo ]; then
|
||||
echo "Error: unexpected output from bootstrapped echo command." 1>&2
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package coursier.test
|
||||
|
||||
import coursier.util.Properties
|
||||
import utest._
|
||||
|
||||
object PropertiesTests extends TestSuite {
|
||||
|
||||
val tests = TestSuite {
|
||||
|
||||
'version - {
|
||||
assert(Properties.version.nonEmpty)
|
||||
}
|
||||
|
||||
'commitHash - {
|
||||
assert(Properties.commitHash.nonEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
io.get-coursier:coursier_2.11:1.0.0-SNAPSHOT:compile
|
||||
org.scala-lang:scala-library:2.11.11:default
|
||||
org.scala-lang.modules:scala-xml_2.11:1.0.6:default
|
||||
org.scalaz:scalaz-core_2.11:7.2.8:default
|
||||
org.scalaz:scalaz-core_2.11:7.2.12:default
|
||||
|
|
|
|||
|
|
@ -239,8 +239,16 @@ object ResolutionTests extends TestSuite {
|
|||
Set(dep)
|
||||
))
|
||||
|
||||
// A missing POM dependency is not reported correctly. That's why the method is deprecated.
|
||||
assert(res.errors == Seq.empty)
|
||||
val directDependencyErrors =
|
||||
for {
|
||||
dep <- res.dependencies.toSeq
|
||||
err <- res.errorCache
|
||||
.get(dep.moduleVersion)
|
||||
.toSeq
|
||||
} yield (dep, err)
|
||||
|
||||
// Error originates from a dependency import, not directly from a dependency
|
||||
assert(directDependencyErrors.isEmpty)
|
||||
|
||||
// metadataErrors have that
|
||||
assert(res.metadataErrors == Seq((Module("acme", "missing-pom"), "1.0.0") -> List("Not found")))
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ $('.nav-tabs a').on('shown.bs.tab', function (e) {
|
|||
</script>
|
||||
|
||||
<script>
|
||||
coursier.web.Main().main();
|
||||
CoursierWeb.main();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package coursier.web
|
||||
|
||||
import japgolly.scalajs.react.React
|
||||
import scala.scalajs.js.annotation.JSExport
|
||||
|
||||
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
|
||||
import org.scalajs.dom.document
|
||||
|
||||
@JSExport
|
||||
@JSExportTopLevel("CoursierWeb")
|
||||
object Main {
|
||||
@JSExport
|
||||
def main(): Unit = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue