mirror of https://github.com/sbt/sbt.git
Merge pull request #447 from eed3si9n/wip/revert
[2.x] Revert URI change
This commit is contained in:
commit
ddf3f5ef99
|
|
@ -10,13 +10,13 @@ final class Artifact private (
|
|||
val extension: String,
|
||||
val classifier: Option[String],
|
||||
val configurations: Vector[sbt.librarymanagement.ConfigRef],
|
||||
val url: Option[java.net.URI],
|
||||
val url: Option[java.net.URL],
|
||||
val extraAttributes: Map[String, String],
|
||||
val checksum: Option[sbt.librarymanagement.Checksum],
|
||||
val allowInsecureProtocol: Boolean) extends sbt.librarymanagement.ArtifactExtra with Serializable {
|
||||
private[sbt] def validateProtocol(logger: sbt.util.Logger): Boolean = Resolver.validateArtifact(this, logger)
|
||||
private def this(name: String) = this(name, Artifact.DefaultType, Artifact.DefaultExtension, None, Vector.empty, None, Map.empty, None, false)
|
||||
private def this(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[sbt.librarymanagement.ConfigRef], url: Option[java.net.URI], extraAttributes: Map[String, String], checksum: Option[sbt.librarymanagement.Checksum]) = this(name, `type`, extension, classifier, configurations, url, extraAttributes, checksum, false)
|
||||
private def this(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[sbt.librarymanagement.ConfigRef], url: Option[java.net.URL], extraAttributes: Map[String, String], checksum: Option[sbt.librarymanagement.Checksum]) = this(name, `type`, extension, classifier, configurations, url, extraAttributes, checksum, false)
|
||||
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: Artifact => (this.name == x.name) && (this.`type` == x.`type`) && (this.extension == x.extension) && (this.classifier == x.classifier) && (this.configurations == x.configurations) && (this.url == x.url) && (this.extraAttributes == x.extraAttributes) && (this.checksum == x.checksum) && (this.allowInsecureProtocol == x.allowInsecureProtocol)
|
||||
|
|
@ -28,7 +28,7 @@ final class Artifact private (
|
|||
override def toString: String = {
|
||||
"Artifact(" + name + ", " + `type` + ", " + extension + ", " + classifier + ", " + configurations + ", " + url + ", " + extraAttributes + ", " + checksum + ", " + allowInsecureProtocol + ")"
|
||||
}
|
||||
private[this] def copy(name: String = name, `type`: String = `type`, extension: String = extension, classifier: Option[String] = classifier, configurations: Vector[sbt.librarymanagement.ConfigRef] = configurations, url: Option[java.net.URI] = url, extraAttributes: Map[String, String] = extraAttributes, checksum: Option[sbt.librarymanagement.Checksum] = checksum, allowInsecureProtocol: Boolean = allowInsecureProtocol): Artifact = {
|
||||
private[this] def copy(name: String = name, `type`: String = `type`, extension: String = extension, classifier: Option[String] = classifier, configurations: Vector[sbt.librarymanagement.ConfigRef] = configurations, url: Option[java.net.URL] = url, extraAttributes: Map[String, String] = extraAttributes, checksum: Option[sbt.librarymanagement.Checksum] = checksum, allowInsecureProtocol: Boolean = allowInsecureProtocol): Artifact = {
|
||||
new Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes, checksum, allowInsecureProtocol)
|
||||
}
|
||||
def withName(name: String): Artifact = {
|
||||
|
|
@ -46,7 +46,7 @@ final class Artifact private (
|
|||
def withConfigurations(configurations: Vector[sbt.librarymanagement.ConfigRef]): Artifact = {
|
||||
copy(configurations = configurations)
|
||||
}
|
||||
def withUrl(url: Option[java.net.URI]): Artifact = {
|
||||
def withUrl(url: Option[java.net.URL]): Artifact = {
|
||||
copy(url = url)
|
||||
}
|
||||
def withExtraAttributes(extraAttributes: Map[String, String]): Artifact = {
|
||||
|
|
@ -62,6 +62,6 @@ final class Artifact private (
|
|||
object Artifact extends sbt.librarymanagement.ArtifactFunctions {
|
||||
|
||||
def apply(name: String): Artifact = new Artifact(name)
|
||||
def apply(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[sbt.librarymanagement.ConfigRef], url: Option[java.net.URI], extraAttributes: Map[String, String], checksum: Option[sbt.librarymanagement.Checksum]): Artifact = new Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes, checksum)
|
||||
def apply(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[sbt.librarymanagement.ConfigRef], url: Option[java.net.URI], extraAttributes: Map[String, String], checksum: Option[sbt.librarymanagement.Checksum], allowInsecureProtocol: Boolean): Artifact = new Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes, checksum, allowInsecureProtocol)
|
||||
def apply(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[sbt.librarymanagement.ConfigRef], url: Option[java.net.URL], extraAttributes: Map[String, String], checksum: Option[sbt.librarymanagement.Checksum]): Artifact = new Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes, checksum)
|
||||
def apply(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[sbt.librarymanagement.ConfigRef], url: Option[java.net.URL], extraAttributes: Map[String, String], checksum: Option[sbt.librarymanagement.Checksum], allowInsecureProtocol: Boolean): Artifact = new Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes, checksum, allowInsecureProtocol)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ implicit lazy val ArtifactFormat: JsonFormat[sbt.librarymanagement.Artifact] = n
|
|||
val extension = unbuilder.readField[String]("extension")
|
||||
val classifier = unbuilder.readField[Option[String]]("classifier")
|
||||
val configurations = unbuilder.readField[Vector[sbt.librarymanagement.ConfigRef]]("configurations")
|
||||
val url = unbuilder.readField[Option[java.net.URI]]("url")
|
||||
val url = unbuilder.readField[Option[java.net.URL]]("url")
|
||||
val extraAttributes = unbuilder.readField[Map[String, String]]("extraAttributes")
|
||||
val checksum = unbuilder.readField[Option[sbt.librarymanagement.Checksum]]("checksum")
|
||||
val allowInsecureProtocol = unbuilder.readField[Boolean]("allowInsecureProtocol")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ final class Developer private (
|
|||
val id: String,
|
||||
val name: String,
|
||||
val email: String,
|
||||
val url: java.net.URI) extends Serializable {
|
||||
val url: java.net.URL) extends Serializable {
|
||||
|
||||
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ final class Developer private (
|
|||
override def toString: String = {
|
||||
"Developer(" + id + ", " + name + ", " + email + ", " + url + ")"
|
||||
}
|
||||
private[this] def copy(id: String = id, name: String = name, email: String = email, url: java.net.URI = url): Developer = {
|
||||
private[this] def copy(id: String = id, name: String = name, email: String = email, url: java.net.URL = url): Developer = {
|
||||
new Developer(id, name, email, url)
|
||||
}
|
||||
def withId(id: String): Developer = {
|
||||
|
|
@ -34,11 +34,11 @@ final class Developer private (
|
|||
def withEmail(email: String): Developer = {
|
||||
copy(email = email)
|
||||
}
|
||||
def withUrl(url: java.net.URI): Developer = {
|
||||
def withUrl(url: java.net.URL): Developer = {
|
||||
copy(url = url)
|
||||
}
|
||||
}
|
||||
object Developer {
|
||||
|
||||
def apply(id: String, name: String, email: String, url: java.net.URI): Developer = new Developer(id, name, email, url)
|
||||
def apply(id: String, name: String, email: String, url: java.net.URL): Developer = new Developer(id, name, email, url)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ implicit lazy val DeveloperFormat: JsonFormat[sbt.librarymanagement.Developer] =
|
|||
val id = unbuilder.readField[String]("id")
|
||||
val name = unbuilder.readField[String]("name")
|
||||
val email = unbuilder.readField[String]("email")
|
||||
val url = unbuilder.readField[java.net.URI]("url")
|
||||
val url = unbuilder.readField[java.net.URL]("url")
|
||||
unbuilder.endObject()
|
||||
sbt.librarymanagement.Developer(id, name, email, url)
|
||||
case None =>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ package sbt.librarymanagement
|
|||
final class ModuleInfo private (
|
||||
val nameFormal: String,
|
||||
val description: String,
|
||||
val homepage: Option[java.net.URI],
|
||||
val homepage: Option[java.net.URL],
|
||||
val startYear: Option[Int],
|
||||
val licenses: Vector[scala.Tuple2[String, java.net.URI]],
|
||||
val licenses: Vector[scala.Tuple2[String, java.net.URL]],
|
||||
val organizationName: String,
|
||||
val organizationHomepage: Option[java.net.URI],
|
||||
val organizationHomepage: Option[java.net.URL],
|
||||
val scmInfo: Option[sbt.librarymanagement.ScmInfo],
|
||||
val developers: Vector[sbt.librarymanagement.Developer]) extends Serializable {
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ final class ModuleInfo private (
|
|||
override def toString: String = {
|
||||
"ModuleInfo(" + nameFormal + ", " + description + ", " + homepage + ", " + startYear + ", " + licenses + ", " + organizationName + ", " + organizationHomepage + ", " + scmInfo + ", " + developers + ")"
|
||||
}
|
||||
private[this] def copy(nameFormal: String = nameFormal, description: String = description, homepage: Option[java.net.URI] = homepage, startYear: Option[Int] = startYear, licenses: Vector[scala.Tuple2[String, java.net.URI]] = licenses, organizationName: String = organizationName, organizationHomepage: Option[java.net.URI] = organizationHomepage, scmInfo: Option[sbt.librarymanagement.ScmInfo] = scmInfo, developers: Vector[sbt.librarymanagement.Developer] = developers): ModuleInfo = {
|
||||
private[this] def copy(nameFormal: String = nameFormal, description: String = description, homepage: Option[java.net.URL] = homepage, startYear: Option[Int] = startYear, licenses: Vector[scala.Tuple2[String, java.net.URL]] = licenses, organizationName: String = organizationName, organizationHomepage: Option[java.net.URL] = organizationHomepage, scmInfo: Option[sbt.librarymanagement.ScmInfo] = scmInfo, developers: Vector[sbt.librarymanagement.Developer] = developers): ModuleInfo = {
|
||||
new ModuleInfo(nameFormal, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers)
|
||||
}
|
||||
def withNameFormal(nameFormal: String): ModuleInfo = {
|
||||
|
|
@ -37,19 +37,19 @@ final class ModuleInfo private (
|
|||
def withDescription(description: String): ModuleInfo = {
|
||||
copy(description = description)
|
||||
}
|
||||
def withHomepage(homepage: Option[java.net.URI]): ModuleInfo = {
|
||||
def withHomepage(homepage: Option[java.net.URL]): ModuleInfo = {
|
||||
copy(homepage = homepage)
|
||||
}
|
||||
def withStartYear(startYear: Option[Int]): ModuleInfo = {
|
||||
copy(startYear = startYear)
|
||||
}
|
||||
def withLicenses(licenses: Vector[scala.Tuple2[String, java.net.URI]]): ModuleInfo = {
|
||||
def withLicenses(licenses: Vector[scala.Tuple2[String, java.net.URL]]): ModuleInfo = {
|
||||
copy(licenses = licenses)
|
||||
}
|
||||
def withOrganizationName(organizationName: String): ModuleInfo = {
|
||||
copy(organizationName = organizationName)
|
||||
}
|
||||
def withOrganizationHomepage(organizationHomepage: Option[java.net.URI]): ModuleInfo = {
|
||||
def withOrganizationHomepage(organizationHomepage: Option[java.net.URL]): ModuleInfo = {
|
||||
copy(organizationHomepage = organizationHomepage)
|
||||
}
|
||||
def withScmInfo(scmInfo: Option[sbt.librarymanagement.ScmInfo]): ModuleInfo = {
|
||||
|
|
@ -62,5 +62,5 @@ final class ModuleInfo private (
|
|||
object ModuleInfo {
|
||||
|
||||
def apply(nameFormal: String): ModuleInfo = new ModuleInfo(nameFormal)
|
||||
def apply(nameFormal: String, description: String, homepage: Option[java.net.URI], startYear: Option[Int], licenses: Vector[scala.Tuple2[String, java.net.URI]], organizationName: String, organizationHomepage: Option[java.net.URI], scmInfo: Option[sbt.librarymanagement.ScmInfo], developers: Vector[sbt.librarymanagement.Developer]): ModuleInfo = new ModuleInfo(nameFormal, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers)
|
||||
def apply(nameFormal: String, description: String, homepage: Option[java.net.URL], startYear: Option[Int], licenses: Vector[scala.Tuple2[String, java.net.URL]], organizationName: String, organizationHomepage: Option[java.net.URL], scmInfo: Option[sbt.librarymanagement.ScmInfo], developers: Vector[sbt.librarymanagement.Developer]): ModuleInfo = new ModuleInfo(nameFormal, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ implicit lazy val ModuleInfoFormat: JsonFormat[sbt.librarymanagement.ModuleInfo]
|
|||
unbuilder.beginObject(__js)
|
||||
val nameFormal = unbuilder.readField[String]("nameFormal")
|
||||
val description = unbuilder.readField[String]("description")
|
||||
val homepage = unbuilder.readField[Option[java.net.URI]]("homepage")
|
||||
val homepage = unbuilder.readField[Option[java.net.URL]]("homepage")
|
||||
val startYear = unbuilder.readField[Option[Int]]("startYear")
|
||||
val licenses = unbuilder.readField[Vector[scala.Tuple2[String, java.net.URI]]]("licenses")
|
||||
val licenses = unbuilder.readField[Vector[scala.Tuple2[String, java.net.URL]]]("licenses")
|
||||
val organizationName = unbuilder.readField[String]("organizationName")
|
||||
val organizationHomepage = unbuilder.readField[Option[java.net.URI]]("organizationHomepage")
|
||||
val organizationHomepage = unbuilder.readField[Option[java.net.URL]]("organizationHomepage")
|
||||
val scmInfo = unbuilder.readField[Option[sbt.librarymanagement.ScmInfo]]("scmInfo")
|
||||
val developers = unbuilder.readField[Vector[sbt.librarymanagement.Developer]]("developers")
|
||||
unbuilder.endObject()
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
package sbt.librarymanagement
|
||||
/** Basic SCM information for a project module */
|
||||
final class ScmInfo private (
|
||||
val browseUrl: java.net.URI,
|
||||
val browseUrl: java.net.URL,
|
||||
val connection: String,
|
||||
val devConnection: Option[String]) extends Serializable {
|
||||
|
||||
private def this(browseUrl: java.net.URI, connection: String) = this(browseUrl, connection, None)
|
||||
private def this(browseUrl: java.net.URL, connection: String) = this(browseUrl, connection, None)
|
||||
|
||||
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
|
||||
case x: ScmInfo => (this.browseUrl == x.browseUrl) && (this.connection == x.connection) && (this.devConnection == x.devConnection)
|
||||
|
|
@ -22,10 +22,10 @@ final class ScmInfo private (
|
|||
override def toString: String = {
|
||||
"ScmInfo(" + browseUrl + ", " + connection + ", " + devConnection + ")"
|
||||
}
|
||||
private[this] def copy(browseUrl: java.net.URI = browseUrl, connection: String = connection, devConnection: Option[String] = devConnection): ScmInfo = {
|
||||
private[this] def copy(browseUrl: java.net.URL = browseUrl, connection: String = connection, devConnection: Option[String] = devConnection): ScmInfo = {
|
||||
new ScmInfo(browseUrl, connection, devConnection)
|
||||
}
|
||||
def withBrowseUrl(browseUrl: java.net.URI): ScmInfo = {
|
||||
def withBrowseUrl(browseUrl: java.net.URL): ScmInfo = {
|
||||
copy(browseUrl = browseUrl)
|
||||
}
|
||||
def withConnection(connection: String): ScmInfo = {
|
||||
|
|
@ -40,7 +40,7 @@ final class ScmInfo private (
|
|||
}
|
||||
object ScmInfo {
|
||||
|
||||
def apply(browseUrl: java.net.URI, connection: String): ScmInfo = new ScmInfo(browseUrl, connection)
|
||||
def apply(browseUrl: java.net.URI, connection: String, devConnection: Option[String]): ScmInfo = new ScmInfo(browseUrl, connection, devConnection)
|
||||
def apply(browseUrl: java.net.URI, connection: String, devConnection: String): ScmInfo = new ScmInfo(browseUrl, connection, Option(devConnection))
|
||||
def apply(browseUrl: java.net.URL, connection: String): ScmInfo = new ScmInfo(browseUrl, connection)
|
||||
def apply(browseUrl: java.net.URL, connection: String, devConnection: Option[String]): ScmInfo = new ScmInfo(browseUrl, connection, devConnection)
|
||||
def apply(browseUrl: java.net.URL, connection: String, devConnection: String): ScmInfo = new ScmInfo(browseUrl, connection, Option(devConnection))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ implicit lazy val ScmInfoFormat: JsonFormat[sbt.librarymanagement.ScmInfo] = new
|
|||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val browseUrl = unbuilder.readField[java.net.URI]("browseUrl")
|
||||
val browseUrl = unbuilder.readField[java.net.URL]("browseUrl")
|
||||
val connection = unbuilder.readField[String]("connection")
|
||||
val devConnection = unbuilder.readField[Option[String]]("devConnection")
|
||||
unbuilder.endObject()
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@
|
|||
{ "name": "extension", "type": "String", "default": "Artifact.DefaultExtension", "since": "0.0.1" },
|
||||
{ "name": "classifier", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.ConfigRef*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "url", "type": "Option[java.net.URI]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "url", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
||||
{ "name": "checksum", "type": "Option[sbt.librarymanagement.Checksum]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "allowInsecureProtocol", "type": "Boolean", "default": "false", "since": "1.3.0" }
|
||||
|
|
@ -244,7 +244,7 @@
|
|||
{ "name": "id", "type": "String" },
|
||||
{ "name": "name", "type": "String" },
|
||||
{ "name": "email", "type": "String" },
|
||||
{ "name": "url", "type": "java.net.URI" }
|
||||
{ "name": "url", "type": "java.net.URL" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -365,11 +365,11 @@
|
|||
"fields": [
|
||||
{ "name": "nameFormal", "type": "String" },
|
||||
{ "name": "description", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "Option[java.net.URI]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "startYear", "type": "Option[Int]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, java.net.URI]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, java.net.URL]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "organizationName", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "organizationHomepage", "type": "Option[java.net.URI]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "organizationHomepage", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "scmInfo", "type": "Option[sbt.librarymanagement.ScmInfo]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "developers", "type": "sbt.librarymanagement.Developer*", "default": "Vector.empty", "since": "0.0.1" }
|
||||
]
|
||||
|
|
@ -728,7 +728,7 @@
|
|||
"type": "record",
|
||||
"doc": "Basic SCM information for a project module",
|
||||
"fields": [
|
||||
{ "name": "browseUrl", "type": "java.net.URI" },
|
||||
{ "name": "browseUrl", "type": "java.net.URL" },
|
||||
{ "name": "connection", "type": "String" },
|
||||
{ "name": "devConnection", "type": "String?", "default": "None", "since": "0.0.1" }
|
||||
]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import java.net.URL
|
||||
|
||||
private[librarymanagement] abstract class ArtifactExtra {
|
||||
def extraAttributes: Map[String, String]
|
||||
|
|
@ -26,15 +26,15 @@ private[librarymanagement] abstract class ArtifactFunctions {
|
|||
Artifact(name, `type`, extension, None, Vector.empty, None)
|
||||
def apply(name: String, `type`: String, extension: String, classifier: String): Artifact =
|
||||
Artifact(name, `type`, extension, Some(classifier), Vector.empty, None)
|
||||
def apply(name: String, uri: URI): Artifact = Artifact(name, uri, false)
|
||||
def apply(name: String, uri: URI, allowInsecureProtocol: Boolean): Artifact =
|
||||
def apply(name: String, url: URL): Artifact = Artifact(name, url, false)
|
||||
def apply(name: String, url: URL, allowInsecureProtocol: Boolean): Artifact =
|
||||
Artifact(
|
||||
name,
|
||||
extract(uri, DefaultType),
|
||||
extract(uri, DefaultExtension),
|
||||
extract(url, DefaultType),
|
||||
extract(url, DefaultExtension),
|
||||
None,
|
||||
Vector.empty,
|
||||
Some(uri),
|
||||
Some(url),
|
||||
Map.empty,
|
||||
None,
|
||||
allowInsecureProtocol
|
||||
|
|
@ -47,9 +47,8 @@ private[librarymanagement] abstract class ArtifactFunctions {
|
|||
extension: String,
|
||||
classifier: Option[String],
|
||||
configurations: Vector[ConfigRef],
|
||||
uri: Option[URI]
|
||||
): Artifact =
|
||||
Artifact(name, `type`, extension, classifier, configurations, uri, empty, None)
|
||||
url: Option[URL]
|
||||
): Artifact = Artifact(name, `type`, extension, classifier, configurations, url, empty, None)
|
||||
|
||||
val DefaultExtension = "jar"
|
||||
val DefaultType = "jar"
|
||||
|
|
@ -79,7 +78,7 @@ private[librarymanagement] abstract class ArtifactFunctions {
|
|||
assert(DefaultDocTypes contains DocType)
|
||||
assert(DefaultSourceTypes contains SourceType)
|
||||
|
||||
def extract(uri: URI, default: String): String = extract(uri.toString, default)
|
||||
def extract(url: URL, default: String): String = extract(url.toString, default)
|
||||
def extract(name: String, default: String): String = {
|
||||
val i = name.lastIndexOf('.')
|
||||
if (i >= 0)
|
||||
|
|
@ -97,7 +96,7 @@ private[librarymanagement] abstract class ArtifactFunctions {
|
|||
extract(name, DefaultExtension),
|
||||
None,
|
||||
Vector.empty,
|
||||
Some(file.toURI)
|
||||
Some(file.toURI.toURL)
|
||||
)
|
||||
}
|
||||
def artifactName(scalaVersion: ScalaVersion, module: ModuleID, artifact: Artifact): String = {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ private[librarymanagement] abstract class ModuleIDExtra {
|
|||
* It is not included in published metadata.
|
||||
*/
|
||||
def from(url: String, allowInsecureProtocol: Boolean): ModuleID =
|
||||
artifacts(Artifact(name, new URI(url), allowInsecureProtocol))
|
||||
artifacts(Artifact(name, new URI(url).toURL, allowInsecureProtocol))
|
||||
|
||||
/** Adds a dependency on the artifact for this module with classifier `c`. */
|
||||
def classifier(c: String): ModuleID = artifacts(Artifact(name, c))
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ object IfMissing {
|
|||
object ComponentManager {
|
||||
lazy val (version, timestamp) = {
|
||||
val properties = new java.util.Properties
|
||||
val propertiesStream = getClass.getResourceAsStream("/xsbt.version.properties")
|
||||
val propertiesStream = versionResource.openStream
|
||||
try {
|
||||
properties.load(propertiesStream)
|
||||
} finally {
|
||||
|
|
@ -110,4 +110,7 @@ object ComponentManager {
|
|||
(properties.getProperty("version"), properties.getProperty("timestamp"))
|
||||
}
|
||||
lazy val stampedVersion = version + "_" + timestamp
|
||||
|
||||
import java.net.URL
|
||||
private def versionResource: URL = getClass.getResource("/xsbt.version.properties")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,17 +394,17 @@ private[sbt] object ConvertResolver {
|
|||
private[this] val repo = new WarnOnOverwriteFileRepo()
|
||||
private[this] val progress = new RepositoryCopyProgressListener(this);
|
||||
override def getResource(source: String) = {
|
||||
val uri = new URI(source)
|
||||
if (uri.getScheme == IO.FileScheme)
|
||||
new FileResource(repo, IO.toFile(uri))
|
||||
val url = new URI(source).toURL
|
||||
if (url.getProtocol == IO.FileScheme)
|
||||
new FileResource(repo, IO.toFile(url))
|
||||
else
|
||||
super.getResource(source)
|
||||
}
|
||||
|
||||
override def put(source: File, destination: String, overwrite: Boolean): Unit = {
|
||||
val uri = new URI(destination)
|
||||
val url = new URI(destination).toURL
|
||||
try {
|
||||
if (uri.getScheme != IO.FileScheme) super.put(source, destination, overwrite)
|
||||
if (url.getProtocol != IO.FileScheme) super.put(source, destination, overwrite)
|
||||
else {
|
||||
// Here we duplicate the put method for files so we don't just bail on trying ot use Http handler
|
||||
val resource = getResource(destination)
|
||||
|
|
@ -417,7 +417,7 @@ private[sbt] object ConvertResolver {
|
|||
if (totalLength > 0) {
|
||||
progress.setTotalLength(totalLength);
|
||||
}
|
||||
FileUtil.copy(source, new java.io.File(uri), progress, overwrite)
|
||||
FileUtil.copy(source, new java.io.File(url.toURI), progress, overwrite)
|
||||
()
|
||||
} catch {
|
||||
case ex: IOException =>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ private[sbt] class FakeResolver(private var name: String, cacheDir: File, module
|
|||
): ArtifactDownloadReport = {
|
||||
|
||||
val report = new ArtifactDownloadReport(artifact.getArtifact)
|
||||
val path = new URI(artifact.getLocation).getPath
|
||||
val path = new URI(artifact.getLocation).toURL.toURI.getPath
|
||||
val localFile = new File(path)
|
||||
|
||||
if (path.nonEmpty && localFile.exists) {
|
||||
|
|
|
|||
|
|
@ -1000,7 +1000,7 @@ private[sbt] object IvySbt {
|
|||
name,
|
||||
`type`,
|
||||
extension,
|
||||
url.map(_.toURL).orNull,
|
||||
url.orNull,
|
||||
extraMap
|
||||
)
|
||||
copyConfigurations(artifact, (ref: ConfigRef) => { ivyArtifact.addConfiguration(ref.name) })
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ object IvyRetrieve {
|
|||
getConfigurations.toVector map { (c: String) =>
|
||||
ConfigRef(c)
|
||||
},
|
||||
Option(getUrl).map(_.toURI)
|
||||
Option(getUrl)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ object DMSerializationSpec extends BasicTestSuite {
|
|||
}
|
||||
|
||||
test("""Artifact("foo", url("http://example.com/")) should roundtrip""") {
|
||||
roundtrip(Artifact("foo", new URI("http://example.com/")))
|
||||
roundtrip(Artifact("foo", new URI("http://example.com/").toURL))
|
||||
}
|
||||
|
||||
test("""Artifact("foo").extra(("key", "value")) should roundtrip""") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue