-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext-ls.rb
81 lines (68 loc) · 2.56 KB
/
next-ls.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
class NextLs < Formula
desc "Language server for Elixir that just works"
homepage "https://www.elixir-tools.dev/next-ls"
url "https://github.com/elixir-tools/next-ls/archive/refs/tags/v0.23.3.tar.gz"
sha256 "9f3ce80f665b09ce3c8ffb25eceddf22056a7189c4e22281687eec86f4d965b0"
license "MIT"
bottle do
root_url "https://github.com/elixir-tools/homebrew-tap/releases/download/next-ls-0.23.3"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "d08bed987617e970a19d9bb104b38d0ad6dcf692fef3cf7b8e7c40e30a7cc03f"
sha256 cellar: :any_skip_relocation, ventura: "2e15d17b5faeb885912e086f31d3464206d936d32f1c9ab297dc532a45149af6"
sha256 cellar: :any_skip_relocation, x86_64_linux: "84fb8b5cd6ee856c91dd9aafebd9e4bd38689a61d087e27a1b6ad1f1b916d9e4"
end
depends_on "elixir" => :build
depends_on "xz" => :build
depends_on "erlang"
resource "zig" do
on_macos do
on_arm do
url "https://ziglang.org/download/0.11.0/zig-macos-aarch64-0.11.0.tar.xz"
sha256 "c6ebf927bb13a707d74267474a9f553274e64906fd21bf1c75a20bde8cadf7b2"
end
on_intel do
url "https://ziglang.org/download/0.11.0/zig-macos-x86_64-0.11.0.tar.xz"
sha256 "1c1c6b9a906b42baae73656e24e108fd8444bb50b6e8fd03e9e7a3f8b5f05686"
end
end
on_linux do
url "https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz"
sha256 "2d00e789fec4f71790a6e7bf83ff91d564943c5ee843c5fd966efc474b423047"
end
end
def install
zig_install_dir = buildpath/"zig"
mkdir zig_install_dir
resources.each do |r|
r.fetch
system "tar", "xvC", zig_install_dir, "-f", r.cached_download
zig_dir =
if OS.mac? && Hardware::CPU.arm?
zig_install_dir/"zig-macos-aarch64-0.11.0"
elsif OS.mac? && Hardware::CPU.intel?
zig_install_dir/"zig-macos-x86_64-0.11.0"
elsif OS.linux? && Hardware::CPU.intel?
zig_install_dir/"zig-linux-x86_64-0.11.0"
end
ENV["PATH"] = "#{zig_dir}:" + ENV["PATH"]
end
system "mix", "local.hex", "--force"
system "mix", "local.rebar", "--force"
target =
if OS.mac? && Hardware::CPU.arm?
"darwin_arm64"
elsif OS.mac? && Hardware::CPU.intel?
"darwin_amd64"
elsif OS.linux? && Hardware::CPU.intel?
"linux_amd64"
end
ENV["BURRITO_TARGET"] = target
ENV["MIX_ENV"] = "prod"
ENV["NEXTLS_RELEASE_MODE"] = "burrito"
system "mix", "deps.get"
system "mix", "release"
bin.install "burrito_out/next_ls_#{target}" => "nextls"
end
test do
system "true"
end
end