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.10/kotlin-compiler-1.7.10.zip"
sha256 "7683f5451ef308eb773a686ee7779a76a95ed8b143c69ac247937619d7ca3a09"
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: "e26706c1ae9ec914c941335c53764e2f30b07aa73c111c5ff783aa68dba7582d"
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