alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (CompilationStep.scala)

This example Scala source code file (CompilationStep.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

compilationstep, fingerprints, list, logger, logger, nil, path, path, pathfinder, pathfinder, step, step, string, wrapperstep

The Scala CompilationStep.scala source code

import sbt._
import AdditionalResources._

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, ...)
  final def srcDir = pathConfig.sources
  
  // Methods required for the compilation
  def log: Logger = logger
  final def sourceRoots : PathFinder = pathConfig.sources
  def sources: PathFinder  = sourceRoots.descendentsExcept("*.java" | "*.scala", ".svn")
  final def projectPath: Path  = pathConfig.projectRoot
  final def analysisPath: Path = pathConfig.analysis
  final 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] = "-target 1.5 -source 1.5 -g:none" split ' '
  def maxErrors: Int = 100
  def compileOrder =  CompileOrder.JavaThenScala
  def fingerprints = Fingerprints(Nil, Nil)
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala CompilationStep.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.