mirror of https://github.com/sbt/sbt.git
Merge pull request #313 from alexarchambault/topic/develop
Latest developments
This commit is contained in:
commit
e0317f8ba3
|
|
@ -28,11 +28,11 @@ function isMasterOrDevelop() {
|
|||
}
|
||||
|
||||
# Required for ~/.ivy2/local repo tests
|
||||
~/sbt coreJVM/publishLocal simple-web-server/publishLocal
|
||||
~/sbt coreJVM/publishLocal http-server/publishLocal
|
||||
|
||||
# Required for HTTP authentication tests
|
||||
./coursier launch \
|
||||
io.get-coursier:simple-web-server_2.11:1.0.0-SNAPSHOT \
|
||||
io.get-coursier:http-server-java7_2.11:1.0.0-SNAPSHOT \
|
||||
-r http://dl.bintray.com/scalaz/releases \
|
||||
-- \
|
||||
-d tests/jvm/src/test/resources/test-repo/http/abc.com \
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ install:
|
|||
- cmd: SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g
|
||||
- cmd: SET COURSIER_NO_TERM=1
|
||||
build_script:
|
||||
- sbt ++2.11.8 clean compile coreJVM/publishLocal simple-web-server/publishLocal
|
||||
- sbt ++2.11.8 clean compile coreJVM/publishLocal http-server/publishLocal
|
||||
- sbt ++2.10.6 clean compile
|
||||
- sbt ++2.10.6 coreJVM/publishLocal cache/publishLocal # to make the scripted tests happy
|
||||
test_script:
|
||||
- ps: Start-Job { & java -jar -noverify C:\projects\coursier\coursier launch -r http://dl.bintray.com/scalaz/releases io.get-coursier:simple-web-server_2.11:1.0.0-SNAPSHOT -- -d /C:/projects/coursier/tests/jvm/src/test/resources/test-repo/http/abc.com -u user -P pass -r realm -v }
|
||||
- ps: Start-Job { & java -jar -noverify C:\projects\coursier\coursier launch -r http://dl.bintray.com/scalaz/releases io.get-coursier:http-server-java7_2.11:1.0.0-SNAPSHOT -- -d /C:/projects/coursier/tests/jvm/src/test/resources/test-repo/http/abc.com -u user -P pass -r realm -v }
|
||||
- sbt ++2.11.8 testsJVM/test # Would node be around for testsJS/test?
|
||||
- sbt ++2.10.6 testsJVM/test plugin/scripted
|
||||
cache:
|
||||
|
|
|
|||
|
|
@ -552,10 +552,11 @@ lazy val plugin = project
|
|||
|
||||
val http4sVersion = "0.8.6"
|
||||
|
||||
lazy val `simple-web-server` = project
|
||||
lazy val `http-server` = project
|
||||
.settings(commonSettings)
|
||||
.settings(packAutoSettings)
|
||||
.settings(
|
||||
name := "http-server-java7",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.http4s" %% "http4s-blazeserver" % http4sVersion,
|
||||
"org.http4s" %% "http4s-dsl" % http4sVersion,
|
||||
|
|
@ -565,7 +566,7 @@ lazy val `simple-web-server` = project
|
|||
)
|
||||
|
||||
lazy val `coursier` = project.in(file("."))
|
||||
.aggregate(coreJvm, coreJs, `fetch-js`, testsJvm, testsJs, cache, bootstrap, cli, plugin, web, doc, `simple-web-server`)
|
||||
.aggregate(coreJvm, coreJs, `fetch-js`, testsJvm, testsJs, cache, bootstrap, cli, plugin, web, doc, `http-server`)
|
||||
.settings(commonSettings)
|
||||
.settings(noPublishSettings)
|
||||
.settings(releaseSettings)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ case class Bootstrap(
|
|||
if (options.downloadDir.isEmpty)
|
||||
helper.baseDependencies.headOption match {
|
||||
case Some(dep) =>
|
||||
s"\\$$HOME/.coursier/bootstrap/${dep.module.organization}/${dep.module.name}"
|
||||
s"$${user.home}/.coursier/bootstrap/${dep.module.organization}/${dep.module.name}"
|
||||
case None =>
|
||||
Console.err.println("Error: no dependencies specified.")
|
||||
sys.exit(255)
|
||||
|
|
@ -81,7 +81,10 @@ case class Bootstrap(
|
|||
}
|
||||
|
||||
|
||||
val isolatedDeps = options.isolated.isolatedDeps(options.common.defaultArtifactType)
|
||||
val isolatedDeps = options.isolated.isolatedDeps(
|
||||
options.common.defaultArtifactType,
|
||||
options.common.scalaVersion
|
||||
)
|
||||
|
||||
val (_, isolatedArtifactFiles) =
|
||||
options.isolated.targets.foldLeft((Vector.empty[String], Map.empty[String, (Seq[String], Seq[File])])) {
|
||||
|
|
|
|||
|
|
@ -161,9 +161,9 @@ class Helper(
|
|||
|
||||
|
||||
val (modVerCfgErrors, moduleVersionConfigs) =
|
||||
Parse.moduleVersionConfigs(rawDependencies)
|
||||
Parse.moduleVersionConfigs(rawDependencies, scalaVersion)
|
||||
val (intransitiveModVerCfgErrors, intransitiveModuleVersionConfigs) =
|
||||
Parse.moduleVersionConfigs(intransitive)
|
||||
Parse.moduleVersionConfigs(intransitive, scalaVersion)
|
||||
|
||||
prematureExitIf(modVerCfgErrors.nonEmpty) {
|
||||
s"Cannot parse dependencies:\n" + modVerCfgErrors.map(" "+_).mkString("\n")
|
||||
|
|
@ -175,7 +175,7 @@ class Helper(
|
|||
}
|
||||
|
||||
|
||||
val (forceVersionErrors, forceVersions0) = Parse.moduleVersions(forceVersion)
|
||||
val (forceVersionErrors, forceVersions0) = Parse.moduleVersions(forceVersion, scalaVersion)
|
||||
|
||||
prematureExitIf(forceVersionErrors.nonEmpty) {
|
||||
s"Cannot parse forced versions:\n" + forceVersionErrors.map(" "+_).mkString("\n")
|
||||
|
|
@ -220,7 +220,7 @@ class Helper(
|
|||
grouped.map { case (mod, versions) => mod -> versions.last }
|
||||
}
|
||||
|
||||
val (excludeErrors, excludes0) = Parse.modules(exclude)
|
||||
val (excludeErrors, excludes0) = Parse.modules(exclude, scalaVersion)
|
||||
|
||||
prematureExitIf(excludeErrors.nonEmpty) {
|
||||
s"Cannot parse excluded modules:\n" +
|
||||
|
|
@ -607,7 +607,7 @@ class Helper(
|
|||
(parentLoader0, files0)
|
||||
else {
|
||||
|
||||
val isolatedDeps = isolated.isolatedDeps(common.defaultArtifactType)
|
||||
val isolatedDeps = isolated.isolatedDeps(common.defaultArtifactType, common.scalaVersion)
|
||||
|
||||
val (isolatedLoader, filteredFiles0) = isolated.targets.foldLeft((parentLoader0, files0)) {
|
||||
case ((parent, files0), target) =>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ case class CommonOptions(
|
|||
@Value("organization:name")
|
||||
@Short("E")
|
||||
exclude: List[String],
|
||||
@Help("Default scala version")
|
||||
@Short("e")
|
||||
scalaVersion: String = scala.util.Properties.versionNumberString,
|
||||
@Help("Add intransitive dependencies")
|
||||
intransitive: List[String],
|
||||
@Help("Classifiers that should be fetched")
|
||||
|
|
@ -137,9 +140,9 @@ case class IsolatedLoaderOptions(
|
|||
target -> dep
|
||||
}
|
||||
|
||||
lazy val isolatedModuleVersions = rawIsolated.groupBy { case (t, _) => t }.map {
|
||||
def isolatedModuleVersions(defaultScalaVersion: String) = rawIsolated.groupBy { case (t, _) => t }.map {
|
||||
case (t, l) =>
|
||||
val (errors, modVers) = Parse.moduleVersions(l.map { case (_, d) => d })
|
||||
val (errors, modVers) = Parse.moduleVersions(l.map { case (_, d) => d }, defaultScalaVersion)
|
||||
|
||||
if (errors.nonEmpty) {
|
||||
errors.foreach(Console.err.println)
|
||||
|
|
@ -149,8 +152,8 @@ case class IsolatedLoaderOptions(
|
|||
t -> modVers
|
||||
}
|
||||
|
||||
def isolatedDeps(defaultArtifactType: String) =
|
||||
isolatedModuleVersions.map {
|
||||
def isolatedDeps(defaultArtifactType: String, defaultScalaVersion: String) =
|
||||
isolatedModuleVersions(defaultScalaVersion).map {
|
||||
case (t, l) =>
|
||||
t -> l.map {
|
||||
case (mod, ver) =>
|
||||
|
|
|
|||
|
|
@ -11,18 +11,37 @@ import scalaz.Scalaz.ToEitherOps
|
|||
|
||||
object Parse {
|
||||
|
||||
private def defaultScalaVersion = scala.util.Properties.versionNumberString
|
||||
|
||||
@deprecated("use the variant accepting a default scala version")
|
||||
def module(s: String): Either[String, Module] =
|
||||
module(s, defaultScalaVersion)
|
||||
|
||||
/**
|
||||
* Parses a module like
|
||||
* org:name
|
||||
* possibly with attributes, like
|
||||
* org:name;attr1=val1;attr2=val2
|
||||
*
|
||||
* Two semi-columns after the org part is interpreted as a scala module. E.g. if
|
||||
* `defaultScalaVersion` is `"2.11.x"`, org::name:ver is equivalent to org:name_2.11:ver.
|
||||
*/
|
||||
def module(s: String): Either[String, Module] = {
|
||||
def module(s: String, defaultScalaVersion: String): Either[String, Module] = {
|
||||
|
||||
val parts = s.split(":", 2)
|
||||
val parts = s.split(":", 3)
|
||||
|
||||
parts match {
|
||||
val values = parts match {
|
||||
case Array(org, rawName) =>
|
||||
Right((org, rawName, ""))
|
||||
case Array(org, "", rawName) =>
|
||||
Right((org, rawName, "_" + defaultScalaVersion.split('.').take(2).mkString(".")))
|
||||
case _ =>
|
||||
Left(s"malformed module: $s")
|
||||
}
|
||||
|
||||
values.right.flatMap {
|
||||
case (org, rawName, suffix) =>
|
||||
|
||||
val splitName = rawName.split(';')
|
||||
|
||||
if (splitName.tail.exists(!_.contains("=")))
|
||||
|
|
@ -33,11 +52,8 @@ object Parse {
|
|||
case Array(key, value) => key -> value
|
||||
}.toMap
|
||||
|
||||
Right(Module(org, name, attributes))
|
||||
Right(Module(org, name + suffix, attributes))
|
||||
}
|
||||
|
||||
case _ =>
|
||||
Left(s"malformed module: $s")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,13 +71,21 @@ object Parse {
|
|||
(errors, values)
|
||||
}
|
||||
|
||||
@deprecated("use the variant accepting a default scala version")
|
||||
def modules(l: Seq[String]): (Seq[String], Seq[Module]) =
|
||||
modules(l, defaultScalaVersion)
|
||||
|
||||
/**
|
||||
* Parses a sequence of coordinates.
|
||||
*
|
||||
* @return Sequence of errors, and sequence of modules/versions
|
||||
*/
|
||||
def modules(l: Seq[String]): (Seq[String], Seq[Module]) =
|
||||
valuesAndErrors(module, l)
|
||||
def modules(l: Seq[String], defaultScalaVersion: String): (Seq[String], Seq[Module]) =
|
||||
valuesAndErrors(module(_, defaultScalaVersion), l)
|
||||
|
||||
@deprecated("use the variant accepting a default scala version")
|
||||
def moduleVersion(s: String): Either[String, (Module, String)] =
|
||||
moduleVersion(s, defaultScalaVersion)
|
||||
|
||||
/**
|
||||
* Parses coordinates like
|
||||
|
|
@ -69,21 +93,30 @@ object Parse {
|
|||
* possibly with attributes, like
|
||||
* org:name;attr1=val1;attr2=val2:version
|
||||
*/
|
||||
def moduleVersion(s: String): Either[String, (Module, String)] = {
|
||||
def moduleVersion(s: String, defaultScalaVersion: String): Either[String, (Module, String)] = {
|
||||
|
||||
val parts = s.split(":", 3)
|
||||
val parts = s.split(":", 4)
|
||||
|
||||
parts match {
|
||||
case Array(org, rawName, version) =>
|
||||
module(s"$org:$rawName")
|
||||
module(s"$org:$rawName", defaultScalaVersion)
|
||||
.right
|
||||
.map((_, version))
|
||||
|
||||
case Array(org, "", rawName, version) =>
|
||||
module(s"$org::$rawName", defaultScalaVersion)
|
||||
.right
|
||||
.map((_, version))
|
||||
|
||||
case _ =>
|
||||
Left(s"Malformed dependency: $s")
|
||||
}
|
||||
}
|
||||
|
||||
@deprecated("use the variant accepting a default scala version")
|
||||
def moduleVersionConfig(s: String): Either[String, (Module, String, Option[String])] =
|
||||
moduleVersionConfig(s, defaultScalaVersion)
|
||||
|
||||
/**
|
||||
* Parses coordinates like
|
||||
* org:name:version
|
||||
|
|
@ -94,18 +127,28 @@ object Parse {
|
|||
* or
|
||||
* org:name;attr1=val1;attr2=val2:version:config
|
||||
*/
|
||||
def moduleVersionConfig(s: String): Either[String, (Module, String, Option[String])] = {
|
||||
def moduleVersionConfig(s: String, defaultScalaVersion: String): Either[String, (Module, String, Option[String])] = {
|
||||
|
||||
val parts = s.split(":", 4)
|
||||
val parts = s.split(":", 5)
|
||||
|
||||
parts match {
|
||||
case Array(org, "", rawName, version, config) =>
|
||||
module(s"$org::$rawName", defaultScalaVersion)
|
||||
.right
|
||||
.map((_, version, Some(config)))
|
||||
|
||||
case Array(org, "", rawName, version) =>
|
||||
module(s"$org::$rawName", defaultScalaVersion)
|
||||
.right
|
||||
.map((_, version, None))
|
||||
|
||||
case Array(org, rawName, version, config) =>
|
||||
module(s"$org:$rawName")
|
||||
module(s"$org:$rawName", defaultScalaVersion)
|
||||
.right
|
||||
.map((_, version, Some(config)))
|
||||
|
||||
case Array(org, rawName, version) =>
|
||||
module(s"$org:$rawName")
|
||||
module(s"$org:$rawName", defaultScalaVersion)
|
||||
.right
|
||||
.map((_, version, None))
|
||||
|
||||
|
|
@ -114,21 +157,29 @@ object Parse {
|
|||
}
|
||||
}
|
||||
|
||||
@deprecated("use the variant accepting a default scala version")
|
||||
def moduleVersions(l: Seq[String]): (Seq[String], Seq[(Module, String)]) =
|
||||
moduleVersions(l, defaultScalaVersion)
|
||||
|
||||
/**
|
||||
* Parses a sequence of coordinates.
|
||||
*
|
||||
* @return Sequence of errors, and sequence of modules / versions
|
||||
*/
|
||||
def moduleVersions(l: Seq[String]): (Seq[String], Seq[(Module, String)]) =
|
||||
valuesAndErrors(moduleVersion, l)
|
||||
def moduleVersions(l: Seq[String], defaultScalaVersion: String): (Seq[String], Seq[(Module, String)]) =
|
||||
valuesAndErrors(moduleVersion(_, defaultScalaVersion), l)
|
||||
|
||||
@deprecated("use the variant accepting a default scala version")
|
||||
def moduleVersionConfigs(l: Seq[String]): (Seq[String], Seq[(Module, String, Option[String])]) =
|
||||
moduleVersionConfigs(l, defaultScalaVersion)
|
||||
|
||||
/**
|
||||
* Parses a sequence of coordinates having an optional configuration.
|
||||
*
|
||||
* @return Sequence of errors, and sequence of modules / versions / optional configurations
|
||||
*/
|
||||
def moduleVersionConfigs(l: Seq[String]): (Seq[String], Seq[(Module, String, Option[String])]) =
|
||||
valuesAndErrors(moduleVersionConfig, l)
|
||||
def moduleVersionConfigs(l: Seq[String], defaultScalaVersion: String): (Seq[String], Seq[(Module, String, Option[String])]) =
|
||||
valuesAndErrors(moduleVersionConfig(_, defaultScalaVersion), l)
|
||||
|
||||
def repository(s: String): String \/ Repository =
|
||||
if (s == "central")
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import scala.collection.JavaConverters._
|
|||
|
||||
import scalaz.concurrent.Task
|
||||
|
||||
case class SimpleHttpServerApp(
|
||||
case class HttpServerApp(
|
||||
@ExtraName("d")
|
||||
@ValueDescription("served directory")
|
||||
directory: String,
|
||||
|
|
@ -219,4 +219,4 @@ case class SimpleHttpServerApp(
|
|||
|
||||
}
|
||||
|
||||
object SimpleHttpServer extends AppOf[SimpleHttpServerApp]
|
||||
object HttpServer extends AppOf[HttpServerApp]
|
||||
Loading…
Reference in New Issue