mirror of https://github.com/sbt/sbt.git
cleanup, small fixes
This commit is contained in:
parent
4fd7611074
commit
ccf0508ce6
|
|
@ -4,7 +4,7 @@
|
||||||
package sbt
|
package sbt
|
||||||
package inc
|
package inc
|
||||||
|
|
||||||
import java.io.{File, InputStream, IOException}
|
import java.io.{File, IOException}
|
||||||
import sbinary._
|
import sbinary._
|
||||||
import Operations.{read, write}
|
import Operations.{read, write}
|
||||||
import DefaultProtocol._
|
import DefaultProtocol._
|
||||||
|
|
@ -14,19 +14,13 @@ object FileBasedStore
|
||||||
{
|
{
|
||||||
def apply(file: File)(implicit analysisF: Format[Analysis], setupF: Format[CompileSetup]): AnalysisStore = new AnalysisStore {
|
def apply(file: File)(implicit analysisF: Format[Analysis], setupF: Format[CompileSetup]): AnalysisStore = new AnalysisStore {
|
||||||
def set(analysis: Analysis, setup: CompileSetup): Unit =
|
def set(analysis: Analysis, setup: CompileSetup): Unit =
|
||||||
Using.fileOutputStream()(file) { fout =>
|
IO.gzipFileOut(file) { out =>
|
||||||
Using.gzipOutputStream(fout) { outg =>
|
|
||||||
Using.bufferedOutputStream(outg) { out =>
|
|
||||||
write[(Analysis, CompileSetup)](out, (analysis, setup) )
|
write[(Analysis, CompileSetup)](out, (analysis, setup) )
|
||||||
}}}
|
}
|
||||||
|
|
||||||
def get(): Option[(Analysis, CompileSetup)] =
|
def get(): Option[(Analysis, CompileSetup)] =
|
||||||
try { Some(getUncaught()) } catch { case io: IOException => None }
|
try { Some(getUncaught()) } catch { case io: IOException => None }
|
||||||
def getUncaught(): (Analysis, CompileSetup) =
|
def getUncaught(): (Analysis, CompileSetup) =
|
||||||
Using.fileInputStream(file) { fin =>
|
IO.gzipFileIn(file)( in => read[(Analysis, CompileSetup)](in) )
|
||||||
Using.gzipInputStream(fin) { ing =>
|
|
||||||
Using.bufferedInputStream(ing) { in =>
|
|
||||||
read[(Analysis, CompileSetup)]( in )
|
|
||||||
}}}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +183,7 @@ object ClasspathProject
|
||||||
analyzed(i.config.classesDirectory, analysis)
|
analyzed(i.config.classesDirectory, analysis)
|
||||||
}
|
}
|
||||||
|
|
||||||
def makeProducts(compile: Task[Analysis], inputs: Task[Compile.Inputs], name: String, prefix: String) =
|
def makeProducts(compile: Task[Analysis], inputs: Task[Compile.Inputs], name: String, prefix: String): Task[Seq[Attributed[File]]] =
|
||||||
{
|
{
|
||||||
def mkName(postfix: String) = name + "/" + prefix + postfix
|
def mkName(postfix: String) = name + "/" + prefix + postfix
|
||||||
analyzed(compile, inputs) named(mkName("analyzed")) map { _ :: Nil } named(mkName("products"))
|
analyzed(compile, inputs) named(mkName("analyzed")) map { _ :: Nil } named(mkName("products"))
|
||||||
|
|
@ -265,7 +265,7 @@ object ClasspathProject
|
||||||
def missingMapping(from: String, to: String, conf: String) =
|
def missingMapping(from: String, to: String, conf: String) =
|
||||||
error("No configuration mapping defined from '" + from + "' to '" + to + "' for '" + conf + "'")
|
error("No configuration mapping defined from '" + from + "' to '" + to + "' for '" + conf + "'")
|
||||||
def missingConfiguration(in: String, conf: String) =
|
def missingConfiguration(in: String, conf: String) =
|
||||||
error("Configuration '" + conf + "' not defined in '" + in)
|
error("Configuration '" + conf + "' not defined in '" + in + "'")
|
||||||
def allConfigs(dep: Project, conf: String): Seq[String] =
|
def allConfigs(dep: Project, conf: String): Seq[String] =
|
||||||
dep match {
|
dep match {
|
||||||
case cp: ClasspathProject => Dag.topologicalSort(configuration(cp, conf))(_.extendsConfigs).map(_.name)
|
case cp: ClasspathProject => Dag.topologicalSort(configuration(cp, conf))(_.extendsConfigs).map(_.name)
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ ProjectCommand +
|
||||||
def DefaultsDetailed = "Registers default built-in commands"
|
def DefaultsDetailed = "Registers default built-in commands"
|
||||||
|
|
||||||
def ReloadCommand = "reload"
|
def ReloadCommand = "reload"
|
||||||
def ReloadBrief = (ReloadCommand, "Reloads the session and continues to execute the remaining commands.")
|
def ReloadBrief = (ReloadCommand, "Reloads the session and then executes the remaining commands.")
|
||||||
def ReloadDetailed =
|
def ReloadDetailed =
|
||||||
ReloadCommand + """
|
ReloadCommand + """
|
||||||
This command is equivalent to exiting, restarting, and running the
|
This command is equivalent to exiting, restarting, and running the
|
||||||
|
|
@ -160,7 +160,6 @@ DiscoverSyntax + """
|
||||||
CompileSyntax + """
|
CompileSyntax + """
|
||||||
|
|
||||||
Incrementally compiles Scala and Java sources.
|
Incrementally compiles Scala and Java sources.
|
||||||
Java source support is limited at this time.
|
|
||||||
|
|
||||||
<paths> are explicit paths separated by the platform path separator.
|
<paths> are explicit paths separated by the platform path separator.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,15 +56,15 @@ final class Scaladoc(maximumErrors: Int, compiler: AnalyzingCompiler)
|
||||||
{
|
{
|
||||||
log.info(actionStartMessage(label))
|
log.info(actionStartMessage(label))
|
||||||
if(sources.isEmpty)
|
if(sources.isEmpty)
|
||||||
log.info(actionNothingToDoMessage)
|
log.info(ActionNothingToDoMessage)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IO.createDirectory(outputDirectory)
|
IO.createDirectory(outputDirectory)
|
||||||
compiler.doc(sources, classpath, outputDirectory, options, maximumErrors, log)
|
compiler.doc(sources, classpath, outputDirectory, options, maximumErrors, log)
|
||||||
log.info(actionSuccessfulMessage)
|
log.info(ActionSuccessfulMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def actionStartMessage(label: String) = "Generating API documentation for " + label + " sources..."
|
def actionStartMessage(label: String) = "Generating API documentation for " + label + " sources..."
|
||||||
val actionNothingToDoMessage = "No sources specified."
|
val ActionNothingToDoMessage = "No sources specified."
|
||||||
val actionSuccessfulMessage = "API documentation generation successful."
|
val ActionSuccessfulMessage = "API documentation generation successful."
|
||||||
}
|
}
|
||||||
|
|
@ -569,4 +569,14 @@ object IO
|
||||||
delete(a)
|
delete(a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def gzipFileOut[T](file: File)(f: OutputStream => T): T =
|
||||||
|
Using.fileOutputStream()(file) { fout =>
|
||||||
|
Using.gzipOutputStream(fout) { outg =>
|
||||||
|
Using.bufferedOutputStream(outg)(f) }}
|
||||||
|
|
||||||
|
def gzipFileIn[T](file: File)(f: InputStream => T): T =
|
||||||
|
Using.fileInputStream(file) { fin =>
|
||||||
|
Using.gzipInputStream(fin) { ing =>
|
||||||
|
Using.bufferedInputStream(ing)(f) }}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue