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

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


The following commit(s) were added to refs/heads/master by this push:
     new 87528d5  build branding (#1411)
87528d5 is described below

commit 87528d5fbe98d2d4d91779e9bb3d1d10884cbf3c
Author: Eric Barboni <sk...@apache.org>
AuthorDate: Wed Sep 18 17:25:28 2019 +0200

    build branding (#1411)
    
    * build modification
    
    * branding by build system
    
    * typo in text
    
    * Work with milestone
    
    * no hash in release means dev
    
    * Add echo to debug on travis
    
    * Work around for PR
    
    * add conditional properties to override url: metabuild.jsonurl
    
    * Remove {$netbeans.hash.code} from URL_Distribution
    
    Remove {$netbeans.hash.code} from URL_Distribution and allow to be 
specified in metabuild.DistributionURL instead.
---
 nb/ide.branding/build.xml                          |  21 +-
 .../org/netbeans/core/startup/Bundle_nb.properties |   2 +-
 .../core/windows/view/ui/Bundle_nb.properties      |   4 +-
 nb/ide.launcher/netbeans.conf                      |   6 +-
 nb/updatecenters/build.xml                         |   9 +-
 .../updatecenters/resources/Bundle.properties      |   5 +-
 nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java    |   2 +-
 .../org/netbeans/nbbuild/ParseGitBranch.java       |  80 ++++
 .../netbeans/nbbuild/ReleaseJsonProperties.java    | 401 +++++++++++++++++++++
 .../netbeans/nbbuild/SetApidocClustersConfig.java  |  54 +++
 nbbuild/build.properties                           |  16 +-
 nbbuild/build.xml                                  |  92 ++++-
 12 files changed, 666 insertions(+), 26 deletions(-)

diff --git a/nb/ide.branding/build.xml b/nb/ide.branding/build.xml
index 223ce17..18d73ed 100644
--- a/nb/ide.branding/build.xml
+++ b/nb/ide.branding/build.xml
@@ -35,8 +35,16 @@ Contributor(s): Vincent Brabant, Maxym Mykhalchuk
       <fileset dir="release-toplevel"/>
     </copy>
     
+    <!-- copy to build folder to do replace -->
+    <delete dir="${build.dir}/branding/core.startup" quiet="true" />
+    <copy todir="${build.dir}/branding/core.startup">
+        <fileset dir="core.startup"/>
+    </copy>
+    <replace 
file="${build.dir}/branding/core.startup/src/org/netbeans/core/startup/Bundle_nb.properties"
 value="defaultvalue" 
propertyFile="${nb_all}/nbbuild/build/netbeansrelease.properties">
+        <replacefilter token="@@metabuild.ComputedSplashVersion@@" 
property="metabuild.ComputedSplashVersion"/>
+    </replace>
     <locjar warnMissingDir="true"
-      basedir="core.startup/src"
+      basedir="${build.dir}/branding/core.startup/src"
       jarfile="${cluster}/core/core.jar">
       <branding name="nb"/>
     </locjar>
@@ -52,9 +60,16 @@ Contributor(s): Vincent Brabant, Maxym Mykhalchuk
       jarfile="${cluster}/modules/org-netbeans-core-netigso.jar">
       <branding name="nb"/>
     </locjar>
-
+    
+    <delete dir="${build.dir}/branding/core.windows" quiet="true" />
+    <copy todir="${build.dir}/branding/core.windows">
+        <fileset dir="core.windows"/>
+    </copy>
+    <replace 
file="${build.dir}/branding/core.windows/src/org/netbeans/core/windows/view/ui/Bundle_nb.properties"
 value="defaultvalue" 
propertyFile="${nb_all}/nbbuild/build/netbeansrelease.properties">
+        <replacefilter token="@@metabuild.ComputedTitleVersion@@" 
property="metabuild.ComputedTitleVersion"/>
+    </replace>
     <locjar warnMissingDir="true"
-      basedir="core.windows/src"
+      basedir="${build.dir}/branding/core.windows/src"
       jarfile="${cluster}/modules/org-netbeans-core-windows.jar">
       <branding name="nb"/>
     </locjar>
diff --git 
a/nb/ide.branding/core.startup/src/org/netbeans/core/startup/Bundle_nb.properties
 
b/nb/ide.branding/core.startup/src/org/netbeans/core/startup/Bundle_nb.properties
index 0dc16b6..2630e07 100644
--- 
a/nb/ide.branding/core.startup/src/org/netbeans/core/startup/Bundle_nb.properties
+++ 
b/nb/ide.branding/core.startup/src/org/netbeans/core/startup/Bundle_nb.properties
@@ -62,7 +62,7 @@ SplashVersionTextHorizontalAlignment=right
 ###################
 
 LBL_splash_window_title=Starting Apache NetBeans IDE
-currentVersion=Apache NetBeans IDE Dev (Build {0})
+currentVersion=Apache NetBeans IDE @@metabuild.ComputedSplashVersion@@
 
 MSG_warning=NetBeans IDE - Warning
 MSG_info=NetBeans IDE - Information
diff --git 
a/nb/ide.branding/core.windows/src/org/netbeans/core/windows/view/ui/Bundle_nb.properties
 
b/nb/ide.branding/core.windows/src/org/netbeans/core/windows/view/ui/Bundle_nb.properties
index 02d3790..301d0a9 100644
--- 
a/nb/ide.branding/core.windows/src/org/netbeans/core/windows/view/ui/Bundle_nb.properties
+++ 
b/nb/ide.branding/core.windows/src/org/netbeans/core/windows/view/ui/Bundle_nb.properties
@@ -17,5 +17,5 @@
 
 # {0} build number
 # {1} project name
-CTL_MainWindow_Title={1} - Apache NetBeans IDE Dev {0}
-CTL_MainWindow_Title_No_Project=Apache NetBeans IDE Dev {0}
+CTL_MainWindow_Title={1} - Apache NetBeans IDE 
@@metabuild.ComputedTitleVersion@@
+CTL_MainWindow_Title_No_Project=Apache NetBeans IDE 
@@metabuild.ComputedTitleVersion@@
diff --git a/nb/ide.launcher/netbeans.conf b/nb/ide.launcher/netbeans.conf
index 171d19f..d5681a6 100644
--- a/nb/ide.launcher/netbeans.conf
+++ b/nb/ide.launcher/netbeans.conf
@@ -45,8 +45,8 @@
 # Cachedir must be different from userdir. The same cachedir and userdir
 # would cause problems.
 #
-netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/dev"
-netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/dev"
+netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/@@metabuild.RawVersion@@"
+netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/@@metabuild.RawVersion@@"
 
 # Options used by NetBeans launcher by default:
 # (can be overridden by explicit command line switches)
@@ -62,7 +62,7 @@ netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/dev"
 # default command line arguments.
 # (see: https://issues.apache.org/jira/browse/NETBEANS-1344)
 #
-netbeans_default_options="-J-XX:+UseStringDeduplication -J-Xss2m 
-J-Dnetbeans.logger.console=true -J-ea -J-Djdk.gtk.version=2.2 
-J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true 
-J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true 
-J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false 
-J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes 
-J--add-opens=java.base/java.net=ALL-UNNAMED 
-J--add-opens=java.base/java.lang.ref=ALL-UNNAMED -J-- [...]
+netbeans_default_options="-J-XX:+UseStringDeduplication -J-Xss2m 
@@metabuild.logcli@@ -J-Djdk.gtk.version=2.2 
-J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true 
-J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true 
-J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false 
-J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes 
-J--add-opens=java.base/java.net=ALL-UNNAMED 
-J--add-opens=java.base/java.lang.ref=ALL-UNNAMED -J--add-opens=java.bas [...]
 
 # Default location of JDK:
 # (set by installer or commented out if launcher should decide)
diff --git a/nb/updatecenters/build.xml b/nb/updatecenters/build.xml
index 5145b3d..5bdbfbc 100644
--- a/nb/updatecenters/build.xml
+++ b/nb/updatecenters/build.xml
@@ -24,8 +24,13 @@
 
   <import file="../../nbbuild/templates/projectized.xml"/>
 
-  <target name="compile" depends="projectized-common.compile,javafx-nbms"/>
-
+  <target name="compile" 
depends="projectized-common.compile,javafx-nbms,-branding"/>
+  <target name="-branding">
+      <replace 
file="${build.dir}/classes/org/netbeans/modules/updatecenters/resources/Bundle.properties"
 value="defaultvalue" 
propertyFile="${nb_all}/nbbuild/build/netbeansrelease.properties">
+           <replacefilter token="@@metabuild.DistributionURL@@" 
property="metabuild.DistributionURL"/>
+           <replacefilter token="@@metabuild.PluginPortalURL@@" 
property="metabuild.PluginPortalURL"/> 
+      </replace>
+  </target>
   <target name="javafx-nbms" description="Prepare NBMs for 3rd party 
libraries" depends="projectized-common.compile">
       <tempfile destdir="${build.dir}" prefix="sign" suffix=".ks" 
property="netbeans.bundled.ks" deleteonexit="true" />
       <tempfile destdir="${build.dir}" prefix="sign" suffix=".cert" 
property="netbeans.bundled.cert" deleteonexit="true"/>
diff --git 
a/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/Bundle.properties
 
b/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/Bundle.properties
index cdc7a70..bc4a0eb 100644
--- 
a/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/Bundle.properties
+++ 
b/nb/updatecenters/src/org/netbeans/modules/updatecenters/resources/Bundle.properties
@@ -28,12 +28,13 @@ 
Services/AutoupdateType/pluginportal-update-provider.instance=NetBeans Plugin Po
 Services/AutoupdateType/82pluginportal-update-provider.instance=NetBeans 8.2 
Plugin Portal
 
 #NOI18N
-URL_Distribution=https://netbeans.apache.org/nb/updates/dev/updates.xml.gz?{$netbeans.hash.code}
+URL_Distribution=@@metabuild.DistributionURL@@
 #NOI18N
-URL_PluginPortal=https://netbeans.apache.org/nb/plugins/dev/catalog.xml.gz
+URL_PluginPortal=@@metabuild.PluginPortalURL@@
 #NOI18N
 
URL_82PluginPortal=http://updates.netbeans.org/netbeans/updates/8.2/uc/final/distribution/catalog.xml.gz
 
 3rdparty=Third Party Libraries
 #NOI18N
 
URL_3rdparty=nbresloc:/org/netbeans/modules/updatecenters/resources/3rdparty-catalog.xml
+
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java
index 85fc930..9aaff2f 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java
@@ -68,7 +68,7 @@ public class HgExec extends ExecTask {
                 }
             }
         }
-        return Collections.singletonList("hg");
+        return Collections.singletonList("git");
     }
 
 }
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/ParseGitBranch.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/ParseGitBranch.java
new file mode 100644
index 0000000..b3b61b7
--- /dev/null
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/ParseGitBranch.java
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+package org.netbeans.nbbuild;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import java.io.Reader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.LineNumberReader;
+
+/**
+ *
+ * @author skygo
+ */
+public class ParseGitBranch extends Task {
+
+    /**
+     * data to parse
+     */
+    private String data;
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    /**
+     * properties to set
+     */
+    private String propertyName;
+
+    public void setProperty(String propertyName) {
+        this.propertyName = propertyName;
+    }
+
+    @Override
+    public void execute() throws BuildException {
+        super.execute();
+        Reader dataReader = new StringReader(data);
+        String firstLine = null;
+        String secondLine = null;
+        try (LineNumberReader r = new LineNumberReader(dataReader);) {
+            firstLine = r.readLine();
+            secondLine = r.readLine();
+        } catch (IOException ex) {
+            throw new BuildException("Problem reading information for detached 
head");
+        }
+        if (secondLine != null) {
+            throw new BuildException("Problem parsing git information for 
detached head : too many line");
+        }
+        if (firstLine == null || firstLine.trim().isEmpty()) {
+            // PullRequest assume master ?
+            getProject().setProperty(propertyName, "master");
+        } else {
+            String[] splited = firstLine.trim().split(" ");
+            long count = splited[0].chars().filter(ch -> ch == '/').count();
+            if (count != 1) {
+                throw new BuildException("Problem parsing git information" + 
count);
+            } else {
+                getProject().setProperty(propertyName, 
splited[0].split("/")[1]);
+            }
+        }
+    }
+}
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
new file mode 100644
index 0000000..a51b420
--- /dev/null
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
@@ -0,0 +1,401 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE jsonreleaseinfoFile
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this jsonreleaseinfoFile
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this jsonreleaseinfoFile 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.
+ */
+package org.netbeans.nbbuild;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @author skygo
+ */
+public class ReleaseJsonProperties extends Task {
+
+    /**
+     * current branch we works with
+     */
+    private String branch;
+    /**
+     * current hash we works with
+     */
+    private String hash;
+    /**
+     * cache of json file
+     */
+    private File jsonreleaseinfoFile;
+    /**
+     * xml file containing release information
+     */
+    private File xmlFile;
+
+    /**
+     * xml file containing release information
+     */
+    private File propertiesFile;
+
+    public void setBranch(String branch) {
+        this.branch = branch;
+    }
+
+    public void setHash(String hash) {
+        this.hash = hash;
+    }
+
+    public void setFile(File file) {
+        this.jsonreleaseinfoFile = file;
+    }
+
+    public void setXmloutput(File file) {
+        this.xmlFile = file;
+    }
+
+    public void setPropertiesoutput(File file) {
+        this.propertiesFile = file;
+    }
+
+    @Override
+    public void execute() throws BuildException {
+        super.execute();
+        JSONParser jsonParser = new JSONParser();
+        ReleaseInfo requiredbranchinfo = null;
+        List<ReleaseInfo> ri = new ArrayList<>();
+        //Prepare a xml document containg all the release information */
+        Document doc = XMLUtil.createDocument("releases");
+        Element releasesxml = doc.getDocumentElement();
+
+        //branch parameter
+        if (branch.equals("master") || branch.startsWith("release")) {
+            log("Taking release info from json");
+        } else {
+            log("Branch '" + branch + "' is not having good pattern defaulting 
to 'master'");
+            branch = "master";
+        }
+        // read all information and store each release in Rel
+        try (FileReader reader = new FileReader(jsonreleaseinfoFile)) {
+            JSONObject releaseList = (JSONObject) jsonParser.parse(reader);
+            log("Processing release: " + releaseList.keySet().toString());
+            for (Object object : releaseList.keySet()) {
+                ri.add(manageRelease(object.toString(), 
releaseList.get(object)));
+            }
+        } catch (ParseException | IOException ex) {
+            throw new BuildException(ex);
+        }
+        // sort all information
+        Collections.sort(ri);
+        // build a sorted xml 
+        for (ReleaseInfo releaseInfo : ri) {
+            log(releaseInfo.toString());
+            for (Object milestone : releaseInfo.milestones) {
+                log(milestone.toString());
+            }
+            Element releasexml = (Element) 
releasesxml.appendChild(doc.createElement("release"));
+            populatexml(releasexml, releaseInfo);
+            if (releaseInfo.getKey().equals(branch)) {
+                requiredbranchinfo = releaseInfo;
+                releasesxml.setAttribute("position", 
Integer.toString(releaseInfo.position));
+                // attribute to know position of the requested current branch 
in the set of release
+            }
+        }
+
+        if (requiredbranchinfo == null) {
+            throw new BuildException("No Release Information found for branch 
'" + branch + "', update json file section");
+        }
+// populate properties for api changes
+        getProject().setProperty("previous.release.year", 
Integer.toString(requiredbranchinfo.previousReleaseDate.getYear()));
+        getProject().setProperty("previous.release.month", 
String.format("%02d", requiredbranchinfo.previousReleaseDate.getMonthValue()));
+        getProject().setProperty("previous.release.day", String.format("%02d", 
requiredbranchinfo.previousReleaseDate.getDayOfMonth()));
+// version branding + incubating status management for Apache NetBeans 9.0 10 
11.0
+        getProject().setProperty("json.maturity", requiredbranchinfo.maturity);
+        getProject().setProperty("json.version", requiredbranchinfo.version);
+        getProject().setProperty("modules-javadoc-date", 
ReleaseJsonProperties.makeDate(requiredbranchinfo.releaseDate));
+        getProject().setProperty("atom-date", 
ReleaseJsonProperties.makeAtomDate(requiredbranchinfo.releaseDate));
+        getProject().setProperty("javaapidocurl", 
requiredbranchinfo.javaapidocurl);
+        log("Writing releasinfo file " + propertiesFile);
+        propertiesFile.getParentFile().mkdirs();
+        try (OutputStream config = new FileOutputStream(propertiesFile)) {
+            String optionnalversion = "";
+            boolean found = false;
+            for (MileStone m : requiredbranchinfo.milestones) {
+                if (m.hash.equals(hash)) {
+                    found = true;
+                    log("found hash" + hash + "-" + m.vote);
+                    // found a milestone
+                    if (m.vote != -1) {
+                        // vote is set we want the full version
+                    } else {
+                        optionnalversion = "-" + m.version;
+                    }
+
+                }
+            }
+            if (!found && !branch.equals("master")) {
+                // hash no match we are building a dev version of specific 
branch
+                optionnalversion = "-dev";
+            }
+            config.write(("metabuild.DistributionURL=" + 
requiredbranchinfo.updateurl.replace(requiredbranchinfo.version, 
requiredbranchinfo.version + optionnalversion) + "\n").getBytes());
+            config.write(("metabuild.PluginPortalURL=" + 
requiredbranchinfo.pluginsurl.replace(requiredbranchinfo.version, 
requiredbranchinfo.version + optionnalversion) + "\n").getBytes());
+            // used for cache and user dir
+            config.write(("metabuild.RawVersion=" + requiredbranchinfo.version 
+ optionnalversion + "\n").getBytes());
+
+            if (branch.equals("master")) {
+                config.write(("metabuild.ComputedSplashVersion=DEV (Build 
{0})\n").getBytes());
+                config.write(("metabuild.ComputedTitleVersion=DEV 
{0}\n").getBytes());
+                
config.write(("metabuild.logcli=-J-Dnetbeans.logger.console=true 
-J-ea\n").getBytes());
+            } else {
+                config.write(("metabuild.ComputedSplashVersion=" + 
requiredbranchinfo.version + optionnalversion + "\n").getBytes());
+                config.write(("metabuild.ComputedTitleVersion=" + 
requiredbranchinfo.version + optionnalversion + "\n").getBytes());
+                config.write(("metabuild.logcli=\n").getBytes());
+            }
+        } catch (IOException ex) {
+            throw new BuildException("Properties File for release cannot be 
created");
+        }
+
+        log("Writing releasinfo file " + xmlFile);
+
+        xmlFile.getParentFile().mkdirs();
+        try (OutputStream config = new FileOutputStream(xmlFile)) {
+            XMLUtil.write(doc, config);
+        } catch (IOException ex) {
+            throw new BuildException("XML File for release cannot be created");
+        }
+    }
+
+// add attribute for xml building apidoc enhancement
+    private void populatexml(Element releasesxml, ReleaseInfo releaseInfo) 
throws DOMException {
+        releasesxml.setAttribute("year", 
Integer.toString(releaseInfo.releaseDate.getYear()));
+        releasesxml.setAttribute("month", 
Integer.toString(releaseInfo.releaseDate.getMonthValue()));
+        releasesxml.setAttribute("day", 
Integer.toString(releaseInfo.releaseDate.getDayOfMonth()));
+        releasesxml.setAttribute("tlp", releaseInfo.maturity);
+        releasesxml.setAttribute("position", 
Integer.toString(releaseInfo.position));
+        releasesxml.setAttribute("version", releaseInfo.version);
+        releasesxml.setAttribute("apidocurl", releaseInfo.apidocurl);
+    }
+
+    private ReleaseInfo manageRelease(String key, Object arelease) {
+        ReleaseInfo ri = new ReleaseInfo(key);
+        // mandatory element
+        JSONObject jsonrelease = (JSONObject) arelease;
+        ri.setPosition(Integer.parseInt((String) getJSONInfo(jsonrelease, 
"position", "Order of release starting")));
+        // previous release date
+        JSONObject previousrelease = (JSONObject) getJSONInfo(jsonrelease, 
"previousreleasedate", "Apidoc: Date of previous Release");
+        ri.setPreviousRelease(
+                (String) getJSONInfo(previousrelease, "day", "Apidoc: day of 
previous Release"),
+                (String) getJSONInfo(previousrelease, "month", "Apidoc: month 
of previous Release"),
+                (String) getJSONInfo(previousrelease, "year", "Apidoc: year of 
previous Release"));
+        // date of release
+        JSONObject releasedate = (JSONObject) getJSONInfo(jsonrelease, 
"releasedate", "Apidoc: Date of Release vote");
+        ri.setReleaseDate(
+                (String) getJSONInfo(releasedate, "day", "Apidoc: day of 
previous Release"),
+                (String) getJSONInfo(releasedate, "month", "Apidoc: month of 
previous Release"),
+                (String) getJSONInfo(releasedate, "year", "Apidoc: year of 
previous Release"));
+
+        // tlp or not
+        ri.setMaturity((String) getJSONInfo(jsonrelease, "tlp", "Statut of 
release - TLP or not"));
+        // version name
+        ri.setVersion((String) getJSONInfo(jsonrelease, "versionName", 
"Version name"));
+        ri.setApidocurl((String) getJSONInfo(jsonrelease, "apidocurl", 
"Apidoc: URL"));
+        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"));
+        // optional section
+        JSONObject milestone = (JSONObject) jsonrelease.get("milestones");
+        if (milestone != null) {
+            for (Object object : milestone.keySet()) {
+                // ri.add(manageRelease(object.toString(), 
releaseList.get(object)));
+                JSONObject milestonedata = (JSONObject) milestone.get(object);
+                MileStone m = new MileStone((String) object);
+                // mandatory
+                m.setPosition(Integer.parseInt((String) 
getJSONInfo(milestonedata, "position", "Order of milestone in release")));
+                // optional
+                Object vote = milestonedata.get("vote");
+                if (vote != null) {
+                    m.setVote(Integer.parseInt((String) vote));
+                }
+                m.setVersion((String) milestonedata.get("version"));
+                ri.addMileStone(m);
+            }
+            Collections.sort(ri.milestones);
+        }
+
+        return ri;
+    }
+
+    private static String makeDate(LocalDateTime date) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d MMM 
yyyy", Locale.US);
+        return date.format(formatter);
+    }
+
+    private static String makeAtomDate(LocalDateTime date) {
+        DateTimeFormatter formatter = 
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
+        return date.format(formatter);
+    }
+
+    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);
+        }
+        return result;
+    }
+
+    private static class MileStone implements Comparable<MileStone> {
+
+        private int position;
+        private int vote = -1;
+        private final String hash;
+        private String version;
+
+        public MileStone(String hash) {
+            this.hash = hash;
+        }
+
+        @Override
+        public int compareTo(MileStone o) {
+            return (this.position - o.position);
+        }
+
+        private void setPosition(int position) {
+            this.position = position;
+        }
+
+        private void setVote(int vote) {
+            this.vote = vote;
+        }
+
+        private void setVersion(String version) {
+            this.version = version;
+        }
+
+        @Override
+        public String toString() {
+            return "(" + hash + "," + position + "," + vote + "," + version + 
")";
+        }
+    }
+
+    /**
+     *
+     * Comparable on position. Avoir randomness.
+     */
+    private static class ReleaseInfo implements Comparable<ReleaseInfo> {
+
+        private int position;
+        private final String key;
+        private LocalDateTime releaseDate;
+        private LocalDateTime previousReleaseDate;
+        private String maturity;
+        private String version;
+        private String apidocurl;
+        private String javaapidocurl;
+        private String updateurl;
+        private String pluginsurl;
+        private List<MileStone> milestones;
+
+        public ReleaseInfo(String key) {
+            this.key = key;
+            this.milestones = new ArrayList<>();
+        }
+
+        @Override
+        public int compareTo(ReleaseInfo o) {
+            return (this.position - o.position);
+        }
+
+        private void setPosition(int position) {
+            this.position = position;
+        }
+
+        @Override
+        public String toString() {
+            return "(" + key + "," + position + ")";
+        }
+
+        private String getKey() {
+            return key;
+        }
+
+        private LocalDateTime setDate(String day, String month, String year) {
+            LocalDateTime tmp = LocalDateTime.now();
+            try {
+                tmp = LocalDateTime.of(Integer.parseInt(year), 
Integer.parseInt(month), Integer.parseInt(day), 12, 0);
+            } catch (NumberFormatException e) {
+            }
+            return tmp;
+        }
+
+        private void setPreviousRelease(String day, String month, String year) 
{
+            previousReleaseDate = setDate(day, month, year);
+        }
+
+        private void setReleaseDate(String day, String month, String year) {
+            releaseDate = setDate(day, month, year);
+        }
+
+        private void setMaturity(String tlp) {
+            this.maturity = tlp;
+        }
+
+        private void setVersion(String version) {
+            if (version.equals("-")) {
+                this.version = "dev";
+            } else {
+                this.version = version;
+            }
+        }
+
+        private void setApidocurl(String apidocurl) {
+            this.apidocurl = apidocurl;
+        }
+
+        private void setJavaApiDocurl(String javaapidocurl) {
+            this.javaapidocurl = javaapidocurl;
+        }
+
+        private void setUpdateUrl(String url) {
+            this.updateurl = url;
+        }
+
+        private void setPluginsUrl(String url) {
+            this.pluginsurl = url;
+        }
+
+        private void addMileStone(MileStone milestone) {
+            this.milestones.add(milestone);
+        }
+
+    }
+
+}
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/SetApidocClustersConfig.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/SetApidocClustersConfig.java
new file mode 100644
index 0000000..c190d60
--- /dev/null
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/SetApidocClustersConfig.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE jsonreleaseinfoFile
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this jsonreleaseinfoFile
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this jsonreleaseinfoFile 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.
+ */
+package org.netbeans.nbbuild;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ *
+ * @author skygo
+ */
+public class SetApidocClustersConfig extends Task {
+
+    /**
+     * current branch we works with
+     */
+    private String branch;
+
+    public void setBranch(String branch) {
+        this.branch = branch;
+    }
+
+    @Override
+    public void execute() throws BuildException {
+        super.execute();
+        if (branch.equals("master")) {
+// for master branch, more apidoc to generate
+            getProject().setProperty("config.javadoc.all",
+                    getProject().getProperty("config.javadoc.stable") + ","
+                    + getProject().getProperty("config.javadoc.deprecated") + 
","
+                    + getProject().getProperty("config.javadoc.devel") + ","
+                    + getProject().getProperty("config.javadoc.friend"));
+        } else {
+// for release branch only stable
+            getProject().setProperty("config.javadoc.all", 
getProject().getProperty("config.javadoc.stable"));
+        }
+    }
+}
diff --git a/nbbuild/build.properties b/nbbuild/build.properties
index 14d8aae..8725fe3 100644
--- a/nbbuild/build.properties
+++ b/nbbuild/build.properties
@@ -26,9 +26,9 @@ tryme.arg.hack=-J-Dnetbeans.full.hack=true
 
 # Information about branch of previous release
 # needed to help us generate list of changes since then
-previous.release.year=2019
-previous.release.month=04
-previous.release.day=04
+#previous.release.year=2019
+#previous.release.month=04
+#previous.release.day=04
 
 # Useful for "always successful" build, when you don't care of some
 # particular (and currently broken) modules
@@ -224,11 +224,11 @@ config.javadoc.deprecated=\
 # List of all javadocs for development version
 # is composed from the javadocs split by stability
 # categories, for release it shall contain just stable ones
-config.javadoc.all=\
-    ${config.javadoc.stable},\
-    ${config.javadoc.devel},\
-    ${config.javadoc.friend},\
-    ${config.javadoc.deprecated}
+#config.javadoc.all=\
+#    ${config.javadoc.stable},\
+#    ${config.javadoc.devel},\
+#    ${config.javadoc.friend},\
+#    ${config.javadoc.deprecated}
 
 # list of modules for jnlp:
 config.jnlp.stable=\
diff --git a/nbbuild/build.xml b/nbbuild/build.xml
index 83f7e95..29da259 100644
--- a/nbbuild/build.xml
+++ b/nbbuild/build.xml
@@ -19,12 +19,12 @@
     under the License.
 
 -->
-<project name="nbbuild" default="build-nozip" basedir=".">
+<project name="nbbuild" default="build-nozip" basedir="." xmlns:if="ant:if" 
xmlns:unless="ant:unless">
 
-  <fail message="Please build using Ant 1.8.0 or higher.">
+  <fail message="Please build using Ant 1.9.3 or higher.">
     <condition>
       <not>
-        <antversion atleast="1.8.0"/>
+        <antversion atleast="1.9.3"/>
       </not>
     </condition>
   </fail>
@@ -77,6 +77,7 @@
             <include name="nbbuild/external/binaries-list"/>
             <include name="platform/libs.junit4/external/binaries-list"/>
             <include name="platform/javahelp/external/binaries-list"/>
+            <include name="ide/libs.json_simple/external/binaries-list"/>
         </manifest>
     </downloadbinaries>
     <!--
@@ -93,6 +94,8 @@
      <fileset dir="..">
         <!-- For JavaHelp indexing and link checking: -->
         <include name="platform/javahelp/external/jhall*.jar"/>
+        <!-- For json parsing -->
+        <include name="ide/libs.json_simple/external/json-simple*.jar"/>
       </fileset>
     </path>
     <javac srcdir="antsrc" destdir="${build.ant.classes.dir}" 
deprecation="true" debug="${build.compiler.debug}" source="1.8" target="1.8">
@@ -110,8 +113,84 @@
       <zipfileset dir="${nb_all}/nbbuild" includes="notice-stub.txt" 
fullpath="META-INF/NOTICE"/>
     </jar>
     <taskdef name="createlicensesummary" 
classname="org.netbeans.nbbuild.extlibs.CreateLicenseSummary" 
classpath="${nbantext.jar}"/>
+    <!-- get all json info we have on apache gitbox  -->
+    <property name="metabuild.releasejson" 
value="${nb_all}/nbbuild/build/netbeansrelease.json"/>
+    <condition property="metabuild.jsonurl" 
value="https://gitbox.apache.org/repos/asf?p=netbeans-jenkins-lib.git;a=blob_plain;f=meta/netbeansrelease.json";>
+        <not>
+            <isset property="metabuild.jsonurl"/>
+        </not>
+    </condition>
+    <get dest="${metabuild.releasejson}" skipexisting="false" 
src="${metabuild.jsonurl}" />
+    <!-- get branches and git information -->
+    <antcall target="getgitinformation" />
+    <!-- hardcoded item for testing
+<echo file="${nb_all}/nbbuild/build/gitinfo.properties" 
>metabuild.branch=release111
+metabuild.hash=f56623c16cc2cbc4a381508562545b13de91437e
+</echo>
+    -->
+    <!-- javadoc content filtering -->
+    <taskdef name="setjavadoc" 
classname="org.netbeans.nbbuild.SetApidocClustersConfig" 
classpath="${nbantext.jar}"/>
+    <property file="${nb_all}/nbbuild/build/gitinfo.properties"/>
+    <setjavadoc branch="${metabuild.branch}"/>
+    <echo message="${metabuild.branch}"/>
+    <property name="releasejson" 
value="${nb_all}/nbbuild/build/netbeansrelease.json"/>
+    <property name="xmlrelease" 
value="${nb_all}/nbbuild/build/netbeansrelease.xml"/>
+    <property name="propertiesrelease" 
value="${nb_all}/nbbuild/build/netbeansrelease.properties"/>
+    <taskdef name="releasejson" 
classname="org.netbeans.nbbuild.ReleaseJsonProperties" >
+        <classpath>
+            <pathelement location="${nbantext.jar}"/>
+            <fileset dir="${nb_all}/ide/libs.json_simple/external">
+                <include name="json*.jar"/>
+            </fileset>
+        </classpath>
+    </taskdef>
+    <releasejson file="${releasejson}" xmloutput="${xmlrelease}" 
propertiesoutput="${propertiesrelease}" branch="${metabuild.branch}" 
hash="${metabuild.hash}"/>
+    <!--<fail />-->
   </target>
-
+  <target name="-git.ispresent">
+      <condition property="metabuild.isgitrepo" value="true" else="false">
+          <available type="dir" file="../.git"/>
+      </condition>
+  </target>
+  <target name="-git.down" unless="${metabuild.isgitrepo}" 
depends="-git.ispresent">
+      <!-- no git, assuming master, but should try other option -->
+      <echo file="${nb_all}/nbbuild/build/gitinfo.properties" 
>metabuild.branch=master</echo>
+  </target>
+  <target name="-git.up" if="${metabuild.isgitrepo}" depends="-git.ispresent">
+      <taskdef name="gitexec" classname="org.netbeans.nbbuild.HgExec" 
classpath="${nbantext.jar}"/>
+      <gitexec outputproperty="git.hash.properties">
+          <arg value="rev-parse"/>
+          <arg value="HEAD"/>
+      </gitexec>
+      <gitexec outputproperty="git.branch.properties">
+          <arg value="rev-parse"/>
+          <arg value="--abbrev-ref"/>
+          <arg value="HEAD"/>
+      </gitexec>
+      <echo message="branch ${git.branch.properties}" />
+      <gitexec outputproperty="git.branchdetached.bulk.properties">
+          <arg value="branch"/>
+          <arg value="--remote"/>
+          <arg value="--verbose"/>
+          <arg value="--no-abbrev"/>
+          <arg value="--contains"/>
+      </gitexec>
+      <echo message="detached ${git.branchdetached.bulk.properties}" />
+      <!-- branch is HEAD implies detached -->
+      <condition property="invalidbranch">
+          <equals arg1="HEAD" arg2="${git.branch.properties}"/>
+      </condition>
+      <taskdef name="parsebranch" 
classname="org.netbeans.nbbuild.ParseGitBranch" classpath="${nbantext.jar}"/>
+      <parsebranch if:set="invalidbranch" 
data="${git.branchdetached.bulk.properties}" 
property="git.branchdetached.parsed.properties" />
+      <!-- keep echo file at begining of line, build git data -->
+      <echo unless:set="invalidbranch" 
file="${nb_all}/nbbuild/build/gitinfo.properties" 
>metabuild.branch=${git.branch.properties}
+metabuild.hash=${git.hash.properties}
+</echo>
+      <echo if:set="invalidbranch" 
file="${nb_all}/nbbuild/build/gitinfo.properties" 
>metabuild.branch=${git.branchdetached.parsed.properties}
+metabuild.hash=${git.hash.properties}
+</echo>
+  </target>
+  <target name="getgitinformation" depends="-git.up,-git.down" />
   <target name="download-all-extbins" unless="ext.binaries.downloaded" 
depends="bootstrap">
     <echo>Downloading external binaries (*/external/ directories)...</echo>
     <downloadbinaries cache="${binaries.cache}" server="${binaries.server}">
@@ -378,6 +457,11 @@
 
     <mkdir dir="${netbeans.dest.dir}/etc" />
     <copy file="../nb/ide.launcher/netbeans.conf" 
todir="${netbeans.dest.dir}/etc" overwrite="true"/>
+    <!-- replace -->
+    <replace file="${netbeans.dest.dir}/etc/netbeans.conf" 
value="defaultvalue" 
propertyFile="${nb_all}/nbbuild/build/netbeansrelease.properties">
+        <replacefilter token="@@metabuild.RawVersion@@" 
property="metabuild.RawVersion"/>
+        <replacefilter token="@@metabuild.logcli@@" 
property="metabuild.logcli"/>
+    </replace>
     <copy file="../nb/ide.launcher/netbeans.clusters" 
todir="${netbeans.dest.dir}/etc" overwrite="true"/>
 
     <mkdir dir="${nb.build.dir}/license-temp" />


---------------------------------------------------------------------
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