Skip to content

Commit

Permalink
Merging with master that contains #7013
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaroslav Tulach committed Feb 11, 2024
2 parents 8838cff + f586ed1 commit 7b0fe91
Show file tree
Hide file tree
Showing 85 changed files with 692 additions and 1,583 deletions.
24 changes: 19 additions & 5 deletions .github/scripts/BinariesListUpdates.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.LongAdder;
import java.util.stream.Stream;
import org.apache.maven.search.api.Record;
import org.apache.maven.search.api.SearchRequest;
import org.apache.maven.search.backend.smo.SmoSearchBackend;
import org.apache.maven.search.backend.smo.SmoSearchBackendFactory;
import org.apache.maven.artifact.versioning.ComparableVersion;

import static java.util.FormatProcessor.FMT;
import static org.apache.maven.search.api.MAVEN.ARTIFACT_ID;
Expand All @@ -45,6 +45,10 @@
*/
public class BinariesListUpdates {

private static final LongAdder updates = new LongAdder();
private static final LongAdder checks = new LongAdder();
private static final LongAdder skips = new LongAdder();

// java --enable-preview --source 22 --class-path "lib/*" BinariesListUpdates.java /path/to/netbeans/project
public static void main(String[] args) throws IOException, InterruptedException {

Expand All @@ -63,6 +67,8 @@ public static void main(String[] args) throws IOException, InterruptedException
}
});
}

System.out.println(STR."checked \{checks.sum()} dependencies, found \{updates.sum()} updates, skipped \{skips.sum()}." );
}

private static void checkDependencies(Path path, SmoSearchBackend backend) throws IOException, InterruptedException {
Expand Down Expand Up @@ -91,15 +97,18 @@ private static void checkDependencies(Path path, SmoSearchBackend backend) throw
latest = queryLatestVersion(backend, gid, aid, classifier.split("@")[0]);
gac = String.join(":", gid, aid, classifier);
}
if (!version.equals(latest)) {
if (latest != null && !version.equals(latest)) {
System.out.println(FMT." %-50s\{gac} \{version} -> \{latest}");
updates.increment();
}
} catch (IOException | InterruptedException ex) {
throw new RuntimeException(ex);
}
} else {
System.out.println(" skip: '"+l+"'");
skips.increment();
}
checks.increment();
});
}
System.out.println();
Expand All @@ -119,8 +128,13 @@ private static String queryLatestVersion(SmoSearchBackend backend, String gid, S
private static String queryLatestVersion(SmoSearchBackend backend, SearchRequest request) throws IOException, InterruptedException {
requests.acquire();
try {
List<Record> result = backend.search(request).getPage();
return !result.isEmpty() ? result.getFirst().getValue(VERSION) : null;
return backend.search(request).getPage().stream()
.map(r -> r.getValue(VERSION))
.filter(v -> !v.contains("alpha") && !v.contains("beta"))
.filter(v -> !v.contains("M") && !v.contains("m") && !v.contains("B") && !v.contains("b") && !v.contains("ea"))
.limit(5)
.max((v1, v2) -> new ComparableVersion(v1).compareTo(new ComparableVersion(v2)))
.orElse(null);
} finally {
requests.release();
}
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/dependency-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ jobs:
timeout-minutes: 20
steps:

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '22-ea'
distribution: 'zulu'

- name: Checkout ${{ github.ref }} ( ${{ github.sha }} )
uses: actions/checkout@v4
with:
Expand All @@ -54,11 +48,11 @@ jobs:

- name: Check Dependencies
run: |
mvn -q dependency:get -Dartifact=org.apache.maven.indexer:search-backend-smo:7.1.1
mvn -q dependency:copy -Dartifact=org.apache.maven.indexer:search-backend-smo:7.1.1 -DoutputDirectory=./lib
mvn -q dependency:copy -Dartifact=org.apache.maven.indexer:search-api:7.1.1 -DoutputDirectory=./lib
mvn -q dependency:copy -Dartifact=com.google.code.gson:gson:2.10.1 -DoutputDirectory=./lib
mvn -q dependency:copy -Dartifact=org.apache.maven:maven-artifact:3.9.6 -DoutputDirectory=./lib
echo "<pre>" >> $GITHUB_STEP_SUMMARY
java --enable-preview --source 22 -cp "lib/*" .github/scripts/BinariesListUpdates.java ./ | tee -a $GITHUB_STEP_SUMMARY
$JAVA_HOME_21_X64/bin/java --enable-preview --source 21 -cp "lib/*" .github/scripts/BinariesListUpdates.java ./ | tee -a $GITHUB_STEP_SUMMARY
echo "</pre>" >> $GITHUB_STEP_SUMMARY
rm -Rf lib
Loading

0 comments on commit 7b0fe91

Please sign in to comment.