mirror of https://github.com/sbt/sbt.git
Transient access to API structure from xsbt compiler interface
This commit is contained in:
parent
4f808aad2b
commit
e988b0e51e
|
|
@ -1,7 +1,7 @@
|
||||||
#Project properties
|
#Project properties
|
||||||
#Mon Nov 09 21:08:39 EST 2009
|
#Thu Nov 19 22:26:26 EST 2009
|
||||||
project.organization=org.scala-tools.sbt
|
project.organization=org.scala-tools.sbt
|
||||||
project.name=Simple Build Tool
|
project.name=Simple Build Tool
|
||||||
sbt.version=0.5.6
|
sbt.version=0.5.6
|
||||||
project.version=0.6.3
|
project.version=0.6.4-p1
|
||||||
scala.version=2.7.5
|
scala.version=2.7.5
|
||||||
|
|
|
||||||
|
|
@ -164,14 +164,17 @@ import Format._ // get implicits for data types
|
||||||
class BasicCompileAnalysis protected (analysisPath: Path, projectPath: Path, log: Logger) extends BasicAnalysis(analysisPath, projectPath, log)
|
class BasicCompileAnalysis protected (analysisPath: Path, projectPath: Path, log: Logger) extends BasicAnalysis(analysisPath, projectPath, log)
|
||||||
{
|
{
|
||||||
/*private */val hashesMap = new HashMap[Path, Array[Byte]]
|
/*private */val hashesMap = new HashMap[Path, Array[Byte]]
|
||||||
|
val apiMap = new HashMap[Path, xsbti.api.Source]
|
||||||
|
|
||||||
override protected def mapsToClear = hashesMap :: super.mapsToClear
|
override protected def mapsToClear = apiMap :: hashesMap :: super.mapsToClear
|
||||||
override protected def mapsToRemoveSource = hashesMap :: super.mapsToRemoveSource
|
override protected def mapsToRemoveSource = apiMap :: hashesMap :: super.mapsToRemoveSource
|
||||||
|
|
||||||
def setHash(source: Path, hash: Array[Byte]) { hashesMap(source) = hash }
|
def setHash(source: Path, hash: Array[Byte]) { hashesMap(source) = hash }
|
||||||
def clearHash(source: Path) { hashesMap.removeKey(source) }
|
def clearHash(source: Path) { hashesMap.removeKey(source) }
|
||||||
def hash(source: Path) = hashesMap.get(source)
|
def hash(source: Path) = hashesMap.get(source)
|
||||||
def clearHashes() { hashesMap.clear() }
|
def clearHashes() { hashesMap.clear() }
|
||||||
|
|
||||||
|
def setAPI(source: Path, a: xsbti.api.Source) { apiMap(source) = a }
|
||||||
|
|
||||||
def getClasses(sources: PathFinder, outputDirectory: Path): PathFinder =
|
def getClasses(sources: PathFinder, outputDirectory: Path): PathFinder =
|
||||||
Path.lazyPathFinder
|
Path.lazyPathFinder
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ trait AnalysisCallback extends NotNull
|
||||||
def endSource(sourcePath: Path): Unit
|
def endSource(sourcePath: Path): Unit
|
||||||
/** Called when a module with a public 'main' method with the right signature is found.*/
|
/** Called when a module with a public 'main' method with the right signature is found.*/
|
||||||
def foundApplication(sourcePath: Path, className: String): Unit
|
def foundApplication(sourcePath: Path, className: String): Unit
|
||||||
|
def api(sourcePath: Path, source: xsbti.api.Source): Unit
|
||||||
}
|
}
|
||||||
abstract class BasicAnalysisCallback[A <: BasicCompileAnalysis](val basePath: Path, protected val analysis: A) extends AnalysisCallback
|
abstract class BasicAnalysisCallback[A <: BasicCompileAnalysis](val basePath: Path, protected val analysis: A) extends AnalysisCallback
|
||||||
{
|
{
|
||||||
|
|
@ -84,6 +85,9 @@ abstract class BasicAnalysisCallback[A <: BasicCompileAnalysis](val basePath: Pa
|
||||||
|
|
||||||
def endSource(sourcePath: Path): Unit =
|
def endSource(sourcePath: Path): Unit =
|
||||||
analysis.removeSelfDependency(sourcePath)
|
analysis.removeSelfDependency(sourcePath)
|
||||||
|
|
||||||
|
def api(sourcePath: Path, source: xsbti.api.Source): Unit =
|
||||||
|
analysis.setAPI(sourcePath, source)
|
||||||
}
|
}
|
||||||
abstract class BasicCompileAnalysisCallback(basePath: Path, analysis: CompileAnalysis)
|
abstract class BasicCompileAnalysisCallback(basePath: Path, analysis: CompileAnalysis)
|
||||||
extends BasicAnalysisCallback(basePath, analysis)
|
extends BasicAnalysisCallback(basePath, analysis)
|
||||||
|
|
|
||||||
|
|
@ -134,4 +134,5 @@ private final class AnalysisInterface(delegate: AnalysisCallback, basePath: Path
|
||||||
def relativizeOrAbs(base: Path, file: File) = Path.relativize(base, file).getOrElse(Path.fromFile(file))
|
def relativizeOrAbs(base: Path, file: File) = Path.relativize(base, file).getOrElse(Path.fromFile(file))
|
||||||
def classPath(file: File) = relativizeOrAbs(outputPath, file)
|
def classPath(file: File) = relativizeOrAbs(outputPath, file)
|
||||||
def srcPath(file: File) = relativizeOrAbs(basePath, file)
|
def srcPath(file: File) = relativizeOrAbs(basePath, file)
|
||||||
|
def api(file: File, source: xsbti.api.Source) = delegate.api(srcPath(file), source)
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue