55 jdk_headless ,
66 jre_minimal ,
77 maven ,
8- writeScript ,
9- lemminx ,
8+ writeShellApplication ,
9+ curl ,
10+ pcre ,
11+ common-updater-scripts ,
12+ jq ,
13+ gnused ,
1014} :
1115
1216let
2125in
2226maven . buildMavenPackage rec {
2327 pname = "lemminx" ;
24- version = "0.27 .0" ;
28+ version = "0.29 .0" ;
2529
2630 src = fetchFromGitHub {
2731 owner = "eclipse" ;
2832 repo = "lemminx" ;
2933 rev = version ;
30- hash = "sha256-VWYTkYlPziNRyxHdvIWVuDlABpKdzhC/F6BUBj/opks =" ;
34+ hash = "sha256-joeaN0Q/XxEWa7UX/LVSWIAb8GGTfVUE+NudedbBLBI =" ;
3135 # Lemminx reads this git information at runtime from a git.properties
3236 # file on the classpath
3337 leaveDotGit = true ;
@@ -42,21 +46,11 @@ maven.buildMavenPackage rec {
4246 '' ;
4347 } ;
4448
45- manualMvnArtifacts = [
46- "org.apache.maven.surefire:surefire-junit-platform:3.1.2"
47- "org.junit.platform:junit-platform-launcher:1.10.0"
48- ] ;
49-
5049 mvnJdk = jdk_headless ;
51- mvnHash = "sha256-jIvYUATcNUZZmZcXbUMqyHGX4CYiXqL0jkji+zrCYJY=" ;
52-
53- buildOffline = true ;
50+ mvnHash = "sha256-7RLZSlmXnjl9vwvCf/Z+mc2906JtuUbjjkRGVMC1En8=" ;
5451
55- # disable gitcommitid plugin which needs a .git folder which we
56- # don't have
57- mvnDepsParameters = "-Dmaven.gitcommitid.skip=true" ;
58-
59- # disable failing tests which either need internet access or are flaky
52+ # Disable gitcommitid plugin which needs a .git folder which we don't have.
53+ # Disable failing tests which either need internet access or are flaky.
6054 mvnParameters = lib . escapeShellArgs [
6155 "-Dmaven.gitcommitid.skip=true"
6256 "-Dtest=!XMLValidationCommandTest,
@@ -70,15 +64,16 @@ maven.buildMavenPackage rec {
7064 !MissingChildElementCodeActionTest,
7165 !XSDValidationExternalResourcesTest,
7266 !DocumentLifecycleParticipantTest,
73- !DTDValidationExternalResourcesTest"
67+ !DTDValidationExternalResourcesTest,
68+ !DTDHoverExtensionsTest,
69+ !CacheResourcesManagerTest"
7470 ] ;
7571
7672 installPhase = ''
7773 runHook preInstall
7874
7975 mkdir -p $out/bin $out/share
80- install -Dm644 org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar \
81- $out/share
76+ install -Dm644 org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar $out/share
8277
8378 makeWrapper ${ jre } /bin/java $out/bin/lemminx \
8479 --add-flags "-jar $out/share/org.eclipse.lemminx-uber.jar"
@@ -88,26 +83,44 @@ maven.buildMavenPackage rec {
8883
8984 nativeBuildInputs = [ makeWrapper ] ;
9085
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
94- set -eu -o pipefail
95-
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 }
101-
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
104-
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 }
110- '' ;
86+ passthru = {
87+ updateScript =
88+ let
89+ pkgFile = builtins . toString ./package.nix ;
90+ in
91+ lib . getExe ( writeShellApplication {
92+ name = "update-${ pname } " ;
93+ runtimeInputs = [
94+ curl
95+ pcre
96+ common-updater-scripts
97+ jq
98+ gnused
99+ ] ;
100+ text = ''
101+ if [ -z "'' ${GITHUB_TOKEN:-}" ]; then
102+ echo "no GITHUB_TOKEN provided - you could meet API request limiting" >&2
103+ fi
104+
105+ LATEST_TAG=$(curl -H "Accept: application/vnd.github+json" \
106+ '' ${GITHUB_TOKEN:+-H "Authorization: bearer $GITHUB_TOKEN"} \
107+ -Lsf https://api.github.com/repos/${ src . owner } /${ src . repo } /tags | \
108+ jq -r '[.[] | select(.name | test("^[0-9]"))] | sort_by(.name | split(".") |
109+ map(tonumber)) | reverse | .[0].name')
110+ update-source-version ${ pname } "$LATEST_TAG"
111+ sed -i '0,/mvnHash *= *"[^"]*"/{s/mvnHash = "[^"]*"/mvnHash = ""/}' ${ pkgFile }
112+
113+ echo -e "\nFetching all mvn dependencies to calculate the mvnHash. This may take a while ..."
114+ nix-build -A ${ pname } .fetchedMavenDeps 2> ${ pname } -stderr.log || true
115+
116+ NEW_MVN_HASH=$(grep "got:" ${ pname } -stderr.log | awk '{print '' $2}')
117+ rm ${ pname } -stderr.log
118+ # escaping double quotes looks ugly but is needed for variable substitution
119+ # use # instead of / as separator because the sha256 might contain the / character
120+ sed -i "0,/mvnHash *= *\"[^\"]*\"/{s#mvnHash = \"[^\"]*\"#mvnHash = \"$NEW_MVN_HASH\"#}" ${ pkgFile }
121+ '' ;
122+ } ) ;
123+ } ;
111124
112125 meta = with lib ; {
113126 description = "XML Language Server" ;
0 commit comments