diff options
Diffstat (limited to 'project/build/CompilationStep.scala')
-rw-r--r-- | project/build/CompilationStep.scala | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/project/build/CompilationStep.scala b/project/build/CompilationStep.scala new file mode 100644 index 0000000000..02d76b9a54 --- /dev/null +++ b/project/build/CompilationStep.scala @@ -0,0 +1,38 @@ +import sbt._ +import BasicLayer._ +trait Step extends Dag[Step] { + def dependencies:Iterable[Step] +} + +class WrapperStep(contents:List[Step]) extends Step{ + def dependencies = contents +} + +abstract class CompilationStep(val name:String, val pathConfig:PathConfig, logger:Logger) extends CompileConfiguration with Step { + def this(name:String, layout:PathLayout,logger:Logger) = this(name, layout / name, logger) + + // Utility methods (for quick access, ...) + def srcDir = pathConfig.sources + + // Methods required for the compilation + def log: Logger = logger + def sourceRoots : PathFinder = pathConfig.sources + def sources: PathFinder = sourceRoots.descendentsExcept("*.java" | "*.scala", ".svn") + def projectPath: Path = pathConfig.projectRoot + def analysisPath: Path = pathConfig.analysis + def outputDirectory: Path = pathConfig.output + def classpath = { + def addDependenciesOutputTo(list:List[Step],acc:PathFinder):PathFinder = list match{ + case Nil => acc + case x::xs => x match{ + case c:CompilationStep => addDependenciesOutputTo(xs,acc +++ c.outputDirectory) + case w:WrapperStep => addDependenciesOutputTo(xs, addDependenciesOutputTo(dependencies.toList,acc)) + } + } + addDependenciesOutputTo(dependencies.toList,outputDirectory) + } + def javaOptions: Seq[String] = Seq ("-target","1.5","-source","1.5","-g:none") + def maxErrors: Int = 100 + def compileOrder = CompileOrder.JavaThenScala + def fingerprints = Fingerprints(Nil,Nil) +} |