Skip to content

Commit

Permalink
Merge pull request #3529 from ebarboni/release110api
Browse files Browse the repository at this point in the history
#3443 to release110
  • Loading branch information
ebarboni committed Jan 28, 2022
2 parents 7e0d274 + 573420b commit 471733f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
17 changes: 13 additions & 4 deletions nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
Expand Up @@ -114,6 +114,7 @@ public void execute() throws BuildException {
} catch (ParseException | IOException ex) {
throw new BuildException(ex);
}

// sort all information
Collections.sort(ri);
// build a sorted xml
Expand All @@ -133,11 +134,12 @@ public void execute() throws BuildException {
}

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);
}
}
Expand Down Expand Up @@ -191,7 +193,7 @@ public void execute() throws BuildException {
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)) {
Expand All @@ -218,6 +220,7 @@ private void populatexml(Element releasesxml, ReleaseInfo releaseInfo) throws DO
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) {
Expand Down Expand Up @@ -246,6 +249,8 @@ private ReleaseInfo manageRelease(String key, Object arelease) {
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) {
Expand Down Expand Up @@ -281,7 +286,6 @@ private static String makeAtomDate(LocalDateTime date) {

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);
}
Expand Down Expand Up @@ -338,6 +342,7 @@ private static class ReleaseInfo implements Comparable<ReleaseInfo> {
private String javaapidocurl;
private String updateurl;
private String pluginsurl;
private boolean publishapi;
private List<MileStone> milestones;

public ReleaseInfo(String key) {
Expand Down Expand Up @@ -408,6 +413,10 @@ private void addMileStone(MileStone milestone) {
this.milestones.add(milestone);
}

private void setPublishApi(boolean publishok) {
this.publishapi = publishok;
}

}

}
15 changes: 4 additions & 11 deletions nbbuild/javadoctools/jsonhelp.xsl
Expand Up @@ -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>
Expand Down

0 comments on commit 471733f

Please sign in to comment.