2021-08-10 14:31:46 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
|
|
|
, jdk, maven
|
2023-07-15 17:15:38 +00:00
|
|
|
, makeWrapper
|
2021-08-10 14:31:46 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
platform =
|
|
|
|
if stdenv.isLinux then "linux"
|
|
|
|
else if stdenv.isDarwin then "mac"
|
|
|
|
else if stdenv.isWindows then "windows"
|
|
|
|
else throw "unsupported platform";
|
|
|
|
in
|
2023-07-15 17:15:38 +00:00
|
|
|
maven.buildMavenPackage rec {
|
2021-08-10 14:31:46 +00:00
|
|
|
pname = "java-language-server";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.2.46";
|
2021-08-10 14:31:46 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "georgewfraser";
|
|
|
|
repo = pname;
|
|
|
|
# commit hash is used as owner sometimes forgets to set tags. See https://github.com/georgewfraser/java-language-server/issues/104
|
2023-10-09 19:29:22 +00:00
|
|
|
rev = "d7f4303cd233cdad84daffbb871dd4512a2c8da2";
|
|
|
|
sha256 = "sha256-BIcfwz+pLQarnK8XBPwDN2nrdvK8xqUo0XFXk8ZV/h0=";
|
2021-08-10 14:31:46 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
mvnFetchExtraArgs.dontConfigure = true;
|
2023-10-09 19:29:22 +00:00
|
|
|
mvnHash = "sha256-2uthmSjFQ43N5lgV11DsxuGce+ZptZsmRLTgjDo0M2w=";
|
2021-08-10 14:31:46 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
nativeBuildInputs = [ jdk makeWrapper ];
|
2021-08-10 14:31:46 +00:00
|
|
|
|
|
|
|
dontConfigure = true;
|
2023-07-15 17:15:38 +00:00
|
|
|
preBuild = ''
|
2021-08-10 14:31:46 +00:00
|
|
|
jlink \
|
|
|
|
${lib.optionalString (!stdenv.isDarwin) "--module-path './jdks/${platform}/jdk-13/jmods'"} \
|
|
|
|
--add-modules java.base,java.compiler,java.logging,java.sql,java.xml,jdk.compiler,jdk.jdi,jdk.unsupported,jdk.zipfs \
|
|
|
|
--output dist/${platform} \
|
|
|
|
--no-header-files \
|
|
|
|
--no-man-pages \
|
|
|
|
--compress 2
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2021-08-10 14:31:46 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/share/java/java-language-server
|
|
|
|
cp -r dist/classpath dist/*${platform}* $out/share/java/java-language-server
|
|
|
|
|
|
|
|
# a link is not used as lang_server_${platform}.sh makes use of "dirname $0" to access other files
|
|
|
|
makeWrapper $out/share/java/java-language-server/lang_server_${platform}.sh $out/bin/java-language-server
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A Java language server based on v3.0 of the protocol and implemented using the Java compiler API";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "java-language-server";
|
2021-08-10 14:31:46 +00:00
|
|
|
homepage = "https://github.com/georgewfraser/java-language-server";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ hqurve ];
|
|
|
|
};
|
|
|
|
}
|