eppleton commented on code in PR #375:
URL: 
https://github.com/apache/netbeans-mavenutils-nbm-maven-plugin/pull/375#discussion_r4506632552


##########
nb-repository-plugin/src/main/java/org/apache/netbeans/nbm/repository/PopulateRepositoryMojo.java:
##########
@@ -962,13 +971,61 @@ private File createClusterProject(Artifact cluster, 
Collection<ModuleWrapper> mo
         return null;
     }
 
+    private File createCatalog(Artifact catalog, Collection<ModuleWrapper> 
mods) throws MojoExecutionException {
+        File xml = null;
+        try {
+            xml = Files.createTempFile("maven-catalog", ".xml.gz").toFile();
+            xml.setLastModified(0L); // always out of date
+
+            Project project = new Project();
+            MakeUpdateDesc generateCatalogTask = new MakeUpdateDesc();
+            generateCatalogTask.setProject(project);
+            generateCatalogTask.setDesc(xml);

Review Comment:
   As far as I can see, `distBase` is never set on `MakeUpdateDesc`, so each 
`distribution` attribute is copied verbatim from the NBM's `Info/info.xml`. In 
your `javafx-dev-SNAPSHOT.xml.gz` sample all seven entries point to the old 
build server, e.g. 
`http://deadlock.netbeans.org/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/javafx/org-netbeans-modules-maven-htmlui.nbm`.
   
   In the repository the NBM sits at 
`…/modules/<artifactId>/<version>/<artifactId>-<version>.nbm`, so a client 
reading this catalog can't download anything yet. I know you mentioned it still 
needs polishing. I'm noting it here because it decides between a relative path 
(from `cluster/<name>/<version>/` up to `modules/…`) and the `m2:` URL that 
@neilcsmith-net suggested. Whichever we choose, it would be good if 
`testInstallWithCluster` checked the `distribution` value and not only that the 
`.xml.gz` exists.



##########
nb-repository-plugin/src/main/java/org/apache/netbeans/nbm/repository/PopulateRepositoryMojo.java:
##########
@@ -962,13 +971,61 @@ private File createClusterProject(Artifact cluster, 
Collection<ModuleWrapper> mo
         return null;
     }
 
+    private File createCatalog(Artifact catalog, Collection<ModuleWrapper> 
mods) throws MojoExecutionException {
+        File xml = null;
+        try {
+            xml = Files.createTempFile("maven-catalog", ".xml.gz").toFile();
+            xml.setLastModified(0L); // always out of date
+
+            Project project = new Project();
+            MakeUpdateDesc generateCatalogTask = new MakeUpdateDesc();
+            generateCatalogTask.setProject(project);
+            generateCatalogTask.setDesc(xml);
+            File parentDir = null;
+            OrSelector allFiles = new OrSelector();
+            allFiles.setProject(project);
+            for (var m : mods) {
+                File nbm = m.getNbm();
+                getLog().info("file: " + nbm + " for " + m.getArtifact() + " 
file: " + m.getFile());
+                if (nbm == null) {
+                    getLog().warn("No NBM for " + m);
+                    continue;
+                }
+                if (parentDir == null) {
+                    parentDir = nbm.getParentFile();
+                } else {
+                    if (!parentDir.equals(nbm.getParentFile())) {
+                        throw new MojoExecutionException("All NBM files must 
be in the same directory " + nbm.getParentFile() + " vs. " + parentDir);
+                    }
+                }
+                FilenameSelector selector = new FilenameSelector();
+                selector.setProject(project);
+                selector.setName(nbm.getName());
+                allFiles.add(selector);
+            }
+
+            FileSet files = new FileSet();
+            files.setProject(project);
+            files.setDir(parentDir);

Review Comment:
   I think this is a regression for `populate` runs without 
`netbeansNbmDirectory`. `defineCluster` defaults to `true`, so with 
`forcedVersion` set but no NBM directory every module has `getNbm() == null`. 
`parentDir` then stays `null`, and Ant fails with `BuildException: No directory 
specified for FileSet.` Because only `IOException` is caught, it surfaces as a 
raw Ant exception and the whole goal fails. Before this change the same call 
just produced the cluster POMs.
   
   I reproduced it locally by running the setup from `testInstallWithCluster` 
with `netbeansNbmDirectory` left unset. NetBeans' own `ant maven-install` 
(apache/netbeans#9779) always passes an NBM directory, but platform users may 
not. The same applies to a cluster that consists only of external/OSGi modules. 
Skipping the catalog (with a log message) when a cluster has no NBMs would keep 
the old behaviour.



##########
pom.xml:
##########
@@ -283,6 +283,7 @@
                     <configuration>
                         <showDeprecation>true</showDeprecation>
                         <release>${jdkbaseline}</release>
+                        <testRelease>21</testRelease>

Review Comment:
   CI builds on JDK 11, 17, 21 and 25 (`.github/workflows/ci.yml`), and Jenkins 
uses `jdk_11_latest`. With JDK 17, test compilation fails with `error: release 
version 21 not supported`. No checks have run on this PR yet, so it hasn't 
shown up there. It seems to be needed only for the text block and `var` in the 
new test. Rewriting those would keep the tests on `${jdkbaseline}`, unless we 
deliberately want to drop JDK < 21 from the build matrix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to