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