-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
sbt.rb
52 lines (43 loc) 路 1.65 KB
/
sbt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class Sbt < Formula
desc "Build tool for Scala projects"
homepage "https://www.scala-sbt.org/"
url "https://github.com/sbt/sbt/releases/download/v1.10.0/sbt-1.10.0.tgz"
mirror "https://sbt-downloads.cdnedge.bluemix.net/releases/v1.10.0/sbt-1.10.0.tgz"
sha256 "154b7de6c19207c73d0a304f901c8c4b6ead9a9c3a99a98a9d72ac19419d2640"
license "Apache-2.0"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "78ca2b6b678394936b0c4ff055a95de43b61e156c74e36b3e8cc36dcfd053c3a"
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)
# 3. `sbtn-universal-apple-darwin` (universal binary)
(libexec/"bin").glob("sbt{.bat,n-x86_64*,n-aarch64*,n-universal-apple-darwin}").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
The 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