remove completed pending items

This commit is contained in:
Mark Harrah 2011-04-19 17:55:40 -04:00
parent 818f14a9a6
commit 510caaa25e
2 changed files with 0 additions and 93 deletions

View File

@ -1,19 +0,0 @@
/* sbt -- Simple Build Tool
* Copyright 2009 Mark Harrah
*/
package sbt
trait AutoCompilerPlugins extends BasicScalaProject
{
import Configurations.CompilerPlugin
abstract override def extraDefaultConfigurations =
CompilerPlugin :: super.extraDefaultConfigurations
abstract override def compileOptions = compilerPlugins ++ super.compileOptions
/** A PathFinder that provides the classpath to search for compiler plugins. */
def pluginClasspath = fullClasspath(CompilerPlugin)
protected def compilerPlugins: List[CompileOption] =
ClasspathUtilities.compilerPlugins(pluginClasspath.get).map(plugin => new CompileOption("-Xplugin:" + plugin.getAbsolutePath)).toList
def compilerPlugin(dependency: ModuleID) = dependency % "plugin->default(compile)"
}

View File

@ -1,74 +0,0 @@
/* sbt -- Simple Build Tool
* Copyright 2008, 2009 Mark Harrah
*/
package sbt
import java.io.{File, Writer}
object DotGraph
{
private def fToString(roots: Iterable[File]): (File => String) =
(x: File) => sourceToString(roots, x)
def sources(analysis: BasicCompileAnalysis, outputDirectory: Path, sourceRoots: Iterable[Path], log: Logger) =
{
val toString = fToString(Path.getFiles(sourceRoots))
apply(analysis, outputDirectory, toString, toString, log)
}
def packages(analysis: BasicCompileAnalysis, outputDirectory: Path, sourceRoots: Iterable[Path], log: Logger) =
{
val packageOnly = (path: String) =>
{
val last = path.lastIndexOf(File.separatorChar)
val packagePath = (if(last > 0) path.substring(0, last) else path).trim
if(packagePath.isEmpty) "" else packagePath.replace(File.separatorChar, '.')
}
val toString = packageOnly compose fToString(Path.getFiles(sourceRoots))
apply(analysis, outputDirectory, toString, toString, log)
}
def apply(analysis: BasicCompileAnalysis, outputDirectory: Path, sourceToString: File => String, externalToString: File => String, log: Logger) =
{
val outputDir = outputDirectory.asFile
def generateGraph[Key, Value](fileName: String, graphName: String, graph: Iterable[(Key, scala.collection.Set[Value])],
keyToString: Key => String, valueToString: Value => String) =
{
import scala.collection.mutable.{HashMap, HashSet}
val mappedGraph = new HashMap[String, HashSet[String]]
for( (key, values) <- graph; keyString = keyToString(key); value <- values)
mappedGraph.getOrElseUpdate(keyString, new HashSet[String]) += valueToString(value)
FileUtilities.write(new File(outputDir, fileName), log) { (writer: Writer) =>
def writeLine(line: String) = FileUtilities.writeLine(writer, line)
writeLine("digraph " + graphName + " {")
for( (dependsOn, dependants) <- mappedGraph; dependant <- dependants)
{
if(dependant != dependsOn && !dependsOn.isEmpty && !dependant.isEmpty)
writeLine("\"" + dependant + "\" -> \"" + dependsOn + "\"")
}
writeLine("}")
None
}
}
val srcToString = (p: Path) => sourceToString(p.asFile)
FileUtilities.createDirectory(outputDir, log) orElse
generateGraph(BasicAnalysis.DependenciesFileName, "dependencies", analysis.allDependencies,
srcToString, srcToString) orElse
generateGraph(BasicAnalysis.ExternalDependenciesFileName, "externalDependencies", analysis.allExternalDependencies,
externalToString, srcToString)
}
def sourceToString(roots: Iterable[File], source: File) =
{
val rawName = relativized(roots, source).trim
if(rawName.endsWith(".scala"))
rawName.substring(0, rawName.length - ".scala".length)
else
rawName
}
private def relativized(roots: Iterable[File], path: File): String =
{
val relativized = roots.flatMap(root => Path.relativize(root, path))
val shortest = (Int.MaxValue /: relativized)(_ min _.length)
relativized.find(_.length == shortest).getOrElse(path.getName)
}
}