From 7af62a589d13d271ffdc3606cfa532226439ae6b Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Mon, 15 Aug 2022 23:11:39 -0700 Subject: [PATCH] scala@2.13 2.13.8 (new formula) Closes #108155. Signed-off-by: Rui Chen Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> --- Formula/scala@2.13.rb | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Formula/scala@2.13.rb diff --git a/Formula/scala@2.13.rb b/Formula/scala@2.13.rb new file mode 100644 index 00000000000..6b889f0f5ab --- /dev/null +++ b/Formula/scala@2.13.rb @@ -0,0 +1,56 @@ +class ScalaAT213 < Formula + desc "JVM-based programming language" + homepage "https://www.scala-lang.org/" + url "https://downloads.lightbend.com/scala/2.13.8/scala-2.13.8.tgz" + mirror "https://www.scala-lang.org/files/archive/scala-2.13.8.tgz" + mirror "https://downloads.typesafe.com/scala/2.13.8/scala-2.13.8.tgz" + sha256 "2cb31d8469c651839f0e9c837a1ab06550d031726752f54906be1b9de01314cf" + license "Apache-2.0" + + livecheck do + url "https://www.scala-lang.org/files/archive/" + regex(/href=.*?scala[._-]v?(2\.13(?:\.\d+)+)(?:[._-]final)?\.t/i) + end + + keg_only :versioned_formula + + depends_on "openjdk" + + def install + # Replace `/usr/local` references for uniform bottles + inreplace Dir["man/man1/scala{,c}.1"], "/usr/local", HOMEBREW_PREFIX + rm Dir["bin/*.bat"] + doc.install (buildpath/"doc").children + share.install "man" + 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" + idea.install_symlink doc => "doc" + 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