Merge branch '1.1.x' into merge-1.1.x-into-1.x

* 1.1.x:
  Update mimaPreviousArtifacts/sbt.version
  Introduce SBT_GLOBAL_SERVER_DIR env var to override too long paths
  Handle very long socket file paths on UNIX

Conflicts:
	project/build.properties
This commit is contained in:
Dale Wijnand 2018-02-14 14:38:07 +00:00
commit 76e2f550ec
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
4 changed files with 18 additions and 6 deletions

View File

@ -77,7 +77,10 @@ def testedBaseSettings: Seq[Setting[_]] =
val mimaSettings = Def settings (
mimaPreviousArtifacts := {
((0 to 4).map(v => s"1.0.$v") ++ (0 to 0).map(v => s"1.1.$v")).map{ v =>
Seq(
"1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4",
"1.1.0", "1.1.1",
).map { v =>
organization.value % moduleName.value % v cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled)
}.toSet
}

View File

@ -60,9 +60,16 @@ private[sbt] object Server {
// Named pipe already has an exclusive lock.
addServerError(new Win32NamedPipeServerSocket(pipeName))
case ConnectionType.Local =>
tryClient(new UnixDomainSocket(socketfile.getAbsolutePath))
val maxSocketLength = new UnixDomainSocketLibrary.SockaddrUn().sunPath.length - 1
val path = socketfile.getAbsolutePath
if (path.length > maxSocketLength)
sys.error("socket file absolute path too long; " +
"either switch to another connection type " +
"or define a short \"SBT_GLOBAL_SERVER_DIR\" value. " +
s"Current path: ${path}")
tryClient(new UnixDomainSocket(path))
prepareSocketfile()
addServerError(new UnixDomainServerSocket(socketfile.getAbsolutePath))
addServerError(new UnixDomainServerSocket(path))
case ConnectionType.Tcp =>
tryClient(new Socket(InetAddress.getByName(host), port))
addServerError(new ServerSocket(port, 50, InetAddress.getByName(host)))

View File

@ -120,8 +120,10 @@ private[sbt] final class CommandExchange {
if (server.isEmpty && firstInstance.get) {
val portfile = s.baseDir / "project" / "target" / "active.json"
val h = Hash.halfHashString(IO.toURI(portfile).toString)
val tokenfile = BuildPaths.getGlobalBase(s) / "server" / h / "token.json"
val socketfile = BuildPaths.getGlobalBase(s) / "server" / h / "sock"
val serverDir =
sys.env get "SBT_GLOBAL_SERVER_DIR" map file getOrElse BuildPaths.getGlobalBase(s) / "server"
val tokenfile = serverDir / h / "token.json"
val socketfile = serverDir / h / "sock"
val pipeName = "sbt-server-" + h
val connection = ServerConnection(
connectionType,

View File

@ -1 +1 @@
sbt.version=1.1.0
sbt.version=1.1.1