This is an automated email from the ASF dual-hosted git repository.

skygo pushed a commit to branch release112
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/release112 by this push:
     new d9f098a  #3443 to release112
     new a28bc97  Merge pull request #3532 from ebarboni/release112api
d9f098a is described below

commit d9f098ad1cb2e77225026489c960db1f067c2aa9
Author: Eric Barboni <sk...@apache.org>
AuthorDate: Fri Jan 28 18:28:45 2022 +0100

    #3443 to release112
---
 .../org/netbeans/nbbuild/ReleaseJsonProperties.java     | 17 +++++++++++++----
 nbbuild/javadoctools/jsonhelp.xsl                       | 15 ++++-----------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
index d144b9a..3a0bd09 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
@@ -114,6 +114,7 @@ public class ReleaseJsonProperties extends Task {
         } catch (ParseException | IOException ex) {
             throw new BuildException(ex);
         }
+
         // sort all information
         Collections.sort(ri);
         // build a sorted xml
@@ -133,11 +134,12 @@ public class ReleaseJsonProperties extends Task {
         }
 
         if (requiredbranchinfo == null) {
-            throw new BuildException("No Release Information found for branch 
'" + branch + "', update json file section");
+            throw new BuildException("No Release Information found for branch 
'" + branch + "', update json file section with ant -Dneedjsondownload=true");
         }
         List<String> updateValues = new ArrayList<>();
         for (ReleaseInfo releaseInfo : ri) {
-            if (releaseInfo.position < requiredbranchinfo.position) {
+            // take previous version of Apache NetBeans only if published, 
need for scan for old NetBeans version
+            if (releaseInfo.position < requiredbranchinfo.position && 
releaseInfo.publishapi ) {
                 updateValues.add(releaseInfo.version);
             }
         }
@@ -191,7 +193,7 @@ public class ReleaseJsonProperties extends Task {
             throw new BuildException("Properties File for release cannot be 
created");
         }
 
-        log("Writing releasinfo file " + xmlFile);
+        log("Writing release info file " + xmlFile);
 
         xmlFile.getParentFile().mkdirs();
         try (OutputStream config = new FileOutputStream(xmlFile)) {
@@ -218,6 +220,7 @@ public class ReleaseJsonProperties extends Task {
         releasesxml.setAttribute("position", 
Integer.toString(releaseInfo.position));
         releasesxml.setAttribute("version", releaseInfo.version);
         releasesxml.setAttribute("apidocurl", releaseInfo.apidocurl);
+        releasesxml.setAttribute("pubapidoc", 
Boolean.toString(releaseInfo.publishapi));
     }
 
     private ReleaseInfo manageRelease(String key, Object arelease) {
@@ -246,6 +249,8 @@ public class ReleaseJsonProperties extends Task {
         ri.setJavaApiDocurl((String) getJSONInfo(jsonrelease, "jdk_apidoc", 
"Apidoc: javadoc for java jdk"));
         ri.setUpdateUrl((String) getJSONInfo(jsonrelease, "update_url", 
"Update catalog"));
         ri.setPluginsUrl((String) getJSONInfo(jsonrelease, "plugin_url", 
"Plugin URL"));
+        //
+        ri.setPublishApi(Boolean.parseBoolean((String) 
getJSONInfo(jsonrelease, "publish_apidoc", "Should we publish this Apidoc")));
         // optional section
         JSONObject milestone = (JSONObject) jsonrelease.get("milestones");
         if (milestone != null) {
@@ -281,7 +286,6 @@ public class ReleaseJsonProperties extends Task {
 
     private Object getJSONInfo(JSONObject json, String key, String info) {
         Object result = json.get(key);
-        //log("Retriving " + key);
         if (result == null) {
             throw new BuildException("Cannot retrieve key " + key + ", this is 
for" + info);
         }
@@ -338,6 +342,7 @@ public class ReleaseJsonProperties extends Task {
         private String javaapidocurl;
         private String updateurl;
         private String pluginsurl;
+        private boolean publishapi;
         private List<MileStone> milestones;
 
         public ReleaseInfo(String key) {
@@ -408,6 +413,10 @@ public class ReleaseJsonProperties extends Task {
             this.milestones.add(milestone);
         }
 
+        private void setPublishApi(boolean publishok) {
+            this.publishapi = publishok;
+        }
+
     }
 
 }
diff --git a/nbbuild/javadoctools/jsonhelp.xsl 
b/nbbuild/javadoctools/jsonhelp.xsl
index 3b71e20..818c118 100644
--- a/nbbuild/javadoctools/jsonhelp.xsl
+++ b/nbbuild/javadoctools/jsonhelp.xsl
@@ -263,28 +263,21 @@ committed to the repository for legal reasons. You need 
to download it:
                 <xsl:for-each select="document($releaseinfo)//release">
                     <xsl:sort data-type="number" select="@position" 
order="descending" />
                     <xsl:choose>
-                        <xsl:when test="$currentversion = @position">
+                        <xsl:when test="$currentversion = @position  and 
@pubapidoc='true'  ">
                             <span>
                                 <xsl:value-of select="@version"/>
                             </span>
                         </xsl:when>
-                        <xsl:otherwise>
+                        <xsl:when test="$currentversion != @position  and 
@pubapidoc='true'  ">
                             <xsl:element name="a">
                                 <xsl:attribute 
name="class">apacheversion</xsl:attribute>
                                 <xsl:attribute name="href">
                                     <xsl:value-of 
select="@apidocurl"/><xsl:text>/</xsl:text><xsl:value-of 
select="$menukey"/><xsl:text>.html</xsl:text></xsl:attribute>
                                 <xsl:value-of select="@version"/>
-                            </xsl:element>                 
-                        </xsl:otherwise>
+                            </xsl:element>
+                        </xsl:when>
                     </xsl:choose>
-                    
                 </xsl:for-each>
-                <xsl:element name="a">
-                    <xsl:attribute name="href">
-                        <xsl:text>http://bits.netbeans.org/</xsl:text>
-                    </xsl:attribute>
-                    8.2 and previous
-                </xsl:element>           
             </div>
         </div>
     </xsl:template>

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

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

Reply via email to