10 maven.buildMavenPackage rec {
14 src = fetchFromGitHub {
18 hash = "sha256-VWYTkYlPziNRyxHdvIWVuDlABpKdzhC/F6BUBj/opks=";
19 # Lemminx reads this git information at runtime from a git.properties
20 # file on the classpath
23 cat > $out/org.eclipse.lemminx/src/main/resources/git.properties << EOF
24 git.build.version=${version}
25 git.commit.id.abbrev=$(git -C $out rev-parse --short HEAD)
26 git.commit.message.short=$(git -C $out log -1 --pretty=format:%s)
33 manualMvnArtifacts = [
34 "org.apache.maven.surefire:surefire-junit-platform:3.1.2"
35 "org.junit.platform:junit-platform-launcher:1.10.0"
38 mvnHash = "sha256-sIiCp1AorVQXt13Tq0vw9jGioG3zcQMqqKS/Q0Tf4MQ=";
42 # disable gitcommitid plugin which needs a .git folder which we
44 mvnDepsParameters = "-Dmaven.gitcommitid.skip=true";
46 # disable failing tests which either need internet access or are flaky
47 mvnParameters = lib.escapeShellArgs [
48 "-Dmaven.gitcommitid.skip=true"
49 "-Dtest=!XMLValidationCommandTest,
50 !XMLValidationExternalResourcesBasedOnDTDTest,
51 !XMLSchemaPublishDiagnosticsTest,
53 !XMLValidationExternalResourcesBasedOnXSDTest,
55 !XMLSchemaCompletionExtensionsTest,
56 !XMLSchemaDiagnosticsTest,
57 !MissingChildElementCodeActionTest,
58 !XSDValidationExternalResourcesTest,
59 !DocumentLifecycleParticipantTest,
60 !DTDValidationExternalResourcesTest"
66 mkdir -p $out/bin $out/share
67 install -Dm644 org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar \
70 makeWrapper ${jre}/bin/java $out/bin/lemminx \
71 --add-flags "-jar $out/share/org.eclipse.lemminx-uber.jar"
76 nativeBuildInputs = [ makeWrapper ];
78 passthru.updateScript = writeScript "update-lemminx" ''
79 #!/usr/bin/env nix-shell
80 #!nix-shell -i bash -p curl pcre common-updater-scripts jq gnused
83 LATEST_TAG=$(curl https://api.github.com/repos/eclipse/lemminx/tags | \
84 jq -r '[.[] | select(.name | test("^[0-9]"))] | sort_by(.name | split(".") |
85 map(tonumber)) | reverse | .[0].name')
86 update-source-version lemminx "$LATEST_TAG"
87 sed -i '0,/mvnHash *= *"[^"]*"/{s/mvnHash = "[^"]*"/mvnHash = ""/}' ${lemminx}
89 echo -e "\nFetching all mvn dependencies to calculate the mvnHash. This may take a while ..."
90 nix-build -A lemminx.fetchedMavenDeps 2> lemminx-stderr.log || true
92 NEW_MVN_HASH=$(cat lemminx-stderr.log | grep "got:" | awk '{print ''$2}')
94 # escaping double quotes looks ugly but is needed for variable substitution
95 # use # instead of / as separator because the sha256 might contain the / character
96 sed -i "0,/mvnHash *= *\"[^\"]*\"/{s#mvnHash = \"[^\"]*\"#mvnHash = \"$NEW_MVN_HASH\"#}" ${lemminx}
100 description = "XML Language Server";
101 homepage = "https://github.com/eclipse/lemminx";
102 license = licenses.epl20;
103 maintainers = with maintainers; [ tricktron ];