mirror of https://github.com/sbt/sbt.git
Merge branch '1.1.x' into wip-disable-fork-parallel
This commit is contained in:
commit
c3c487c8ab
|
|
@ -0,0 +1,23 @@
|
||||||
|
build: off
|
||||||
|
|
||||||
|
init:
|
||||||
|
- git config --global core.autocrlf input
|
||||||
|
|
||||||
|
install:
|
||||||
|
- cinst jdk8 -params 'installdir=C:\\jdk8'
|
||||||
|
- SET JAVA_HOME=C:\jdk8
|
||||||
|
- SET PATH=C:\jdk8\bin;%PATH%
|
||||||
|
|
||||||
|
- ps: |
|
||||||
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
if (!(Test-Path -Path "C:\sbt" )) {
|
||||||
|
(new-object System.Net.WebClient).DownloadFile(
|
||||||
|
'https://github.com/sbt/sbt/releases/download/v1.0.4/sbt-1.0.4.zip',
|
||||||
|
'C:\sbt-bin.zip'
|
||||||
|
)
|
||||||
|
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\sbt-bin.zip", "C:\sbt")
|
||||||
|
}
|
||||||
|
- SET PATH=C:\sbt\sbt\bin;%PATH%
|
||||||
|
- SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8
|
||||||
|
test_script:
|
||||||
|
- sbt "scripted actions/* server/*"
|
||||||
|
|
@ -34,6 +34,7 @@ def buildLevelSettings: Seq[Setting[_]] =
|
||||||
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt"), "git@github.com:sbt/sbt.git")),
|
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt"), "git@github.com:sbt/sbt.git")),
|
||||||
resolvers += Resolver.mavenLocal,
|
resolvers += Resolver.mavenLocal,
|
||||||
scalafmtOnCompile := true,
|
scalafmtOnCompile := true,
|
||||||
|
scalafmtOnCompile in Sbt := false,
|
||||||
scalafmtVersion := "1.3.0",
|
scalafmtVersion := "1.3.0",
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
@ -310,8 +311,7 @@ lazy val commandProj = (project in file("main-command"))
|
||||||
.settings(
|
.settings(
|
||||||
testedBaseSettings,
|
testedBaseSettings,
|
||||||
name := "Command",
|
name := "Command",
|
||||||
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi,
|
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi),
|
||||||
jna, jnaPlatform),
|
|
||||||
managedSourceDirectories in Compile +=
|
managedSourceDirectories in Compile +=
|
||||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||||
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||||
|
|
@ -463,10 +463,9 @@ lazy val sbtIgnoredProblems = {
|
||||||
}
|
}
|
||||||
|
|
||||||
def runNpm(command: String, base: File, log: sbt.internal.util.ManagedLogger) = {
|
def runNpm(command: String, base: File, log: sbt.internal.util.ManagedLogger) = {
|
||||||
val npm = if (sbt.internal.util.Util.isWindows) "npm.cmd" else "npm"
|
|
||||||
import scala.sys.process._
|
import scala.sys.process._
|
||||||
try {
|
try {
|
||||||
val exitCode = Process(s"$npm $command", Option(base)) ! log
|
val exitCode = Process(s"npm $command", Option(base)) ! log
|
||||||
if (exitCode != 0) throw new Exception("Process returned exit code: " + exitCode)
|
if (exitCode != 0) throw new Exception("Process returned exit code: " + exitCode)
|
||||||
} catch {
|
} catch {
|
||||||
case e: java.io.IOException => log.warn("failed to run npm " + e.getMessage)
|
case e: java.io.IOException => log.warn("failed to run npm " + e.getMessage)
|
||||||
|
|
|
||||||
|
|
@ -485,12 +485,10 @@ private[sbt] object Eval {
|
||||||
def filesModifiedBytes(fs: Array[File]): Array[Byte] =
|
def filesModifiedBytes(fs: Array[File]): Array[Byte] =
|
||||||
if (fs eq null) filesModifiedBytes(Array[File]()) else seqBytes(fs)(fileModifiedBytes)
|
if (fs eq null) filesModifiedBytes(Array[File]()) else seqBytes(fs)(fileModifiedBytes)
|
||||||
def fileModifiedBytes(f: File): Array[Byte] =
|
def fileModifiedBytes(f: File): Array[Byte] =
|
||||||
(if (f.isDirectory) filesModifiedBytes(f listFiles classDirFilter)
|
(if (f.isDirectory)
|
||||||
|
filesModifiedBytes(f listFiles classDirFilter)
|
||||||
else
|
else
|
||||||
bytes(
|
bytes(IO.getModifiedTimeOrZero(f))) ++ bytes(f.getAbsolutePath)
|
||||||
try IO.getModifiedTime(f)
|
|
||||||
catch { case _: java.io.FileNotFoundException => 0L })) ++
|
|
||||||
bytes(f.getAbsolutePath)
|
|
||||||
def fileExistsBytes(f: File): Array[Byte] =
|
def fileExistsBytes(f: File): Array[Byte] =
|
||||||
bytes(f.exists) ++
|
bytes(f.exists) ++
|
||||||
bytes(f.getAbsolutePath)
|
bytes(f.getAbsolutePath)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import com.sun.jna.ptr.IntByReference;
|
||||||
|
|
||||||
import com.sun.jna.win32.W32APIOptions;
|
import com.sun.jna.win32.W32APIOptions;
|
||||||
|
|
||||||
public interface NGWin32NamedPipeLibrary extends WinNT {
|
public interface NGWin32NamedPipeLibrary extends Library, WinNT {
|
||||||
int PIPE_ACCESS_DUPLEX = 3;
|
int PIPE_ACCESS_DUPLEX = 3;
|
||||||
int PIPE_UNLIMITED_INSTANCES = 255;
|
int PIPE_UNLIMITED_INSTANCES = 255;
|
||||||
int FILE_FLAG_FIRST_PIPE_INSTANCE = 524288;
|
int FILE_FLAG_FIRST_PIPE_INSTANCE = 524288;
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ private[sbt] object Server {
|
||||||
case Failure(e) => ()
|
case Failure(e) => ()
|
||||||
case Success(socket) =>
|
case Success(socket) =>
|
||||||
socket.close()
|
socket.close()
|
||||||
throw new IOException("sbt server is already running.")
|
throw new AlreadyRunningException()
|
||||||
}
|
}
|
||||||
} else ()
|
} else ()
|
||||||
}
|
}
|
||||||
|
|
@ -210,3 +210,5 @@ private[sbt] case class ServerConnection(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private[sbt] class AlreadyRunningException extends IOException("sbt server is already running.")
|
||||||
|
|
|
||||||
|
|
@ -2315,7 +2315,7 @@ object Classpaths {
|
||||||
case Some(period) =>
|
case Some(period) =>
|
||||||
val fullUpdateOutput = cacheDirectory / "out"
|
val fullUpdateOutput = cacheDirectory / "out"
|
||||||
val now = System.currentTimeMillis
|
val now = System.currentTimeMillis
|
||||||
val diff = now - IO.getModifiedTime(fullUpdateOutput)
|
val diff = now - IO.getModifiedTimeOrZero(fullUpdateOutput)
|
||||||
val elapsedDuration = new FiniteDuration(diff, TimeUnit.MILLISECONDS)
|
val elapsedDuration = new FiniteDuration(diff, TimeUnit.MILLISECONDS)
|
||||||
fullUpdateOutput.exists() && elapsedDuration > period
|
fullUpdateOutput.exists() && elapsedDuration > period
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,9 @@ object StandardMain {
|
||||||
def initialState(configuration: xsbti.AppConfiguration,
|
def initialState(configuration: xsbti.AppConfiguration,
|
||||||
initialDefinitions: Seq[Command],
|
initialDefinitions: Seq[Command],
|
||||||
preCommands: Seq[String]): State = {
|
preCommands: Seq[String]): State = {
|
||||||
|
// This is to workaround https://github.com/sbt/io/issues/110
|
||||||
|
sys.props.put("jna.nosys", "true")
|
||||||
|
|
||||||
import BasicCommandStrings.isEarlyCommand
|
import BasicCommandStrings.isEarlyCommand
|
||||||
val userCommands = configuration.arguments.map(_.trim)
|
val userCommands = configuration.arguments.map(_.trim)
|
||||||
val (earlyCommands, normalCommands) = (preCommands ++ userCommands).partition(isEarlyCommand)
|
val (earlyCommands, normalCommands) = (preCommands ++ userCommands).partition(isEarlyCommand)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ package internal
|
||||||
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue
|
import java.util.concurrent.ConcurrentLinkedQueue
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic._
|
||||||
import scala.collection.mutable.ListBuffer
|
import scala.collection.mutable.ListBuffer
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
import BasicKeys.{
|
import BasicKeys.{
|
||||||
|
|
@ -26,7 +26,7 @@ import sjsonnew.JsonFormat
|
||||||
import sjsonnew.shaded.scalajson.ast.unsafe._
|
import sjsonnew.shaded.scalajson.ast.unsafe._
|
||||||
import scala.concurrent.Await
|
import scala.concurrent.Await
|
||||||
import scala.concurrent.duration.Duration
|
import scala.concurrent.duration.Duration
|
||||||
import scala.util.{ Success, Failure }
|
import scala.util.{ Success, Failure, Try }
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
import sbt.io.{ Hash, IO }
|
import sbt.io.{ Hash, IO }
|
||||||
import sbt.internal.server._
|
import sbt.internal.server._
|
||||||
|
|
@ -48,6 +48,7 @@ private[sbt] final class CommandExchange {
|
||||||
} getOrElse true
|
} getOrElse true
|
||||||
private val lock = new AnyRef {}
|
private val lock = new AnyRef {}
|
||||||
private var server: Option[ServerInstance] = None
|
private var server: Option[ServerInstance] = None
|
||||||
|
private val firstInstance: AtomicBoolean = new AtomicBoolean(true)
|
||||||
private var consoleChannel: Option[ConsoleChannel] = None
|
private var consoleChannel: Option[ConsoleChannel] = None
|
||||||
private val commandQueue: ConcurrentLinkedQueue[Exec] = new ConcurrentLinkedQueue()
|
private val commandQueue: ConcurrentLinkedQueue[Exec] = new ConcurrentLinkedQueue()
|
||||||
private val channelBuffer: ListBuffer[CommandChannel] = new ListBuffer()
|
private val channelBuffer: ListBuffer[CommandChannel] = new ListBuffer()
|
||||||
|
|
@ -90,7 +91,6 @@ private[sbt] final class CommandExchange {
|
||||||
else s
|
else s
|
||||||
}
|
}
|
||||||
|
|
||||||
private def newChannelName: String = s"channel-${nextChannelId.incrementAndGet()}"
|
|
||||||
private def newNetworkName: String = s"network-${nextChannelId.incrementAndGet()}"
|
private def newNetworkName: String = s"network-${nextChannelId.incrementAndGet()}"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -132,7 +132,8 @@ private[sbt] final class CommandExchange {
|
||||||
subscribe(channel)
|
subscribe(channel)
|
||||||
}
|
}
|
||||||
server match {
|
server match {
|
||||||
case Some(_) => // do nothing
|
case Some(_) => // do nothing
|
||||||
|
case None if !firstInstance.get => // there's another server
|
||||||
case _ =>
|
case _ =>
|
||||||
val portfile = (new File(".")).getAbsoluteFile / "project" / "target" / "active.json"
|
val portfile = (new File(".")).getAbsoluteFile / "project" / "target" / "active.json"
|
||||||
val h = Hash.halfHashString(IO.toURI(portfile).toString)
|
val h = Hash.halfHashString(IO.toURI(portfile).toString)
|
||||||
|
|
@ -149,15 +150,27 @@ private[sbt] final class CommandExchange {
|
||||||
socketfile,
|
socketfile,
|
||||||
pipeName)
|
pipeName)
|
||||||
val x = Server.start(connection, onIncomingSocket, s.log)
|
val x = Server.start(connection, onIncomingSocket, s.log)
|
||||||
Await.ready(x.ready, Duration("10s"))
|
|
||||||
|
// don't throw exception when it times out
|
||||||
|
val d = "10s"
|
||||||
|
Try(Await.ready(x.ready, Duration(d)))
|
||||||
x.ready.value match {
|
x.ready.value match {
|
||||||
case Some(Success(_)) =>
|
case Some(Success(_)) =>
|
||||||
// rememeber to shutdown only when the server comes up
|
// rememeber to shutdown only when the server comes up
|
||||||
server = Some(x)
|
server = Some(x)
|
||||||
|
case Some(Failure(e: AlreadyRunningException)) =>
|
||||||
|
s.log.warn(
|
||||||
|
"sbt server could not start because there's another instance of sbt running on this build.")
|
||||||
|
s.log.warn("Running multiple instances is unsupported")
|
||||||
|
server = None
|
||||||
|
firstInstance.set(false)
|
||||||
case Some(Failure(e)) =>
|
case Some(Failure(e)) =>
|
||||||
s.log.error(e.toString)
|
s.log.error(e.toString)
|
||||||
server = None
|
server = None
|
||||||
case None => // this won't happen because we awaited
|
case None =>
|
||||||
|
s.log.warn(s"sbt server could not start in $d")
|
||||||
|
server = None
|
||||||
|
firstInstance.set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s
|
s
|
||||||
|
|
@ -191,6 +204,7 @@ private[sbt] final class CommandExchange {
|
||||||
case xs =>
|
case xs =>
|
||||||
lock.synchronized {
|
lock.synchronized {
|
||||||
channelBuffer --= xs
|
channelBuffer --= xs
|
||||||
|
()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -247,6 +261,7 @@ private[sbt] final class CommandExchange {
|
||||||
case xs =>
|
case xs =>
|
||||||
lock.synchronized {
|
lock.synchronized {
|
||||||
channelBuffer --= xs
|
channelBuffer --= xs
|
||||||
|
()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -288,6 +303,7 @@ private[sbt] final class CommandExchange {
|
||||||
case xs =>
|
case xs =>
|
||||||
lock.synchronized {
|
lock.synchronized {
|
||||||
channelBuffer --= xs
|
channelBuffer --= xs
|
||||||
|
()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -339,6 +355,7 @@ private[sbt] final class CommandExchange {
|
||||||
case xs =>
|
case xs =>
|
||||||
lock.synchronized {
|
lock.synchronized {
|
||||||
channelBuffer --= xs
|
channelBuffer --= xs
|
||||||
|
()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ private[sbt] object LibraryManagement {
|
||||||
}
|
}
|
||||||
|
|
||||||
private[this] def fileUptodate(file: File, stamps: Map[File, Long]): Boolean =
|
private[this] def fileUptodate(file: File, stamps: Map[File, Long]): Boolean =
|
||||||
stamps.get(file).forall(_ == IO.getModifiedTime(file))
|
stamps.get(file).forall(_ == IO.getModifiedTimeOrZero(file))
|
||||||
|
|
||||||
private[sbt] def transitiveScratch(
|
private[sbt] def transitiveScratch(
|
||||||
lm: DependencyResolution,
|
lm: DependencyResolution,
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ object Dependencies {
|
||||||
val baseScalaVersion = scala212
|
val baseScalaVersion = scala212
|
||||||
|
|
||||||
// sbt modules
|
// sbt modules
|
||||||
private val ioVersion = "1.1.2"
|
private val ioVersion = "1.1.3"
|
||||||
private val utilVersion = "1.1.1"
|
private val utilVersion = "1.1.2"
|
||||||
private val lmVersion = "1.1.1"
|
private val lmVersion = "1.1.2"
|
||||||
private val zincVersion = "1.1.0-RC3"
|
private val zincVersion = "1.1.0-RC4"
|
||||||
|
|
||||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||||
|
|
||||||
|
|
@ -106,8 +106,6 @@ object Dependencies {
|
||||||
val specs2 = "org.specs2" %% "specs2-junit" % "4.0.1"
|
val specs2 = "org.specs2" %% "specs2-junit" % "4.0.1"
|
||||||
val junit = "junit" % "junit" % "4.11"
|
val junit = "junit" % "junit" % "4.11"
|
||||||
val templateResolverApi = "org.scala-sbt" % "template-resolver" % "0.1"
|
val templateResolverApi = "org.scala-sbt" % "template-resolver" % "0.1"
|
||||||
val jna = "net.java.dev.jna" % "jna" % "4.1.0"
|
|
||||||
val jnaPlatform = "net.java.dev.jna" % "jna-platform" % "4.1.0"
|
|
||||||
|
|
||||||
private def scala211Module(name: String, moduleVersion: String) = Def setting (
|
private def scala211Module(name: String, moduleVersion: String) = Def setting (
|
||||||
scalaBinaryVersion.value match {
|
scalaBinaryVersion.value match {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ trait ScriptedKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
object Scripted {
|
object Scripted {
|
||||||
|
// This is to workaround https://github.com/sbt/io/issues/110
|
||||||
|
sys.props.put("jna.nosys", "true")
|
||||||
|
|
||||||
lazy val MavenResolverPluginTest = config("mavenResolverPluginTest") extend Compile
|
lazy val MavenResolverPluginTest = config("mavenResolverPluginTest") extend Compile
|
||||||
lazy val RepoOverrideTest = config("repoOverrideTest") extend Compile
|
lazy val RepoOverrideTest = config("repoOverrideTest") extend Compile
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ object SiteMap {
|
||||||
// generates a string suitable for a sitemap file representing the last modified time of the given File
|
// generates a string suitable for a sitemap file representing the last modified time of the given File
|
||||||
private[this] def lastModifiedString(f: File): String = {
|
private[this] def lastModifiedString(f: File): String = {
|
||||||
val formatter = new java.text.SimpleDateFormat("yyyy-MM-dd")
|
val formatter = new java.text.SimpleDateFormat("yyyy-MM-dd")
|
||||||
// TODO: replace lastModified() with sbt.io.Milli.getModifiedTime(), once the build
|
// TODO: replace lastModified() with sbt.io.IO.getModifiedTimeOrZero(), once the build
|
||||||
// has been upgraded to a version of sbt that includes sbt.io.Milli.
|
// has been upgraded to a version of sbt that includes that call.
|
||||||
formatter.format(new java.util.Date(f.lastModified))
|
formatter.format(new java.util.Date(f.lastModified))
|
||||||
}
|
}
|
||||||
// writes the provided XML node to `output` and then gzips it to `gzipped` if `gzip` is true
|
// writes the provided XML node to `output` and then gzips it to `gzipped` if `gzip` is true
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ object Util {
|
||||||
val timestamp = formatter.format(new Date)
|
val timestamp = formatter.format(new Date)
|
||||||
val content = versionLine(version) + "\ntimestamp=" + timestamp
|
val content = versionLine(version) + "\ntimestamp=" + timestamp
|
||||||
val f = dir / "xsbt.version.properties"
|
val f = dir / "xsbt.version.properties"
|
||||||
// TODO: replace lastModified() with sbt.io.Milli.getModifiedTime(), once the build
|
// TODO: replace lastModified() with sbt.io.IO.getModifiedTimeOrZero(), once the build
|
||||||
// has been upgraded to a version of sbt that includes sbt.io.Milli.
|
// has been upgraded to a version of sbt that includes that call.
|
||||||
if (!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f, version)) {
|
if (!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f, version)) {
|
||||||
s.log.info("Writing version information to " + f + " :\n" + content)
|
s.log.info("Writing version information to " + f + " :\n" + content)
|
||||||
IO.write(f, content)
|
IO.write(f, content)
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
sbt.version=1.0.0
|
sbt.version=1.0.4
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
scalaVersion := "2.12.3"
|
scalaVersion := "2.12.4"
|
||||||
scalacOptions ++= Seq("-feature", "-language:postfixOps")
|
scalacOptions ++= Seq("-feature", "-language:postfixOps")
|
||||||
|
|
||||||
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.4")
|
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.5")
|
||||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.2")
|
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.2")
|
||||||
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.14")
|
|
||||||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2")
|
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2")
|
||||||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
|
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue