Skip to content

Commit

Permalink
Merge branch 'master' into ide.remote
Browse files Browse the repository at this point in the history
  • Loading branch information
jlahoda committed Apr 28, 2024
2 parents f0ba412 + 97fd224 commit 8286650
Show file tree
Hide file tree
Showing 5,834 changed files with 205,324 additions and 111,073 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ contact_links:
url: https://github.com/apache/netbeans/discussions/
about: Ask a question or request support for using Apache NetBeans.
- name: Mailing lists
url: https://netbeans.apache.org/community/mailing-lists.html
url: https://netbeans.apache.org/community/mailing-lists
about: Subscribe to the users, dev or announce mailing lists for Apache NetBeans.
11 changes: 5 additions & 6 deletions .github/ISSUE_TEMPLATE/netbeans_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ body:
Latest releases are always available from https://netbeans.apache.org/download/
multiple: false
options:
- "Apache NetBeans 20"
# - "Apache NetBeans 21 release candidate"
- "Apache NetBeans 21"
- "Apache NetBeans 22 release candidate"
- "Apache NetBeans latest daily build"
validations:
required: true
Expand Down Expand Up @@ -73,13 +73,12 @@ body:
multiple: false
options:
- "No / Don't know"
- "Apache NetBeans 21"
- "Apache NetBeans 20"
- "Apache NetBeans 19"
- "Apache NetBeans 18"
- "Apache NetBeans 17"
- "Apache NetBeans 16"
- "Apache NetBeans 15"
- "Apache NetBeans 14"
- "Apache NetBeans 13 or earlier"
- "Apache NetBeans 16 or earlier"
validations:
required: true
- type: input
Expand Down
1 change: 0 additions & 1 deletion .github/actions/delete-artifact
Submodule delete-artifact deleted from 54ab54
2 changes: 1 addition & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ changelog:
labels:
- 'VSCode Extension'

- title: 'Maintanance'
- title: 'Maintenance'
labels:
- 'Code cleanup'
- 'Upgrade Library'
Expand Down
143 changes: 143 additions & 0 deletions .github/scripts/BinariesListUpdates.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.LongAdder;
import java.util.stream.Stream;
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;
import static org.apache.maven.search.api.MAVEN.CLASSIFIER;
import static org.apache.maven.search.api.MAVEN.GROUP_ID;
import static org.apache.maven.search.api.MAVEN.VERSION;
import static org.apache.maven.search.api.request.BooleanQuery.and;
import static org.apache.maven.search.api.request.FieldQuery.fieldQuery;

/**
* Scans for binaries-list files and checks if newer versions of the declared dependencies exist.
*
* <pre>org.apache.maven.indexer:search-backend-smo</pre> must be in classpath.
*
* @author mbien
*/
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 {

if (args.length != 1 || Files.notExists(Path.of(args[0]).resolve("README.md"))) {
throw new IllegalArgumentException("path to netbeans folder expected");
}

Path path = Path.of(args[0]);
try (Stream<Path> dependencyFiles = Files.find(path, 10, (p, a) -> p.getFileName().toString().equals("binaries-list"));
SmoSearchBackend backend = SmoSearchBackendFactory.createDefault()) {
dependencyFiles.sorted().forEach(p -> {
try {
checkDependencies(p, backend);
} catch (IOException | InterruptedException ex) {
throw new RuntimeException(ex);
}
});
}

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 {
System.out.println(path);
try (Stream<String> lines = Files.lines(path).parallel()) {

// 321C614F85F1DEA6BB08C1817C60D53B7F3552FD org.fusesource.jansi:jansi:2.4.0
lines.filter(l -> !l.startsWith("#"))
.filter(l -> l.length() > 40 && l.charAt(40) == ' ')
.map(l -> l.substring(40+1))
.forEach(l -> {

String[] comp = l.split("\\:");
if (comp.length == 3 || comp.length == 4) {
String gid = comp[0].strip();
String aid = comp[1].strip();
String version = comp[2].strip();
String classifier = comp.length == 4 ? comp[3].strip() : null;
try {
String gac;
String latest;
if (classifier == null) {
latest = queryLatestVersion(backend, gid, aid);
gac = String.join(":", gid, aid);
} else {
latest = queryLatestVersion(backend, gid, aid, classifier.split("@")[0]);
gac = String.join(":", gid, aid, classifier);
}
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();
}

private static String queryLatestVersion(SmoSearchBackend backend, String gid, String aid) throws IOException, InterruptedException {
return queryLatestVersion(backend, new SearchRequest(and(fieldQuery(GROUP_ID, gid), fieldQuery(ARTIFACT_ID, aid))));
}

private static String queryLatestVersion(SmoSearchBackend backend, String gid, String aid, String classifier) throws IOException, InterruptedException {
return queryLatestVersion(backend, new SearchRequest(and(fieldQuery(GROUP_ID, gid), fieldQuery(ARTIFACT_ID, aid), fieldQuery(CLASSIFIER, classifier))));
}

// reduce concurrency level if needed
private final static Semaphore requests = new Semaphore(4);

private static String queryLatestVersion(SmoSearchBackend backend, SearchRequest request) throws IOException, InterruptedException {
requests.acquire();
try {
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();
}
}

}
58 changes: 58 additions & 0 deletions .github/workflows/dependency-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: NetBeans Dependency Checks

on:
# pull_request:
# Allows you to run this workflow manually from the Actions tab in GitHub UI
workflow_dispatch:

# cancel other workflow run in the same head-base group if it exists
concurrency:
group: dep-checker-${{ github.head_ref || github.run_id }}-${{ github.base_ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:

base-build:
name: Check Dependencies
runs-on: ubuntu-latest
timeout-minutes: 20
steps:

- name: Checkout ${{ github.ref }} ( ${{ github.sha }} )
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: false
show-progress: false

- name: Check Dependencies
run: |
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_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 8286650

Please sign in to comment.