52 lines
1.6 KiB
Ruby
52 lines
1.6 KiB
Ruby
class Sbt < Formula
|
|
desc "Build tool for Scala projects"
|
|
homepage "https://www.scala-sbt.org/"
|
|
url "https://github.com/sbt/sbt/releases/download/v1.7.1/sbt-1.7.1.tgz"
|
|
mirror "https://sbt-downloads.cdnedge.bluemix.net/releases/v1.7.1/sbt-1.7.1.tgz"
|
|
sha256 "8a183afdb3519290dde2f8c81c9b2bad19ddd78735ef311fb5fb9bdcf68d3fe4"
|
|
license "Apache-2.0"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "f0ae85a514c49e1e3c1412b42e34ae29603ada77cf3361226e4dcbf66fcdfede"
|
|
end
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
inreplace "bin/sbt" do |s|
|
|
s.gsub! 'etc_sbt_opts_file="/etc/sbt/sbtopts"', "etc_sbt_opts_file=\"#{etc}/sbtopts\""
|
|
s.gsub! "/etc/sbt/sbtopts", "#{etc}/sbtopts"
|
|
end
|
|
|
|
libexec.install "bin"
|
|
etc.install "conf/sbtopts"
|
|
|
|
# Removes:
|
|
# 1. `sbt.bat` (Windows-only)
|
|
# 2. `sbtn` (pre-compiled native binary)
|
|
(libexec/"bin").glob("sbt{.bat,n-x86_64*}").map(&:unlink)
|
|
(bin/"sbt").write_env_script libexec/"bin/sbt", Language::Java.overridable_java_home_env
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
You can use $SBT_OPTS to pass additional JVM options to sbt.
|
|
Project specific options should be placed in .sbtopts in the root of your project.
|
|
Global settings should be placed in #{etc}/sbtopts
|
|
|
|
#{tap.user}'s installation does not include `sbtn`.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
ENV.append "_JAVA_OPTIONS", "-Dsbt.log.noformat=true"
|
|
system bin/"sbt", "--sbt-create", "about"
|
|
assert_match version.to_s, shell_output("#{bin}/sbt sbtVersion")
|
|
end
|
|
end
|