homebrew-core/Formula/kotlin.rb

40 lines
1.3 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.7.21/kotlin-compiler-1.7.21.zip"
sha256 "8412b31b808755f0c0d336dbb8c8443fa239bf32ddb3cdb81b305b25f0ad279e"
license "Apache-2.0"
# This repository has thousands of development tags, so the `GithubLatest`
# strategy is used to minimize data transfer in this extreme case.
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, all: "f3a48b0d323610b9a0d3c6fe2ecbd88afa092cd65428e6d3ec2c3514fdb1066b"
end
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