homebrew-core/Formula/scala.rb

52 lines
1.2 KiB
Ruby

class Scala < Formula
desc "JVM-based programming language"
homepage "https://www.scala-lang.org/"
url "https://github.com/lampepfl/dotty/releases/download/3.2.1/scala3-3.2.1.tar.gz"
sha256 "914e96e6d1d73df2fc68985a394e27ccbfb299306d95a9663fa4fefe83349e59"
license "Apache-2.0"
livecheck do
url "https://www.scala-lang.org/download/"
regex(%r{href=.*?download/v?(\d+(?:\.\d+)+)\.html}i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "de973b41793c7d09a86f220f23c5b2bcd8852a60c3528db3cf1eff5fce4a2f21"
end
depends_on "openjdk"
def install
rm Dir["bin/*.bat"]
libexec.install "lib"
prefix.install "bin"
bin.env_script_all_files libexec/"bin", Language::Java.overridable_java_home_env
# Set up an IntelliJ compatible symlink farm in 'idea'
idea = prefix/"idea"
idea.install_symlink libexec/"lib"
end
def caveats
<<~EOS
To use with IntelliJ, set the Scala home to:
#{opt_prefix}/idea
EOS
end
test do
file = testpath/"Test.scala"
file.write <<~EOS
object Test {
def main(args: Array[String]): Unit = {
println(s"${2 + 2}")
}
}
EOS
out = shell_output("#{bin}/scala #{file}").strip
assert_equal "4", out
end
end