diff --git a/main/src/main/scala/sbt/internal/CommandExchange.scala b/main/src/main/scala/sbt/internal/CommandExchange.scala index 9cf8f6c62..0902665bb 100644 --- a/main/src/main/scala/sbt/internal/CommandExchange.scala +++ b/main/src/main/scala/sbt/internal/CommandExchange.scala @@ -90,7 +90,7 @@ private[sbt] final class CommandExchange { case Some(x) => // do nothing case _ => val portfile = (new File(".")).getAbsoluteFile / "project" / "target" / "active.json" - val h = Hash.halfHashString(portfile.toURL.toString) + val h = Hash.halfHashString(portfile.toURI.toString) val tokenfile = BuildPaths.getGlobalBase(s) / "server" / h / "token.json" val x = Server.start("127.0.0.1", port, onIncomingSocket, portfile, tokenfile, s.log) Await.ready(x.ready, Duration("10s")) diff --git a/protocol/src/main/contraband-scala/sbt/internal/protocol/PortFile.scala b/protocol/src/main/contraband-scala/sbt/internal/protocol/PortFile.scala index 542ab368f..648ab25b5 100644 --- a/protocol/src/main/contraband-scala/sbt/internal/protocol/PortFile.scala +++ b/protocol/src/main/contraband-scala/sbt/internal/protocol/PortFile.scala @@ -9,27 +9,27 @@ package sbt.internal.protocol * It can be used to find out the transport protocol (port number etc). */ final class PortFile private ( - /** URL of the sbt server. */ - val url: String, + /** URI of the sbt server. */ + val uri: String, val tokenfile: Option[String]) extends Serializable { override def equals(o: Any): Boolean = o match { - case x: PortFile => (this.url == x.url) && (this.tokenfile == x.tokenfile) + case x: PortFile => (this.uri == x.uri) && (this.tokenfile == x.tokenfile) case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "sbt.internal.protocol.PortFile".##) + url.##) + tokenfile.##) + 37 * (37 * (37 * (17 + "sbt.internal.protocol.PortFile".##) + uri.##) + tokenfile.##) } override def toString: String = { - "PortFile(" + url + ", " + tokenfile + ")" + "PortFile(" + uri + ", " + tokenfile + ")" } - protected[this] def copy(url: String = url, tokenfile: Option[String] = tokenfile): PortFile = { - new PortFile(url, tokenfile) + protected[this] def copy(uri: String = uri, tokenfile: Option[String] = tokenfile): PortFile = { + new PortFile(uri, tokenfile) } - def withUrl(url: String): PortFile = { - copy(url = url) + def withUri(uri: String): PortFile = { + copy(uri = uri) } def withTokenfile(tokenfile: Option[String]): PortFile = { copy(tokenfile = tokenfile) @@ -40,6 +40,6 @@ final class PortFile private ( } object PortFile { - def apply(url: String, tokenfile: Option[String]): PortFile = new PortFile(url, tokenfile) - def apply(url: String, tokenfile: String): PortFile = new PortFile(url, Option(tokenfile)) + def apply(uri: String, tokenfile: Option[String]): PortFile = new PortFile(uri, tokenfile) + def apply(uri: String, tokenfile: String): PortFile = new PortFile(uri, Option(tokenfile)) } diff --git a/protocol/src/main/contraband-scala/sbt/internal/protocol/TokenFile.scala b/protocol/src/main/contraband-scala/sbt/internal/protocol/TokenFile.scala index 12f1ac21c..e2019147e 100644 --- a/protocol/src/main/contraband-scala/sbt/internal/protocol/TokenFile.scala +++ b/protocol/src/main/contraband-scala/sbt/internal/protocol/TokenFile.scala @@ -5,26 +5,26 @@ // DO NOT EDIT MANUALLY package sbt.internal.protocol final class TokenFile private ( - val url: String, + val uri: String, val token: String) extends Serializable { override def equals(o: Any): Boolean = o match { - case x: TokenFile => (this.url == x.url) && (this.token == x.token) + case x: TokenFile => (this.uri == x.uri) && (this.token == x.token) case _ => false } override def hashCode: Int = { - 37 * (37 * (37 * (17 + "sbt.internal.protocol.TokenFile".##) + url.##) + token.##) + 37 * (37 * (37 * (17 + "sbt.internal.protocol.TokenFile".##) + uri.##) + token.##) } override def toString: String = { - "TokenFile(" + url + ", " + token + ")" + "TokenFile(" + uri + ", " + token + ")" } - protected[this] def copy(url: String = url, token: String = token): TokenFile = { - new TokenFile(url, token) + protected[this] def copy(uri: String = uri, token: String = token): TokenFile = { + new TokenFile(uri, token) } - def withUrl(url: String): TokenFile = { - copy(url = url) + def withUri(uri: String): TokenFile = { + copy(uri = uri) } def withToken(token: String): TokenFile = { copy(token = token) @@ -32,5 +32,5 @@ final class TokenFile private ( } object TokenFile { - def apply(url: String, token: String): TokenFile = new TokenFile(url, token) + def apply(uri: String, token: String): TokenFile = new TokenFile(uri, token) } diff --git a/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/PortFileFormats.scala b/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/PortFileFormats.scala index daac10706..8bed2e6f9 100644 --- a/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/PortFileFormats.scala +++ b/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/PortFileFormats.scala @@ -11,17 +11,17 @@ implicit lazy val PortFileFormat: JsonFormat[sbt.internal.protocol.PortFile] = n jsOpt match { case Some(js) => unbuilder.beginObject(js) - val url = unbuilder.readField[String]("url") + val uri = unbuilder.readField[String]("uri") val tokenfile = unbuilder.readField[Option[String]]("tokenfile") unbuilder.endObject() - sbt.internal.protocol.PortFile(url, tokenfile) + sbt.internal.protocol.PortFile(uri, tokenfile) case None => deserializationError("Expected JsObject but found None") } } override def write[J](obj: sbt.internal.protocol.PortFile, builder: Builder[J]): Unit = { builder.beginObject() - builder.addField("url", obj.url) + builder.addField("uri", obj.uri) builder.addField("tokenfile", obj.tokenfile) builder.endObject() } diff --git a/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/TokenFileFormats.scala b/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/TokenFileFormats.scala index d812593b2..74a15423f 100644 --- a/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/TokenFileFormats.scala +++ b/protocol/src/main/contraband-scala/sbt/internal/protocol/codec/TokenFileFormats.scala @@ -11,17 +11,17 @@ implicit lazy val TokenFileFormat: JsonFormat[sbt.internal.protocol.TokenFile] = jsOpt match { case Some(js) => unbuilder.beginObject(js) - val url = unbuilder.readField[String]("url") + val uri = unbuilder.readField[String]("uri") val token = unbuilder.readField[String]("token") unbuilder.endObject() - sbt.internal.protocol.TokenFile(url, token) + sbt.internal.protocol.TokenFile(uri, token) case None => deserializationError("Expected JsObject but found None") } } override def write[J](obj: sbt.internal.protocol.TokenFile, builder: Builder[J]): Unit = { builder.beginObject() - builder.addField("url", obj.url) + builder.addField("uri", obj.uri) builder.addField("token", obj.token) builder.endObject() } diff --git a/protocol/src/main/contraband/portfile.contra b/protocol/src/main/contraband/portfile.contra index f10d9c170..ccd3ec157 100644 --- a/protocol/src/main/contraband/portfile.contra +++ b/protocol/src/main/contraband/portfile.contra @@ -5,12 +5,12 @@ package sbt.internal.protocol ## This file should exist throughout the lifetime of the server. ## It can be used to find out the transport protocol (port number etc). type PortFile { - ## URL of the sbt server. - url: String! + ## URI of the sbt server. + uri: String! tokenfile: String } type TokenFile { - url: String! + uri: String! token: String! } diff --git a/sbt/src/sbt-test/server/handshake/Client.scala b/sbt/src/sbt-test/server/handshake/Client.scala index 54b7097f3..4be0d8aad 100644 --- a/sbt/src/sbt-test/server/handshake/Client.scala +++ b/sbt/src/sbt-test/server/handshake/Client.scala @@ -30,14 +30,14 @@ object Client extends App { val json: JValue = Parser.parseFromFile(portfile).get json match { case JObject(fields) => - (fields find { _.field == "url" } map { _.value }) match { + (fields find { _.field == "uri" } map { _.value }) match { case Some(JString(value)) => val u = new URI(value) u.getPort case _ => - sys.error("json doesn't url field that is JString") + sys.error("json doesn't uri field that is JString") } - case _ => sys.error("json doesn't have url field") + case _ => sys.error("json doesn't have uri field") } }