class Buildr::Scala::Scalac

Scalac compiler:

compile.using(:scalac)

Used by default if .scala files are found in the src/main/scala directory (or src/test/scala) and sets the target directory to target/classes (or target/test/classes).

Accepts the following options:

Constants

DEFAULT_JLINE_VERSION
DEFAULT_SBT_VERSION
DEFAULT_ZINC_VERSION
Javac

Javac compiler:

compile.using(:javac)

Used by default if .java files are found in the src/main/java directory (or src/test/java) and sets the target directory to target/classes (or target/test/classes).

Accepts the following options:

  • :warnings – Issue warnings when compiling. True when running in verbose mode.

  • :debug – Generates bytecode with debugging information. Set from the debug

environment variable/global option.

  • :deprecation – If true, shows deprecation messages. False by default.

  • :source – Source code compatibility.

  • :target – Bytecode compatibility.

  • :lint – Lint option is one of true, false (default), name (e.g. ‘cast’) or array.

  • :other – Array of options passed to the compiler

(e.g. [‘-implicit:none’, ‘-encoding’, ‘iso-8859-1’])

OPTIONS
REQUIRES

The scalac compiler jars are added to classpath at load time, if you want to customize artifact versions, you must set them on the

artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'

namespace before this file is required. This is of course, only if SCALA_HOME is not set or invalid.

ZINC_REQUIRES

Public Class Methods

dependencies() click to toggle source
# File lib/buildr/scala/compiler.rb, line 111
def dependencies
  scala_dependencies = if use_installed?
    ['scala-library', 'scala-compiler'].map { |s| File.expand_path("lib/#{s}.jar", scala_home) }
  else
    REQUIRES.artifacts.map(&:to_s)
  end

  zinc_dependencies = ZINC_REQUIRES.artifacts.map(&:to_s)

  (scala_dependencies + zinc_dependencies).compact
end
installed?() click to toggle source
# File lib/buildr/scala/compiler.rb, line 99
def installed?
  !scala_home.nil?
end
scala_home() click to toggle source
# File lib/buildr/scala/compiler.rb, line 89
def scala_home
  env_home = ENV['SCALA_HOME']

  @home ||= (if !env_home.nil? && File.exists?(env_home + '/lib/scala-library.jar') && File.exists?(env_home + '/lib/scala-compiler.jar')
    env_home
  else
    nil
  end)
end
use_fsc() click to toggle source
# File lib/buildr/scala/compiler.rb, line 123
def use_fsc
  use_installed? && ENV["USE_FSC"] =~ /^(yes|on|true)$/
end
use_installed?() click to toggle source
# File lib/buildr/scala/compiler.rb, line 103
def use_installed?
  if installed? && Buildr.settings.build['scala.version']
    Buildr.settings.build['scala.version'] == Scala.installed_version
  else
    Buildr.settings.build['scala.version'].nil? && installed?
  end
end