de.tototec.sbuild.addons.scala

Scalac

class Scalac extends AnyRef

The Scala Compiler addon.

The compiler can be configured via constructor parameter or vars. To compile use Scalac#execute.

To easily configure and execute the compiler in one go, see Scalac$#apply.

Example:

import de.tototec.sbuild._
import de.tototec.sbuild.TargetRef._

@version("0.4.0")
class SBuild(implicit _project: Project) {

  // compile classpath
  val compileCp = ...

  // The Scalac compiler classpath, here version 2.10.0
  val scalaVersion = "2.10.0"
  val scalaCompilerCp =
  s"mvn:org.scala-lang:scala-library:${scalaVersion}" ~
  s"mvn:org.scala-lang:scala-compiler:${scalaVersion}" ~
  s"mvn:org.scala-lang:scala-reflect:${scalaVersion}"

  Target("phony:compile").cacheable dependsOn scalaCompilerCp ~ compileCp ~ "scan:src/main/scala" exec {
    val sources = Path("src/main/scala")
    val target = Path("target/classes")
    addons.scala.Scalac(
      compilerClasspath = scalaCompilerCp.files
      classpath = compileCp.files,
      sources = "scan:src/main/scala".files,
      destDir = target,
      target = "jvm-1.6",
      deprecation = true,
      unchecked = true,
      debugInfo = "vars",
      fork = true
    )
  }
}
Since

0.3.0

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Scalac
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Scalac(compilerClasspath: Seq[File] = null, classpath: Seq[File] = null, srcDir: File = null, srcDirs: Seq[File] = null, destDir: File = null, encoding: String = "UTF-8", unchecked: Boolean = null, deprecation: Boolean = null, verbose: Boolean = null, target: String = null, debugInfo: String = null, fork: Boolean = false, additionalScalacArgs: Seq[String] = null, sources: Seq[File] = null, useArgsFile: Boolean = null, jvmArgs: Seq[String] = null, sourcePath: File = null)(implicit project: Project)

    Create a new Scalac Compiler addon instance.

    Create a new Scalac Compiler addon instance. All parameters can be omitted and set later.

    The source files can be given via multiple parameters, sources, srcDir and srcDirs, and will be joined.

    The Scala compiler is able to read Java source files in order to resolve dependencies. It will not create class files for read Java files, though. All Java files given or found on the source directories will be read.

    compilerClasspath

    The classpath which contains the compiler and its dependencies. (E.g. scala-compiler.jar, scala-reflect.jar, ...) If not specified, the compiler must be in the SBuild classpath, e.g. by adding it with @classpath annotation. If fork option is also set to true, this parameter is required.

    classpath

    The classpath is forwarded to the compiler and used to load dependencies of the sources. It must also contain the scala library.

    srcDir

    A directory containing Scala (and Java) source files. If multiple directories are needed, srcDirs parameter can be used.

    srcDirs

    Multiple directories containing Scala and Java source files. If only one directory is needed, srcDir parameter can be used for convenience.

    destDir

    The directory, where the compiled class files will be stored. If the directory does not exists, it will be created.

    encoding

    The encoding of the source files.

    unchecked

    If true, the compiler enables detailed unchecked (erasure) warnings.

    deprecation

    If true , the compiler emit warning and location for usages of deprecated APIs.

    verbose

    If true, the compiler outputs messages about what it is doing.

    target

    Target platform for object files. The supported values depend on the used version of the Scalac compiler. Scalac up to 2.9.x supports the following values: jvm-1.5 (default), msil. Scalac 2.10.x also supports jvm-1.6 (default), jvm-1.7 and various others. Please consult the Scalac documentation.

    debugInfo

    The level of generated debugging info. Supported values: none, source, line, vars (default), notailcalls. "none" generates no debugging info, "source" generates only the source file attribute, "line" generates source and line number information, "vars" generates source, line number and local variable information, "notc" generates all of the above and will not perform tail call optimization.

    fork

    If true runs the compiler in a separate process. If not set or set to false, the Scala version of SBuild and the used Scala compiler must be binary compatible. If you indent to use a different (binary incompatible) Scala version to the one SBuild runs with, you should set it to true. If true, also the compilerClasspath parameter must be specified.

    additionalScalacArgs

    Additional arguments directly passed to the Scala compiler. Refer to the scalac manual or inspect scalac -help output.

    sources

    Source files to be compiled. Since 0.4.0

    useArgsFile

    If true use a temporary file to set the compiler arguments. Since 0.4.0.9000.

    jvmArgs

    Additional arguments given directly to the forked JVM. Will be ignored, if parameter fork is not true. Since 0.4.0.9000.

    sourcePath

    Path were the compiler looks for source files. Since 0.4.0.9000.

  2. new Scalac(compilerClasspath: Seq[File], classpath: Seq[File], srcDir: File, srcDirs: Seq[File], destDir: File, encoding: String, unchecked: Boolean, deprecation: Boolean, verbose: Boolean, target: String, debugInfo: String, fork: Boolean, additionalScalacArgs: Seq[String], sources: Seq[File])(implicit project: Project)

    Annotations
    @deprecated
    Deprecated

    (Since version 0.4.0.9000) Binary compatibility placeholder. Please use the primary constructor.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from Scalac to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (Scalac, B)

    Implicit information
    This member is added by an implicit conversion from Scalac to ArrowAssoc[Scalac] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. var additionalScalacArgs: Seq[String]

    Additional arguments directly passed to the Scala compiler.

    Additional arguments directly passed to the Scala compiler. Refer to the scalac manual or inspect scalac -help output.

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. var classpath: Seq[File]

    The classpath is forwarded to the compiler and used to load dependencies of the sources.

    The classpath is forwarded to the compiler and used to load dependencies of the sources. It must also contain the scala library.

  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def compileExternal(args: Seq[String]): Int

    Attributes
    protected
  13. def compileInternal(args: Array[String]): Int

    Attributes
    protected
  14. var compilerClasspath: Seq[File]

    The classpath which contains the compiler and its dependencies.

    The classpath which contains the compiler and its dependencies. (E.g. scala-compiler.jar, scala-reflect.jar, ...) If not specified, the compiler must be in the SBuild classpath, e.g. by adding it with @classpath annotation. If fork option is also set to true, this parameter is required.

  15. var debugInfo: String

    The level of generated debugging info.

    The level of generated debugging info. Supported values: none, source, line, vars (default), notailcalls. "none" generates no debugging info, "source" generates only the source file attribute, "line" generates source and line number information, "vars" generates source, line number and local variable information, "notc" generates all of the above and will not perform tail call optimization.

  16. var deprecation: Boolean

    If true , the compiler emit warning and location for usages of deprecated APIs.

  17. var destDir: File

    The directory, where the compiled class files will be stored.

    The directory, where the compiled class files will be stored. If the directory does not exists, it will be created.

  18. var encoding: String

    The encoding of the source files.

  19. def ensuring(cond: (Scalac) ⇒ Boolean, msg: ⇒ Any): Scalac

    Implicit information
    This member is added by an implicit conversion from Scalac to Ensuring[Scalac] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  20. def ensuring(cond: (Scalac) ⇒ Boolean): Scalac

    Implicit information
    This member is added by an implicit conversion from Scalac to Ensuring[Scalac] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  21. def ensuring(cond: Boolean, msg: ⇒ Any): Scalac

    Implicit information
    This member is added by an implicit conversion from Scalac to Ensuring[Scalac] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  22. def ensuring(cond: Boolean): Scalac

    Implicit information
    This member is added by an implicit conversion from Scalac to Ensuring[Scalac] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  23. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  25. def execute: Unit

    Execute the Scala compiler.

  26. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. var fork: Boolean

    If true runs the compiler in a separate process.

    If true runs the compiler in a separate process. If not set or set to false, the Scala version of SBuild and the used Scala compiler must be binary compatible. If you indent to use a different (binary incompatible) Scala version to the one SBuild runs with, you should set it to true. If true, also the compilerClasspath parameter must be specified.

  28. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from Scalac to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  29. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  30. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  31. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  32. var jvmArgs: Seq[String]

    Additional arguments given directly to the forked JVM.

    Additional arguments given directly to the forked JVM. Will be ignored, if parameter fork is not true. Since 0.4.0.9000.

  33. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  34. final def notify(): Unit

    Definition Classes
    AnyRef
  35. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  36. var sourcePath: File

    Path were the compiler looks for source files.

    Path were the compiler looks for source files. Since 0.4.0.9000.

  37. var sources: Seq[File]

    Source files to be compiled.

    Source files to be compiled. Since 0.4.0

  38. var srcDir: File

    A directory containing Scala (and Java) source files.

    A directory containing Scala (and Java) source files. If multiple directories are needed, srcDirs parameter can be used.

  39. var srcDirs: Seq[File]

    Multiple directories containing Scala and Java source files.

    Multiple directories containing Scala and Java source files. If only one directory is needed, srcDir parameter can be used for convenience.

  40. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  41. var target: String

    Target platform for object files.

    Target platform for object files. The supported values depend on the used version of the Scalac compiler. Scalac up to 2.9.x supports the following values: jvm-1.5 (default), msil. Scalac 2.10.x also supports jvm-1.6 (default), jvm-1.7 and various others. Please consult the Scalac documentation.

  42. def toString(): String

    Definition Classes
    Scalac → AnyRef → Any
  43. var unchecked: Boolean

    If true, the compiler enables detailed unchecked (erasure) warnings.

  44. var useArgsFile: Boolean

    If true use a temporary file to set the compiler arguments.

    If true use a temporary file to set the compiler arguments. Since 0.4.0.9000.

  45. var verbose: Boolean

    If true, the compiler outputs messages about what it is doing.

  46. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. def [B](y: B): (Scalac, B)

    Implicit information
    This member is added by an implicit conversion from Scalac to ArrowAssoc[Scalac] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from Scalac to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (scalac: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from Scalac to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (scalac: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: Scalac

    Implicit information
    This member is added by an implicit conversion from Scalac to ArrowAssoc[Scalac] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (scalac: ArrowAssoc[Scalac]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: Scalac

    Implicit information
    This member is added by an implicit conversion from Scalac to Ensuring[Scalac] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (scalac: Ensuring[Scalac]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Scalac to StringAdd

Inherited by implicit conversion any2stringfmt from Scalac to StringFormat

Inherited by implicit conversion any2ArrowAssoc from Scalac to ArrowAssoc[Scalac]

Inherited by implicit conversion any2Ensuring from Scalac to Ensuring[Scalac]

Ungrouped