class Buildr::Kotlin::Kotlinc

Kotlin compiler:

compile.using(:kotlin)

Used by default if .kt files are found in the src/main/kotlin directory (or src/test/kotlin) and sets the target directory to target/classes (or target/test/classes). Accepts the following options:

environment variable/global option.

Constants

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 kotlin 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::Kotlinc'].library = '1.1.3-2'

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

Public Class Methods

dependencies() click to toggle source
# File lib/buildr/kotlin/compiler.rb, line 93
def dependencies
  kotlin_dependencies = if use_installed?
    %w(kotlin-stdlib kotlin-compiler).map { |s| File.expand_path("lib/#{s}.jar", kotlin_home) }
  else
    REQUIRES.artifacts.map(&:to_s)
  end
  # Add Java utilities (eg KotlinMessageCollector)
  kotlin_dependencies |= [ File.join(File.dirname(__FILE__)) ]
  (kotlin_dependencies).compact
end
installed?() click to toggle source
# File lib/buildr/kotlin/compiler.rb, line 81
def installed?
  !kotlin_home.nil?
end
kotlin_home() click to toggle source
# File lib/buildr/kotlin/compiler.rb, line 71
def kotlin_home
  env_home = ENV['KOTLIN_HOME']

  @home ||= if !env_home.nil? && File.exists?(env_home + '/lib/kotlin-compiler.jar')
    env_home
  else
    nil
  end
end
use_installed?() click to toggle source
# File lib/buildr/kotlin/compiler.rb, line 85
def use_installed?
  if installed? && Buildr.settings.build['kotlin.version']
    Buildr.settings.build['kotlin.version'] == Kotlin.installed_version
  else
    Buildr.settings.build['kotlin.version'].nil? && installed?
  end
end