module Buildr::Kotlin

The Kotlin Module

Constants

DEFAULT_VERSION

Public Class Methods

installed_version() click to toggle source
# File lib/buildr/kotlin/compiler.rb, line 22
def installed_version
  unless @installed_version
    @installed_version = if Kotlinc.installed?
      begin
        # try to read the value from the build.txt file
        version_str = File.read(File.expand_path('build.txt', Kotlinc.kotlin_home))

        if version_str
          md = version_str.match(/\d+\.\d[\d\.]*/) or
            fail "Unable to parse Kotlin version: #{version_str}"

          md[0].sub(/.$/, "") # remove trailing dot, if any
        end
      rescue => e
        warn "Unable to parse library.properties in $KOTLIN_HOME/build.txt: #{e}"
        nil
      end
    end
  end

  @installed_version
end
version() click to toggle source
# File lib/buildr/kotlin/compiler.rb, line 45
def version
  Buildr.settings.build['kotlin.version'] || installed_version || DEFAULT_VERSION
end
version?(*v) click to toggle source

check if version matches any of the given prefixes

# File lib/buildr/kotlin/compiler.rb, line 50
def version?(*v)
  v.any? { |v| version.index(v.to_s) == 0 }
end