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:
-
:warnings – Generate warnings if true (opposite of -nowarn).
-
:deprecation – Output source locations where deprecated APIs are used.
-
:optimise – Generates faster bytecode by applying optimisations to the program.
-
:target – Class file compatibility with specified release.
-
:debug – Generate debugging info.
-
:other – Array of options to pass to the Scalac compiler as is, e.g. -Xprint-types
Constants
- DEFAULT_JLINE_VERSION
- DEFAULT_SBT_VERSION
- DEFAULT_SCALAMAIN_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
# File lib/buildr/scala/compiler.rb, line 118 def dependencies scala_dependencies = if use_installed? %w(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
# File lib/buildr/scala/compiler.rb, line 106 def installed? !scala_home.nil? end
# File lib/buildr/scala/compiler.rb, line 96 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
# File lib/buildr/scala/compiler.rb, line 130 def use_fsc use_installed? && ENV['USE_FSC'] =~ /^(yes|on|true)$/i end
# File lib/buildr/scala/compiler.rb, line 110 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