13 jre = jre_minimal.override {
22 maven.buildMavenPackage rec {
26 src = fetchFromGitHub {
30 hash = "sha256-VWYTkYlPziNRyxHdvIWVuDlABpKdzhC/F6BUBj/opks=";
31 # Lemminx reads this git information at runtime from a git.properties
32 # file on the classpath
35 cat > $out/org.eclipse.lemminx/src/main/resources/git.properties << EOF
36 git.build.version=${version}
37 git.commit.id.abbrev=$(git -C $out rev-parse --short HEAD)
38 git.commit.message.short=$(git -C $out log -1 --pretty=format:%s)
45 manualMvnArtifacts = [
46 "org.apache.maven.surefire:surefire-junit-platform:3.1.2"
47 "org.junit.platform:junit-platform-launcher:1.10.0"
50 mvnJdk = jdk_headless;
51 mvnHash = "sha256-jIvYUATcNUZZmZcXbUMqyHGX4CYiXqL0jkji+zrCYJY=";
55 # disable gitcommitid plugin which needs a .git folder which we
57 mvnDepsParameters = "-Dmaven.gitcommitid.skip=true";
59 # disable failing tests which either need internet access or are flaky
60 mvnParameters = lib.escapeShellArgs [
61 "-Dmaven.gitcommitid.skip=true"
62 "-Dtest=!XMLValidationCommandTest,
63 !XMLValidationExternalResourcesBasedOnDTDTest,
64 !XMLSchemaPublishDiagnosticsTest,
66 !XMLValidationExternalResourcesBasedOnXSDTest,
68 !XMLSchemaCompletionExtensionsTest,
69 !XMLSchemaDiagnosticsTest,
70 !MissingChildElementCodeActionTest,
71 !XSDValidationExternalResourcesTest,
72 !DocumentLifecycleParticipantTest,
73 !DTDValidationExternalResourcesTest"
79 mkdir -p $out/bin $out/share
80 install -Dm644 org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar \
83 makeWrapper ${jre}/bin/java $out/bin/lemminx \
84 --add-flags "-jar $out/share/org.eclipse.lemminx-uber.jar"
89 nativeBuildInputs = [ makeWrapper ];
91 passthru.updateScript = writeScript "update-lemminx" ''
92 #!/usr/bin/env nix-shell
93 #!nix-shell -i bash -p curl pcre common-updater-scripts jq gnused
96 LATEST_TAG=$(curl https://api.github.com/repos/eclipse/lemminx/tags | \
97 jq -r '[.[] | select(.name | test("^[0-9]"))] | sort_by(.name | split(".") |
98 map(tonumber)) | reverse | .[0].name')
99 update-source-version lemminx "$LATEST_TAG"
100 sed -i '0,/mvnHash *= *"[^"]*"/{s/mvnHash = "[^"]*"/mvnHash = ""/}' ${lemminx}
102 echo -e "\nFetching all mvn dependencies to calculate the mvnHash. This may take a while ..."
103 nix-build -A lemminx.fetchedMavenDeps 2> lemminx-stderr.log || true
105 NEW_MVN_HASH=$(cat lemminx-stderr.log | grep "got:" | awk '{print ''$2}')
106 rm lemminx-stderr.log
107 # escaping double quotes looks ugly but is needed for variable substitution
108 # use # instead of / as separator because the sha256 might contain the / character
109 sed -i "0,/mvnHash *= *\"[^\"]*\"/{s#mvnHash = \"[^\"]*\"#mvnHash = \"$NEW_MVN_HASH\"#}" ${lemminx}
113 description = "XML Language Server";
114 mainProgram = "lemminx";
115 homepage = "https://github.com/eclipse/lemminx";
116 license = licenses.epl20;
117 maintainers = with maintainers; [ tricktron ];