homebrew-core/Formula/kotlin.rb

36 lines
1.1 KiB
Ruby

class Kotlin < Formula
desc "Statically typed programming language for the JVM"
homepage "https://kotlinlang.org/"
url "https://github.com/JetBrains/kotlin/releases/download/v1.4.20/kotlin-compiler-1.4.20.zip"
sha256 "11db93a4d6789e3406c7f60b9f267eba26d6483dcd771eff9f85bb7e9837011f"
license "Apache-2.0"
livecheck do
url "https://github.com/JetBrains/kotlin/releases/latest"
regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
end
bottle :unneeded
depends_on "openjdk"
def install
libexec.install "bin", "build.txt", "lib"
rm Dir["#{libexec}/bin/*.bat"]
bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files libexec/"bin", Language::Java.overridable_java_home_env
prefix.install "license"
end
test do
(testpath/"test.kt").write <<~EOS
fun main(args: Array<String>) {
println("Hello World!")
}
EOS
system "#{bin}/kotlinc", "test.kt", "-include-runtime", "-d", "test.jar"
system "#{bin}/kotlinc-js", "test.kt", "-output", "test.js"
system "#{bin}/kotlinc-jvm", "test.kt", "-include-runtime", "-d", "test.jar"
end
end