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.0/scala3-3.2.0.tar.gz"
sha256 "194bd030808f6fc7de083bfd7c75230d719aedc20f3cb7562dc65d18b4a17278"
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: "cb90d58557b370ad0127b99e9bf18ac6244d4e5980c2548bed7f43601c0246a6"
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