homebrew-core/Formula/jdtls.rb

55 lines
1.5 KiB
Ruby

class Jdtls < Formula
include Language::Python::Shebang
desc "Java language specific implementation of the Language Server Protocol"
homepage "https://github.com/eclipse/eclipse.jdt.ls"
url "https://download.eclipse.org/jdtls/milestones/1.15.0/jdt-language-server-1.15.0-202208311644.tar.gz"
version "1.15.0"
sha256 "34368a50a1b2e9c8baf4e302fe21e5b99963a935157713d3c21002ceb13c3fd8"
license "EPL-2.0"
version_scheme 1
livecheck do
url "https://download.eclipse.org/jdtls/milestones/"
regex(%r{href=.*?/v?(\d+(?:\.\d+)+)/?["' >]}i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "283d50b7c93ba460b349bbeeb8e63e00872bec7c374917d417f420e48732f322"
end
depends_on "openjdk"
depends_on "python@3.10"
def install
libexec.install %w[bin config_mac config_linux features plugins]
rewrite_shebang detected_python_shebang, libexec/"bin/jdtls"
(bin/"jdtls").write_env_script libexec/"bin/jdtls",
Language::Java.overridable_java_home_env
end
test do
require "open3"
json = <<~JSON
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"rootUri": null,
"capabilities": {}
}
}
JSON
Open3.popen3("#{bin}/jdtls", "-configuration", "#{testpath}/config", "-data",
"#{testpath}/data") do |stdin, stdout, _e, w|
stdin.write "Content-Length: #{json.size}\r\n\r\n#{json}"
sleep 3
assert_match(/^Content-Length: \d+/i, stdout.readline)
Process.kill("KILL", w.pid)
end
end
end