Merge pull request #1523 from apache/master

Sync master to release112 for beta 1
diff --git a/.gitignore b/.gitignore
index 08c3a9f..4da9c5f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,8 @@
 /nbbuild/testuserdir/
 /nbbuild/*.zip
 /nbbuild/user.build.properties
+/nbbuild/gitinfo.properties
+/nbbuild/netbeansrelease.properties
 /nbi/engine/native/*/*/dist/
 /nb-javac/
 /java.source.nbjavac/test/test-nb-javac/nbproject/private/
diff --git a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java
index 8f00c7b..c5ca1cf 100644
--- a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java
+++ b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/J2SEPlatformDefaultJavadocImpl.java
@@ -61,7 +61,7 @@
         OFFICIAL_JAVADOC.put("10", "https://docs.oracle.com/javase/10/docs/api/"); // NOI18N
         OFFICIAL_JAVADOC.put("11", "https://docs.oracle.com/en/java/javase/11/docs/api/"); // NOI18N
         OFFICIAL_JAVADOC.put("12", "https://docs.oracle.com/en/java/javase/12/docs/api/"); // NOI18N
-        OFFICIAL_JAVADOC.put("13", "https://download.java.net/java/early_access/jdk13/docs/api/"); // NOI18N Early access
+        OFFICIAL_JAVADOC.put("13", "https://docs.oracle.com/en/java/javase/13/docs/api/"); // NOI18N
         OFFICIAL_JAVADOC.put("14", "https://download.java.net/java/early_access/jdk14/docs/api/"); // NOI18N Early access
     }
 
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java b/nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java
deleted file mode 100644
index 9aaff2f..0000000
--- a/nbbuild/antsrc/org/netbeans/nbbuild/HgExec.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 java.io.File;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.ExecTask;
-import org.apache.tools.ant.types.Commandline;
-
-/**
- * Just like {@code <exec>} but fixes the executable as {@code hg} (Mercurial).
- * The advantage is that it also checks for variants like {@code hg.cmd} etc.
- * See issue #134636.
- */
-public class HgExec extends ExecTask {
-
-    public HgExec() {
-        List<String> cmd = hgExecutable();
-        super.setExecutable(cmd.get(0));
-        for (String arg : cmd.subList(1, cmd.size())) {
-            createArg().setValue(arg);
-        }
-    }
-
-    @Override
-    public void setCommand(Commandline cmdl) {
-        throw new BuildException("Cannot call this");
-    }
-
-    @Override
-    public void setExecutable(String value) {
-        throw new BuildException("Cannot call this");
-    }
-
-    /**
-     * Get a command to run Mercurial.
-     * For Windows users, {@link Runtime#exec} does not work directly on {@code *.bat} / {@code *.cmd} files.
-     * Find what the desired Hg executable form is in the path and call it appropriately.
-     */
-    public static List<String> hgExecutable() {
-        String path = System.getenv("Path");
-        if (path != null) {
-            for (String component : path.split(File.pathSeparator)) {
-                if (new File(component, "hg.bat").isFile() || new File(component, "hg.cmd").isFile()) {
-                    return Arrays.asList("cmd", "/c", "hg");
-                } else if (new File(component, "hg.exe").isFile() || new File(component, "hg").isFile()) {
-                    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
deleted file mode 100644
index 0c66f31..0000000
--- a/nbbuild/antsrc/org/netbeans/nbbuild/ParseGitBranch.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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 (secondLine != null || firstLine == null || firstLine.trim().isEmpty()) {
-            // Assume master if PR or detached HEAD on Travis, etc.
-            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
index a51b420..31bbf68 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/ReleaseJsonProperties.java
@@ -20,6 +20,7 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -115,7 +116,8 @@
         }
         // sort all information
         Collections.sort(ri);
-        // build a sorted xml 
+        // build a sorted xml
+        
         for (ReleaseInfo releaseInfo : ri) {
             log(releaseInfo.toString());
             for (Object milestone : releaseInfo.milestones) {
@@ -133,6 +135,12 @@
         if (requiredbranchinfo == null) {
             throw new BuildException("No Release Information found for branch '" + branch + "', update json file section");
         }
+        List<String> updateValues = new ArrayList<>();
+        for (ReleaseInfo releaseInfo : ri) {
+            if (releaseInfo.position < requiredbranchinfo.position) {
+                updateValues.add(releaseInfo.version);
+            }
+        }
 // 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()));
@@ -146,7 +154,7 @@
         log("Writing releasinfo file " + propertiesFile);
         propertiesFile.getParentFile().mkdirs();
         try (OutputStream config = new FileOutputStream(propertiesFile)) {
-            String optionnalversion = "";
+            String optionalversion = "";
             boolean found = false;
             for (MileStone m : requiredbranchinfo.milestones) {
                 if (m.hash.equals(hash)) {
@@ -156,34 +164,34 @@
                     if (m.vote != -1) {
                         // vote is set we want the full version
                     } else {
-                        optionnalversion = "-" + m.version;
+                        optionalversion = "-" + m.version;
                     }
 
                 }
             }
             if (!found && !branch.equals("master")) {
                 // hash no match we are building a dev version of specific branch
-                optionnalversion = "-dev";
+                optionalversion = "-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());
+            config.write(("metabuild.DistributionURL=" + requiredbranchinfo.updateurl + "\n").getBytes());
+            config.write(("metabuild.PluginPortalURL=" + requiredbranchinfo.pluginsurl + "\n").getBytes());
             // used for cache and user dir
-            config.write(("metabuild.RawVersion=" + requiredbranchinfo.version + optionnalversion + "\n").getBytes());
-
+            config.write(("metabuild.RawVersion=" + requiredbranchinfo.version + optionalversion + "\n").getBytes());
+            config.write(("metabuild.apachepreviousversion=" + String.join(",", updateValues) + "\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.ComputedSplashVersion=" + requiredbranchinfo.version + optionalversion + "\n").getBytes());
+                config.write(("metabuild.ComputedTitleVersion=" + requiredbranchinfo.version + optionalversion + "\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);
+        log("Writing releasinfo file " + xmlFile );
 
         xmlFile.getParentFile().mkdirs();
         try (OutputStream config = new FileOutputStream(xmlFile)) {
@@ -191,6 +199,14 @@
         } catch (IOException ex) {
             throw new BuildException("XML File for release cannot be created");
         }
+        String configline;
+        try (FileReader config = new FileReader(propertiesFile); BufferedReader configStream = new BufferedReader(config);) {
+            while ((configline = configStream.readLine()) != null) {
+                log("Branding computed info: " + configline);
+            }
+        } catch (IOException ex) {
+            throw new BuildException("propertiesFile for release cannot be read");
+        }
     }
 
 // add attribute for xml building apidoc enhancement
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/ValidateHgConfiguration.java b/nbbuild/antsrc/org/netbeans/nbbuild/ValidateHgConfiguration.java
deleted file mode 100644
index f737c38..0000000
--- a/nbbuild/antsrc/org/netbeans/nbbuild/ValidateHgConfiguration.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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 java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-
-/**
- * Look for common problems in your Hg configuration and warn about them.
- */
-public class ValidateHgConfiguration extends Task {
-
-    private File root;
-    /** Location of NB source root. */
-    public void setRoot(File root) {
-        this.root = root;
-    }
-
-    @Override
-    public void execute() throws BuildException {
-        File dotHg = new File(root, ".hg");
-        if (!dotHg.isDirectory()) {
-            log(root + " is not a Mercurial repository", Project.MSG_VERBOSE);
-            return;
-        }
-        List<String> hgExecutable = HgExec.hgExecutable();
-        try {
-            List<String> commandAndArgs = new ArrayList<>(hgExecutable);
-            commandAndArgs.add("--config");
-            commandAndArgs.add("extensions.churn="); // added to hgext right before 1.0 release
-            commandAndArgs.add("showconfig");
-            Process p = new ProcessBuilder(commandAndArgs).directory(root).start();
-            BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
-            boolean foundUserName = false, foundCrlfHook = false;
-            String line;
-            while ((line = r.readLine()) != null) {
-                if (line.matches("hooks\\.pretxncommit\\..+=python:(hgext\\.)?win32text\\.forbidcrlf")) {
-                    foundCrlfHook = true;
-                } else if (line.matches("ui\\.username=(.+ <)?\\w+@netbeans\\.org>?")) {
-                    foundUserName = true;
-                }
-            }
-            if (!foundUserName) {
-                log("======== WARNING ========\n" +
-                    "You need to configure a Mercurial username\n" +
-                    "if you intend to push changes to NetBeans repositories.\n" +
-                    "Format (in ~/.hgrc or Mercurial.ini):\n" +
-                    "[ui]\n" +
-                    "username = Robert Q. Hacker <rhacker@netbeans.org>\n" +
-                    "=========================", Project.MSG_WARN);
-            }
-            if (!foundCrlfHook) {
-                log("======== WARNING ========\n" +
-                    "You need to guard against committing carriage returns into Mercurial\n" +
-                    "if you intend to push changes to NetBeans repositories.\n" +
-                    "Format (in ~/.hgrc or Mercurial.ini):\n" +
-                    "[hooks]\n" +
-                    "pretxncommit.crlf = python:hgext.win32text.forbidcrlf\n" +
-                    "=========================", Project.MSG_WARN);
-            }
-            r = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-            while ((line = r.readLine()) != null) {
-                if (line.contains("failed to import extension churn")) {
-                    log("======== WARNING ========\n" +
-                        "You seem to be using a version of Mercurial older than 1.0.\n" +
-                        "Please upgrade as your version may have serious bugs fixed in later versions.\n" +
-                        "=========================", Project.MSG_WARN);
-                    }
-            }
-        } catch (IOException x) {
-            log("Could not verify Hg configuration: " + x, Project.MSG_WARN);
-        }
-    }
-
-}
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
index 93c122e..601ce23 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
@@ -34,6 +34,9 @@
 # upstream problem
 nbbuild/external/langtools-9.zip nbbuild/external/langtools-9.zip
 
+# Used to parse data during build, but need to as a lib for ide cluster
+nbbuild/external/json-simple-1.1.1.jar ide/libs.json_simple/external/json-simple-1.1.1.jar
+
 # JFlex is used by multiple modules.
 webcommon/javascript2.jade/external/jflex-1.4.3.jar webcommon/javascript2.lexer/external/jflex-1.4.3.jar
 
diff --git a/nbbuild/build.xml b/nbbuild/build.xml
index 29da259..a8b68cf 100644
--- a/nbbuild/build.xml
+++ b/nbbuild/build.xml
@@ -60,14 +60,10 @@
         <classpath>
             <pathelement location="${ant.core.lib}"/>
         </classpath>
-        <include name="org/netbeans/nbbuild/HgExec.java"/>
-        <include name="org/netbeans/nbbuild/ValidateHgConfiguration.java"/>
         <include name="org/netbeans/nbbuild/extlibs/DeregisterExternalHook.java"/>
         <include name="org/netbeans/nbbuild/extlibs/DownloadBinaries.java"/>
         <compilerarg line="-Xlint -Xlint:-serial"/>
     </javac>
-    <taskdef name="validate-hg-configuration" classname="org.netbeans.nbbuild.ValidateHgConfiguration" classpath="${build.ant.classes.dir}"/>
-    <validate-hg-configuration root=".."/>
     <taskdef name="deregisterexternalhook" classname="org.netbeans.nbbuild.extlibs.DeregisterExternalHook" classpath="${build.ant.classes.dir}"/>
     <deregisterexternalhook root=".."/>
     <taskdef name="downloadbinaries" classname="org.netbeans.nbbuild.extlibs.DownloadBinaries" classpath="${build.ant.classes.dir}"/>
@@ -77,7 +73,6 @@
             <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>
     <!--
@@ -95,7 +90,7 @@
         <!-- 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"/>
+        <include name="nbbuild/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">
@@ -123,23 +118,22 @@
     <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}"/>
+    <!-- read info from gitinfo.properties , if present in source bundle copy gitinfo-->
+    <copy file="${nb_all}/nbbuild/gitinfo.properties" tofile="${nb_all}/nbbuild/build/gitinfo.properties" failonerror="false"/>
+    <copy file="${nb_all}/nbbuild/netbeansrelease.properties" tofile="${nb_all}/nbbuild/build/netbeansrelease.properties" failonerror="false"/>
     <property file="${nb_all}/nbbuild/build/gitinfo.properties"/>
+    <property file="${nb_all}/nbbuild/build/netbeansrelease.properties"/>
     <setjavadoc branch="${metabuild.branch}"/>
-    <echo message="${metabuild.branch}"/>
+    <echo message="Building branch: ${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">
+            <fileset dir="${nb_all}/nbbuild/external">
                 <include name="json*.jar"/>
             </fileset>
         </classpath>
@@ -147,48 +141,51 @@
     <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 name="-gitinfo.ispresent">
+      <available file="${nb_all}/nbbuild/build/gitinfo.properties" property="gitinfo.present" />      
   </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}"/>
+  <target name="-git.down" unless="${gitinfo.present}" depends="-gitinfo.ispresent">
+      <!-- try to get information from jenkins or travis -->
+      <property environment="env"/>
+      <condition property="metabuild.branch" value="${env.GIT_BRANCH}" >
+          <isset property="env.GIT_BRANCH" />
       </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>
+      <condition property="metabuild.branch" value="${env.TRAVIS_BRANCH}" >
+          <isset property="env.TRAVIS_BRANCH" />
+      </condition>
+      <condition property="metabuild.branch" value="${metabuild.branch}" >
+          <isset property="metabuild.branch" />
+      </condition>
+      <condition property="metabuild.branch" value="master" >
+          <not>
+              <isset property="metabuild.branch" />
+          </not>
+      </condition>
+      <condition property="metabuild.hash" value="${env.GIT_COMMIT}" >
+          <isset property="env.GIT_COMMIT" />
+      </condition>
+      <condition property="metabuild.hash" value="${env.TRAVIS_COMMIT}" >
+          <isset property="env.TRAVIS_COMMIT" />
+      </condition>
+      <condition property="metabuild.hash" value="${metabuild.hash}" >
+          <isset property="metabuild.hash" />
+      </condition>
+      <echo message="Processing build with branch ${metabuild.branch} and hash ${metabuild.hash}" />
+      <!-- if hash not present do not fail -->
+      <fail message="Branch not found use -Dmetabuild.branch=branchName " >
+          <condition>
+              <not>
+                  <isset property="metabuild.branch"/>
+              </not>
+          </condition>
+      </fail>
+      <echo unless:set="metabuild.hash" file="${nb_all}/nbbuild/build/gitinfo.properties" >metabuild.branch=${metabuild.branch}</echo>
+      <echo if:set="metabuild.hash" file="${nb_all}/nbbuild/build/gitinfo.properties" >metabuild.branch=${metabuild.branch}
+metabuild.hash=${metabuild.hash}</echo>
+  </target>
+  <target name="-git.up" if="${gitinfo.present}" depends="-gitinfo.ispresent">
+      <property file="${nb_all}/nbbuild/build/gitinfo.properties"/>
+      <echo message="Processing build with branch ${metabuild.branch} and hash ${metabuild.hash}" />
   </target>
   <target name="getgitinformation" depends="-git.up,-git.down" />
   <target name="download-all-extbins" unless="ext.binaries.downloaded" depends="bootstrap">
@@ -1780,6 +1777,8 @@
       <zipfileset file="${nb.build.dir}/LICENSE" />
       <zipfileset dir="${nb.build.dir}/licenses" includes="**" prefix="licenses" /> 
       <zipfileset file="${source.zip.readme}" fullpath="README.md" erroronmissingarchive="false" />
+      <zipfileset file="${nb_all}/nbbuild/build/netbeansrelease.properties" fullpath="nbbuild/netbeansrelease.properties" erroronmissingarchive="false"/>
+      <zipfileset file="${nb_all}/nbbuild/build/gitinfo.properties" fullpath="nbbuild/gitinfo.properties" erroronmissingarchive="false" />
     </zip>
   </target>
 
diff --git a/nbbuild/external/binaries-list b/nbbuild/external/binaries-list
index ec0439e..15a0e15 100644
--- a/nbbuild/external/binaries-list
+++ b/nbbuild/external/binaries-list
@@ -18,3 +18,4 @@
 AB396EE119BFAD809CC9F09950CC22E2BCE2FE35 langtools-9.zip
 E32B3483FBF362C92088CB79E9F1F161F3F64A21 org.apidesign.javadoc:codesnippet-doclet:0.30
 D5CC2CD2A20963B86CF95397784BC7E74101C7A9 org.netbeans.tools:sigtest-maven-plugin:1.2
+C9AD4A0850AB676C5C64461A05CA524CDFFF59F1 com.googlecode.json-simple:json-simple:1.1.1
diff --git a/nbbuild/external/json-simple-1.1.1-license.txt b/nbbuild/external/json-simple-1.1.1-license.txt
new file mode 100644
index 0000000..aaede6a
--- /dev/null
+++ b/nbbuild/external/json-simple-1.1.1-license.txt
@@ -0,0 +1,208 @@
+Name: JSON simple
+Description: A simple Java toolkit for JSON.
+Version: 1.1.1
+Origin: GitHub
+License: Apache-2.0
+URL: https://github.com/fangyidong/json-simple
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
diff --git a/nbbuild/rat-exclusions.txt b/nbbuild/rat-exclusions.txt
index 867bfbd..910cfba 100644
--- a/nbbuild/rat-exclusions.txt
+++ b/nbbuild/rat-exclusions.txt
@@ -23,6 +23,9 @@
 nbbuild/netbeans/**
 nbbuild/testuserdir/**
 nbbuild/user.build.properties
+###### generated build artefact
+nbbuild/gitinfo.properties
+nbbuild/netbeansrelease.properties
 
 ###### user-specific files  
 **/nbproject/private/**
diff --git a/nbbuild/templates/common.xml b/nbbuild/templates/common.xml
index e1fbc79..1182ee1 100644
--- a/nbbuild/templates/common.xml
+++ b/nbbuild/templates/common.xml
@@ -322,13 +322,13 @@
     <target name="-validate-layers" depends="init">
         <parsemanifest manifest="${manifest.mf}" attribute="OpenIDE-Module-Layer" property="layer.file"/>
         <!-- DTD from sources -->
-        <available file="${nb_all}/openide.filesystems/src/org/openide/filesystems/filesystem.dtd" type="file"
-                   property="dtd.cp" value="${nb_all}/openide.filesystems/src"/>
+        <available file="${nb_all}/platform/openide.filesystems/src/org/openide/filesystems/filesystem.dtd" type="file"
+                   property="dtd.cp" value="${nb_all}/platform/openide.filesystems/src"/>
         <!-- DTD from platform -->
         <pathconvert property="dtd.cp">
             <pathfileset>
                 <path refid="cluster.path.id"/>
-                <filename name="core/org-openide-filesystems.jar"/>
+                <filename name="platform/core/org-openide-filesystems.jar"/>
             </pathfileset>
         </pathconvert>
 
diff --git a/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java b/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
index 62c4f6e..9f11db0 100644
--- a/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
+++ b/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
@@ -2326,7 +2326,7 @@
                 res = new ProxyLookup(
                     Lookups.singleton(new JarArchiveRootProvider()),
                     Lookup.getDefault()).lookupResult(ArchiveRootProvider.class);
-                if (!archiveRootProviders.compareAndSet(null, res)) {
+                if (archiveRootProviders.compareAndSet(null, res)) {
                     res = archiveRootProviders.get();
                     res.addLookupListener((ev) -> {
                         archiveRootProviderCache = null;
@@ -2338,6 +2338,6 @@
         return archiveRootProviderCache;
     }
 
-    private static Iterable<? extends ArchiveRootProvider> archiveRootProviderCache;
+    private static volatile Iterable<? extends ArchiveRootProvider> archiveRootProviderCache;
     private static final AtomicReference<Lookup.Result<ArchiveRootProvider>> archiveRootProviders = new AtomicReference<>();
 }