You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jt...@apache.org on 2017/10/13 15:19:18 UTC

incubator-netbeans git commit: [PATCH] Produce junit report from Apache Rat and clusters.properties

Repository: incubator-netbeans
Updated Branches:
  refs/heads/master 56c952886 -> 162850d67


[PATCH] Produce junit report from Apache Rat and clusters.properties

Project: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/commit/162850d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/tree/162850d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/diff/162850d6

Branch: refs/heads/master
Commit: 162850d67436764aef5e5dd6016ca636d94921af
Parents: 56c9528
Author: Eric Barboni <sk...@apache.org>
Authored: Fri Oct 13 17:18:59 2017 +0200
Committer: Jaroslav Tulach <ja...@oracle.com>
Committed: Fri Oct 13 17:18:59 2017 +0200

----------------------------------------------------------------------
 .../org/netbeans/nbbuild/RatReportTask.java     | 313 +++++++++++++++++++
 nbbuild/build.xml                               | 201 ++++++------
 2 files changed, 426 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/162850d6/nbbuild/antsrc/org/netbeans/nbbuild/RatReportTask.java
----------------------------------------------------------------------
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/RatReportTask.java b/nbbuild/antsrc/org/netbeans/nbbuild/RatReportTask.java
new file mode 100644
index 0000000..f31f06e
--- /dev/null
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/RatReportTask.java
@@ -0,0 +1,313 @@
+/**
+ * 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.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * Build JUnit report from Apache Ant Report XXX
+ *
+ * @author skygo
+ */
+public class RatReportTask extends Task {
+
+    private File sourceFile;
+    private File root;
+    // not nice but to be last
+    private static final String OTHERS_AREA = "not cluster";
+    private static final String NOT_CLUSTER = "not under cluster";
+    private File reportFile;
+
+    /**
+     * source file Apache Rat xml report
+     *
+     * @param sourceFile
+     */
+    public void setSource(File sourceFile) {
+        this.sourceFile = sourceFile;
+    }
+
+    /**
+     * Folder to put the rat reports in
+     *
+     * @param report
+     */
+    public void setReport(File report) {
+        this.reportFile = report;
+    }
+
+    @Override
+    public void execute() throws BuildException {
+        root = sourceFile.getParentFile().getParentFile().getParentFile();
+        File[] modulesFolder = root.listFiles();
+        String repository = "";
+        // get repository information from git
+        //try {
+        List<String> commandAndArgs = new ArrayList<>();
+        commandAndArgs.add("git");
+        commandAndArgs.add("config");
+        commandAndArgs.add("--get");
+        commandAndArgs.add("remote.origin.url");
+        try {
+            Process p = new ProcessBuilder(commandAndArgs).directory(root).start();
+            try (BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
+                String line;
+                while ((line = r.readLine()) != null) {
+                    if (line.startsWith("http")) {
+                        repository = line.replace(".git", "");
+                    }
+                }
+            } catch (IOException ex) {
+                throw new BuildException("Cannot evaluate git information", ex);
+            }
+        } catch (IOException ex) {
+            throw new BuildException("git process issue", ex);
+        }
+        // map module and report
+        Map<String, ModuleInfo> moduleRATInfo = new TreeMap<>();
+
+        // build map to get cluster and module related from cluster.properties
+        Set<String> moduleDB = new HashSet<>();
+        Map<String, Set<String>> modulebycluster = new TreeMap<>();
+        for (File module : modulesFolder) {
+            if (module.isDirectory() && !module.isHidden()) {
+                moduleDB.add(module.getName());
+                moduleRATInfo.put(module.getName(), new ModuleInfo(module));
+            }
+        }
+        Set<String> clusterList = new TreeSet<>();
+        for (String key : getProject().getProperties().keySet()) {
+            if (key.startsWith("nb.cluster.")) {
+                String simplfiedKey = key.replaceAll("nb.cluster.", "");
+                simplfiedKey = simplfiedKey.replaceAll(".dir", "");
+                simplfiedKey = simplfiedKey.replaceAll(".depends", "");
+                clusterList.add(simplfiedKey);
+                modulebycluster.put(simplfiedKey, new HashSet<String>());
+            }
+        }
+        for (String clusterName : clusterList) {
+            String property = getProject().getProperty("nb.cluster." + clusterName);
+            String[] split = property.split(",");
+            for (String amo : split) {
+                moduleDB.remove(amo);
+                modulebycluster.get(clusterName).add(amo);
+            }
+        }
+        modulebycluster.put(OTHERS_AREA, new HashSet<String>());
+        for (String k : moduleDB) {
+            modulebycluster.get(OTHERS_AREA).add(k);
+        }
+        // remaining module sorted in others
+        modulebycluster.get(OTHERS_AREA).add(NOT_CLUSTER);
+        clusterList.add(OTHERS_AREA);
+        moduleRATInfo.put(NOT_CLUSTER, new ModuleInfo(root));
+        //read XML
+        try {
+            DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            Document doc = dBuilder.parse(sourceFile); // open xml source
+            XPathFactory xpf = XPathFactory.newInstance();
+
+            XPath path = xpf.newXPath();
+            Element rootElement = doc.getDocumentElement();
+
+            doPopulateUnapproved(moduleRATInfo, rootElement, path);
+            doPopulateApproved(moduleRATInfo, rootElement, path);
+
+        } catch (ParserConfigurationException | SAXException | IOException | XPathExpressionException ex) {
+            throw new BuildException("Cannot parse Rat report ", ex);
+        }
+        doCheckExternal(moduleRATInfo);
+
+        for (String clusterName : clusterList) {
+            // create a report file by cluster
+            File file = new File(reportFile, clusterName + ".xml");
+            if (!file.exists()) {
+                try {
+                    reportFile.mkdirs();
+                    file.createNewFile();
+                } catch (IOException ex) {
+                    throw new BuildException("Impossible to create junit rat report for cluster " + clusterName, ex);
+                }
+            }
+            Map<String, String> pseudoTests = new LinkedHashMap<>();
+            for (String moduleName : modulebycluster.get(clusterName)) {
+                ModuleInfo amoduleInfo = moduleRATInfo.get(moduleName);
+                if (amoduleInfo != null) {
+                    if (!amoduleInfo.getUnapproved().isEmpty()) {
+                        pseudoTests.put(" module " + moduleName + " has " + amoduleInfo.getUnapproved().size() + " unapproved license(s)", "Unapproved license in " + amoduleInfo.getUnapproved().size() + " file(s) " + writeFiles(amoduleInfo.getUnapproved(), repository));
+                    }
+                    if (!amoduleInfo.getInvalidExternal().isEmpty()) {
+                        pseudoTests.put(" module " + moduleName + " has " + amoduleInfo.getInvalidExternal().size() + " suspicious external binaries  file(s)", "List of file " + amoduleInfo.getInvalidExternal().size() + " file(s) " + writeFiles(amoduleInfo.getInvalidExternal(), null));
+                    }
+                } else {
+                    // XXX if a moduleInfo is null folder is not present source base incomplete
+                }
+
+            }
+            JUnitReportWriter.writeReport(this, "Cluster: " + clusterName, file, pseudoTests);
+        }
+    }
+
+    private static String writeFiles(Set<String> listFile, String repo) {
+        StringBuilder sb = new StringBuilder();
+        for (String fileentry : listFile) {
+            sb.append("\n");
+            if (repo != null) {
+                sb.append(repo).append("/tree/master/");
+            }
+            sb.append(fileentry.replaceAll(" ", "%20"));
+        }
+        return sb.toString();
+    }
+
+    private void doPopulateUnapproved(Map<String, ModuleInfo> moduleRATInfo, Element rootElement, XPath path) throws XPathExpressionException {
+        NodeList evaluate = (NodeList) path.evaluate("descendant::resource[license-approval/@name=\"false\"]", rootElement, XPathConstants.NODESET);
+        for (int i = 0; i < evaluate.getLength(); i++) {
+            String resources = evaluate.item(i).getAttributes().getNamedItem("name").getTextContent().replaceFirst(root.getPath() + File.separator, "");
+            String moduleName = getModuleName(resources);
+            if (!moduleRATInfo.containsKey(moduleName)) {
+                moduleRATInfo.get(NOT_CLUSTER).addUnapproved(resources);
+            } else {
+                moduleRATInfo.get(moduleName).addUnapproved(resources);
+            }
+        }
+    }
+
+    private void doPopulateApproved(Map<String, ModuleInfo> moduleRATInfo, Element rootElement, XPath path) throws XPathExpressionException {
+        NodeList evaluate = (NodeList) path.evaluate("descendant::resource[license-approval/@name=\"true\"]", rootElement, XPathConstants.NODESET);
+        for (int i = 0; i < evaluate.getLength(); i++) {
+            String resources = evaluate.item(i).getAttributes().getNamedItem("name").getTextContent().replaceFirst(root.getPath() + File.separator, "");
+            String moduleName = getModuleName(resources);
+            if (!moduleRATInfo.containsKey(moduleName)) {
+                moduleRATInfo.get(NOT_CLUSTER).addApproved(resources);
+            } else {
+                moduleRATInfo.get(moduleName).addApproved(resources);
+            }
+
+        }
+    }
+
+    private void doCheckExternal(Map<String, ModuleInfo> moduleRATInfo) {
+        for (Map.Entry<String, ModuleInfo> minfo : moduleRATInfo.entrySet()) {
+            File binaryList = new File(minfo.getValue().getFolder(), File.separator + "external" + File.separator + "binaries-list");
+            if (binaryList.exists()) {
+                try (BufferedReader br = new BufferedReader(new FileReader(binaryList))) {
+                    String line = br.readLine();
+                    while (line != null) {
+                        if (line.trim().startsWith("#") || line.trim().isEmpty()) {
+                            // comment
+                        } else {
+                            String[] splitedExternalInfo = line.split(" ");
+
+                            String[] mavenizedExternal = splitedExternalInfo[1].split(":");
+                            if (mavenizedExternal.length != 3) {
+                                minfo.getValue().addInvalidExternal(splitedExternalInfo[1]);
+                            }
+                        }
+                        line = br.readLine();
+                    }
+                } catch (FileNotFoundException ex) {
+                    Logger.getLogger(RatReportTask.class.getName()).log(Level.SEVERE, null, ex);
+                } catch (IOException ex) {
+                    Logger.getLogger(RatReportTask.class.getName()).log(Level.SEVERE, null, ex);
+                }
+
+            }
+        }
+    }
+
+    private String getModuleName(String resource) {
+        String moduleName;
+        if (!resource.contains(File.separator)) {
+            moduleName = NOT_CLUSTER;
+        } else {
+            moduleName = resource.substring(0, resource.indexOf(File.separator));
+        }
+        return moduleName;
+    }
+
+    class ModuleInfo {
+// approved resource list
+// very simple string for now.
+
+        private final Set<String> approved = new HashSet<>();
+        // unapproved resource list
+        private final Set<String> unapproved = new HashSet<>();
+
+        private final Set<String> external = new HashSet<>();
+        private final File folder;
+
+        private ModuleInfo(File moduleFolder) {
+            this.folder = moduleFolder;
+        }
+
+        private File getFolder() {
+            return folder;
+        }
+
+        private void addApproved(String resources) {
+            approved.add(resources);
+        }
+
+        private void addInvalidExternal(String resources) {
+            external.add(resources);
+        }
+
+        private void addUnapproved(String resources) {
+            unapproved.add(resources);
+        }
+
+        private Set<String> getUnapproved() {
+            return unapproved;
+        }
+
+        private Set<String> getInvalidExternal() {
+            return external;
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/162850d6/nbbuild/build.xml
----------------------------------------------------------------------
diff --git a/nbbuild/build.xml b/nbbuild/build.xml
index f1713de..2e6e593 100644
--- a/nbbuild/build.xml
+++ b/nbbuild/build.xml
@@ -1946,6 +1946,95 @@ It is possible to use -Ddebug.port=3234 -Ddebug.pause=y to start the system in d
                 <pathelement location="external/apache-rat-0.12.jar"/>
             </classpath>
         </taskdef>
+        <patternset id="non.rat">
+            <exclude name="*/build/**" />
+            <exclude name="nbbuild/netbeans/**" />
+            <exclude name="**/*.mf" /> <!--do not nativelly support comments-->
+            <exclude name="*/nbproject/*.sig" /> <!--generated signatures for past versions-->
+            <exclude name="*/nbproject/build-impl.xml" /> <!--generated, no degree of creativity -->
+            <exclude name="*/nbproject/jfx-impl.xml" /> <!--generated, no degree of creativity -->
+            <exclude name="*/nbproject/genfiles.properties" /> <!--generated, no degree of creativity -->
+            <exclude name="*/nbproject/private/**" /> <!--user-specific files -->
+            <exclude name="*/external/*-license.txt" /> <!--licenses for external dependencies-->
+            <exclude name="*/external/*-notice.txt" /> <!--notices for external dependencies-->
+            <exclude name="**/*.pass" /> <!--generated test files-->
+            <exclude name="**/*.pass2" /> <!--generated test files-->
+            <exclude name="**/*.ref" /> <!--would cause tests to fail-->
+            <exclude name="**/.list" /> <!--no degree of creativity-->
+            <exclude name="**/src/META-INF/**" /> <!--no degree of creativity-->
+            <exclude name="form/test/unit/data/goldenfiles/*" /> <!--test data-->
+            <exclude name="diff/test/unit/data/**" /> <!--test data-->
+            <exclude name="diff/test/unit/src/org/netbeans/modules/diff/builtin/provider/*.txt" /> <!--test data-->
+            <exclude name="diff/test/unit/src/org/netbeans/modules/diff/builtin/visualizer/data/**" /> <!--test data-->
+            <exclude name="javadoc/test/unit/data/docs_jdk14_ja/api/index-files/**" /> <!--test data-->
+            <exclude name="javafx2.project/src/org/netbeans/modules/javafx2/project/templates/**" /> <!--license would be visible when users edit the templates inside their IDE-->
+            <exclude name="utilities/test/unit/src/org/netbeans/modules/openfile/resources/recent_files/*" /> <!--test data-->
+            <exclude name="**/*.url" /> <!--no degree of creativity-->
+            <exclude name="spi.navigator/test/unit/src/org/netbeans/modules/navigator/resources/lastsel/file.lastsel_mime1" /> <!--empty file-->
+            <exclude name="xml/test/unit/src/org/netbeans/modules/xml/resources/*" /> <!-- test data -->
+            <exclude name="xml/src/org/netbeans/modules/xml/resources/templates/*" /> <!-- template files - tracked by https://issues.apache.org/jira/browse/NETBEANS-85 -->
+            <exclude name="xml.axi/test/unit/src/org/netbeans/modules/xml/axi/resources/**" /> <!-- test data -->
+            <exclude name="xml.schema.completion/test/unit/src/org/netbeans/modules/xml/schema/completion/resources/**" /> <!-- test data -->
+            <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.wsdl" /> <!-- test data -->
+            <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.xml" /> <!-- test data -->
+            <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.xsd" /> <!-- test data -->
+            <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.bpel" /> <!-- test data -->
+            <exclude name="xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/*.dtd" /> <!-- test data -->
+            <exclude name="xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/*.xml" /> <!-- test data -->
+            <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.xml" /> <!-- test data -->
+            <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.dtd" /> <!-- test data -->
+            <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.txt" /> <!-- test data -->
+            <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/**/*.xsd" /> <!-- test data -->
+            <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/*.xml" /> <!-- test data -->
+            <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/*.zip" /> <!-- test data -->
+            <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/dummyProject/nbproject/private/tmpfile" /> <!-- test data -->
+            <exclude name="xml.wsdl.model/test/unit/src/org/netbeans/modules/xml/wsdl/**/*.wsdl" /> <!-- test data -->
+            <exclude name="xml.wsdl.model/test/unit/src/org/netbeans/modules/xml/wsdl/**/*.xsd" /> <!-- test data -->
+            <exclude name="xml.wsdl.model/test/unit/src/org/netbeans/modules/xml/wsdl/**/*.xml" /> <!-- test data -->
+            <exclude name="xml.text/src/org/netbeans/modules/xml/text/resources/DTDExample" /> <!-- GUI sample file to demonstrate syntax highlighting -->
+            <exclude name="xml.text/src/org/netbeans/modules/xml/text/resources/XMLExample" /> <!-- GUI sample file to demonstrate syntax highlighting -->
+            <exclude name="xml.text/test/qa-functional/src/org/netbeans/modules/xml/text/**/data/**" /> <!-- test data -->
+            <exclude name="xsl/src/org/netbeans/modules/xsl/resources/templates/stylesheet.xsl" /> <!-- Template for user - very limited degree of creativity -->
+            <exclude name="xsl/test/unit/src/org/netbeans/modules/xsl/utils/data/*" /> <!--test data-->
+            <exclude name="spi.navigator/test/unit/src/org/netbeans/modules/navigator/resources/lastsel/file.lastsel_mime1" /> <!--empty file-->
+            <exclude name="templates/src/org/netbeans/modules/templates/resources/userprop.txt" /> <!--no degree of creativity-->
+            <exclude name="api.search/test/unit/data/textFiles/utf8file.txt" /> <!--test data-->
+            <exclude name="api.search/test/unit/src/org/netbeans/modules/search/data/**" /> <!--test data-->
+            <exclude name="beans/src/org/netbeans/modules/beans/resources/templates/*.template" /> <!--license would be visible when users edit the templates inside their IDE-->
+            <exclude name="extbrowser/test/unit/src/org/netbeans/modules/extbrowser/data/mac_defaults_*" /> <!--test data-->
+            <exclude name="spring.beans/src/org/netbeans/modules/spring/beans/resources/templates/*.template" /> <!--license would be visible when users edit the templates inside their IDE-->
+            <exclude name="debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/testapps/JspLineBreakpointApp.txt" /> <!-- test data -->
+            <exclude name="editor.settings.storage/test/unit/src/org/netbeans/modules/editor/settings/storage/compatibility/p1/**" /> <!--test data-->
+            <exclude name="editor.plain/src/org/netbeans/modules/editor/plain/resources/PlainTextExample" /> <!--license would be visible to users in the Fonts/Colors settings-->
+            <exclude name="editor.fold/test/unit/data/goldenfiles/hierarchy/update-hierarchy.folds" /> <!--test data-->
+            <exclude name="editor.fold/test/unit/data/hierarchy/update-hierarchy.folds" /> <!--test data-->
+            <exclude name="editor.fold/test/unit/src/org/netbeans/modules/editor/fold/FoldContentReader.txt" /> <!--test data-->
+            <exclude name="libs.freemarker/test/unit/data/**" /> <!--test data-->
+            <exclude name="languages.yaml/src/org/netbeans/modules/languages/yaml/*.yml" /> <!--Files used in GUI as sample/starting point-->
+            <exclude name="languages.yaml/src/org/netbeans/modules/languages/yaml/*.yaml" /> <!--Files used in GUI as sample/starting point-->
+            <exclude name="languages.yaml/test/unit/data/testfiles/*" /> <!--test data-->
+            <exclude name="versioning.core/test/unit/data/workdir/root/a.txt" /> <!--test data-->
+            <exclude name="versioning.core/test/unit/data/workdir/root-test-versioned/**" /> <!--test data-->
+            <exclude name="versioning.core/test/unit/data/workdir/root-with-exclusions/**" /> <!--test data-->
+            <exclude name="websvc.saas.kit/release/VERSION.txt" /> <!--generated file-->
+            <exclude name="versioning/test/unit/data/workdir/root/a.txt" /> <!--test data-->
+            <exclude name="versioning/test/unit/data/workdir/root-test-versioned/**" /> <!--test data-->
+            <exclude name="versioning/test/unit/data/workdir/root-with-exclusions/**" /> <!--test data-->
+            <exclude name="testng.ui/src/org/netbeans/modules/testng/ui/resources/*.template" /> <!--template files-->
+            <exclude name="languages.diff/src/org/netbeans/modules/languages/diff/DiffExample.diff" /> <!--license would be visible to users in the Fonts/Colors settings-->
+            <exclude name="versioning.util/test/unit/data/historycache/*" /> <!--test data-->
+            <exclude name="java.lexer/test/unit/data/testfiles/*" /> <!--test data-->
+            <exclude name="spellchecker.dictionary_en/release/modules/dict/*.description" /> <!--Description Files-->
+            <exclude name="selenium2.java/src/org/netbeans/modules/selenium2/java/SeleneseIT.java.template" /> <!--template file-->
+            <exclude name="projectuiapi/test/unit/data/*.txt" /> <!--test data-->
+            <exclude name="projectuiapi/test/unit/src/org/netbeans/modules/project/uiapi/data/*.txt" /> <!--test data-->
+            <exclude name="projectui/src/org/netbeans/modules/project/ui/resources/*-license.txt" /> <!--licenses-->
+            <exclude name="projectui/src/org/netbeans/modules/project/ui/resources/license-default.txt" /> <!--licenses-->
+            <exclude name="java.editor/src/org/netbeans/modules/java/editor/resources/JavaExample" /> <!--no degree of creativity-->
+            <exclude name="java.editor/test/qa-functional/data/**" /> <!--test data-->
+            <exclude name="java.editor/test/unit/data/**" /> <!--test data-->
+            <exclude name="java.editor.base/test/unit/data/**" /> <!--test data-->
+        </patternset>
         <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportfile="build/rat-report.txt">
             <rat:substringMatcher licenseFamilyCategory="w3c2" licenseFamilyName="W3C Software and Document Notice and License">
                 <pattern substring="W3C Software and Document Notice and License"/>
@@ -1961,96 +2050,32 @@ It is possible to use -Ddebug.port=3234 -Ddebug.pause=y to start the system in d
             <rat:approvedLicense familyName="W3C Software and Document Notice and License"/>
             <rat:approvedLicense familyName="OASIS"/>
             <rat:approvedLicense familyName="WSDL Schema Files" />
-            <fileset dir="${nb_all}">
-                <exclude name="*/build/**" />
-                <exclude name="nbbuild/netbeans/**" />
-                <exclude name="**/*.mf" /> <!--do not nativelly support comments-->
-                <exclude name="*/nbproject/*.sig" /> <!--generated signatures for past versions-->
-                <exclude name="*/nbproject/build-impl.xml" /> <!--generated, no degree of creativity -->
-                <exclude name="*/nbproject/jfx-impl.xml" /> <!--generated, no degree of creativity -->
-                <exclude name="*/nbproject/genfiles.properties" /> <!--generated, no degree of creativity -->
-                <exclude name="*/nbproject/private/**" /> <!--user-specific files -->
-                <exclude name="*/external/*-license.txt" /> <!--licenses for external dependencies-->
-                <exclude name="*/external/*-notice.txt" /> <!--notices for external dependencies-->
-                <exclude name="**/*.pass" /> <!--generated test files-->
-                <exclude name="**/*.pass2" /> <!--generated test files-->
-                <exclude name="**/*.ref" /> <!--would cause tests to fail-->
-                <exclude name="**/.list" /> <!--no degree of creativity-->
-                <exclude name="**/src/META-INF/**" /> <!--no degree of creativity-->
-                <exclude name="form/test/unit/data/goldenfiles/*" /> <!--test data-->
-                <exclude name="diff/test/unit/data/**" /> <!--test data-->
-                <exclude name="diff/test/unit/src/org/netbeans/modules/diff/builtin/provider/*.txt" /> <!--test data-->
-                <exclude name="diff/test/unit/src/org/netbeans/modules/diff/builtin/visualizer/data/**" /> <!--test data-->
-                <exclude name="javadoc/test/unit/data/docs_jdk14_ja/api/index-files/**" /> <!--test data-->
-                <exclude name="javafx2.project/src/org/netbeans/modules/javafx2/project/templates/**" /> <!--license would be visible when users edit the templates inside their IDE-->
-                <exclude name="utilities/test/unit/src/org/netbeans/modules/openfile/resources/recent_files/*" /> <!--test data-->
-                <exclude name="**/*.url" /> <!--no degree of creativity-->
-		<exclude name="spi.navigator/test/unit/src/org/netbeans/modules/navigator/resources/lastsel/file.lastsel_mime1" /> <!--empty file-->    
-                <exclude name="xml/test/unit/src/org/netbeans/modules/xml/resources/*" /> <!-- test data -->
-                <exclude name="xml/src/org/netbeans/modules/xml/resources/templates/*" /> <!-- template files - tracked by https://issues.apache.org/jira/browse/NETBEANS-85 -->
-                <exclude name="xml.axi/test/unit/src/org/netbeans/modules/xml/axi/resources/**" /> <!-- test data -->
-                <exclude name="xml.schema.completion/test/unit/src/org/netbeans/modules/xml/schema/completion/resources/**" /> <!-- test data -->
-                <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.wsdl" /> <!-- test data -->
-                <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.xml" /> <!-- test data -->
-                <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.xsd" /> <!-- test data -->
-                <exclude name="xml.xdm/test/unit/src/org/netbeans/modules/xml/xdm/**/*.bpel" /> <!-- test data -->
-                <exclude name="xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/*.dtd" /> <!-- test data -->
-                <exclude name="xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/*.xml" /> <!-- test data -->
-                <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.xml" /> <!-- test data -->
-                <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.dtd" /> <!-- test data -->
-                <exclude name="xml.tools/test/qa-functional/src/org/netbeans/modules/**/*.txt" /> <!-- test data -->
-                <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/**/*.xsd" /> <!-- test data -->
-                <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/*.xml" /> <!-- test data -->
-                <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/*.zip" /> <!-- test data -->
-                <exclude name="xml.schema.model/test/unit/src/org/netbeans/modules/xml/schema/model/resources/dummyProject/nbproject/private/tmpfile" /> <!-- test data -->
-                <exclude name="xml.wsdl.model/test/unit/src/org/netbeans/modules/xml/wsdl/**/*.wsdl" /> <!-- test data -->
-                <exclude name="xml.wsdl.model/test/unit/src/org/netbeans/modules/xml/wsdl/**/*.xsd" /> <!-- test data -->
-                <exclude name="xml.wsdl.model/test/unit/src/org/netbeans/modules/xml/wsdl/**/*.xml" /> <!-- test data -->
-                <exclude name="xml.text/src/org/netbeans/modules/xml/text/resources/DTDExample" /> <!-- GUI sample file to demonstrate syntax highlighting -->
-                <exclude name="xml.text/src/org/netbeans/modules/xml/text/resources/XMLExample" /> <!-- GUI sample file to demonstrate syntax highlighting -->
-                <exclude name="xml.text/test/qa-functional/src/org/netbeans/modules/xml/text/**/data/**" /> <!-- test data -->
-                <exclude name="xsl/src/org/netbeans/modules/xsl/resources/templates/stylesheet.xsl" /> <!-- Template for user - very limited degree of creativity -->
-                <exclude name="xsl/test/unit/src/org/netbeans/modules/xsl/utils/data/*" /> <!--test data-->
-                <exclude name="spi.navigator/test/unit/src/org/netbeans/modules/navigator/resources/lastsel/file.lastsel_mime1" /> <!--empty file-->    
-                <exclude name="templates/src/org/netbeans/modules/templates/resources/userprop.txt" /> <!--no degree of creativity-->
-                <exclude name="api.search/test/unit/data/textFiles/utf8file.txt" /> <!--test data-->
-                <exclude name="api.search/test/unit/src/org/netbeans/modules/search/data/**" /> <!--test data-->
-                <exclude name="beans/src/org/netbeans/modules/beans/resources/templates/*.template" /> <!--license would be visible when users edit the templates inside their IDE-->
-                <exclude name="extbrowser/test/unit/src/org/netbeans/modules/extbrowser/data/mac_defaults_*" /> <!--test data-->
-                <exclude name="spring.beans/src/org/netbeans/modules/spring/beans/resources/templates/*.template" /> <!--license would be visible when users edit the templates inside their IDE-->
-                <exclude name="debugger.jpda/test/unit/src/org/netbeans/api/debugger/jpda/testapps/JspLineBreakpointApp.txt" /> <!-- test data -->
-                <exclude name="editor.settings.storage/test/unit/src/org/netbeans/modules/editor/settings/storage/compatibility/p1/**" /> <!--test data-->
-                <exclude name="editor.plain/src/org/netbeans/modules/editor/plain/resources/PlainTextExample" /> <!--license would be visible to users in the Fonts/Colors settings-->
-                <exclude name="editor.fold/test/unit/data/goldenfiles/hierarchy/update-hierarchy.folds" /> <!--test data-->
-                <exclude name="editor.fold/test/unit/data/hierarchy/update-hierarchy.folds" /> <!--test data-->
-                <exclude name="editor.fold/test/unit/src/org/netbeans/modules/editor/fold/FoldContentReader.txt" /> <!--test data-->
-                <exclude name="libs.freemarker/test/unit/data/**" /> <!--test data-->
-                <exclude name="languages.yaml/src/org/netbeans/modules/languages/yaml/*.yml" /> <!--Files used in GUI as sample/starting point-->
-                <exclude name="languages.yaml/src/org/netbeans/modules/languages/yaml/*.yaml" /> <!--Files used in GUI as sample/starting point-->
-                <exclude name="languages.yaml/test/unit/data/testfiles/*" /> <!--test data-->
-                <exclude name="versioning.core/test/unit/data/workdir/root/a.txt" /> <!--test data-->
-                <exclude name="versioning.core/test/unit/data/workdir/root-test-versioned/**" /> <!--test data-->
-                <exclude name="versioning.core/test/unit/data/workdir/root-with-exclusions/**" /> <!--test data-->
-                <exclude name="websvc.saas.kit/release/VERSION.txt" /> <!--generated file-->
-                <exclude name="versioning/test/unit/data/workdir/root/a.txt" /> <!--test data-->
-                <exclude name="versioning/test/unit/data/workdir/root-test-versioned/**" /> <!--test data-->
-                <exclude name="versioning/test/unit/data/workdir/root-with-exclusions/**" /> <!--test data-->
-                <exclude name="testng.ui/src/org/netbeans/modules/testng/ui/resources/*.template" /> <!--template files-->
-                <exclude name="languages.diff/src/org/netbeans/modules/languages/diff/DiffExample.diff" /> <!--license would be visible to users in the Fonts/Colors settings-->
-                <exclude name="versioning.util/test/unit/data/historycache/*" /> <!--test data-->
-                <exclude name="java.lexer/test/unit/data/testfiles/*" /> <!--test data-->
-                <exclude name="spellchecker.dictionary_en/release/modules/dict/*.description" /> <!--Description Files-->
-                <exclude name="selenium2.java/src/org/netbeans/modules/selenium2/java/SeleneseIT.java.template" /> <!--template file-->
-                <exclude name="projectuiapi/test/unit/data/*.txt" /> <!--test data-->
-                <exclude name="projectuiapi/test/unit/src/org/netbeans/modules/project/uiapi/data/*.txt" /> <!--test data-->
-                <exclude name="projectui/src/org/netbeans/modules/project/ui/resources/*-license.txt" /> <!--licenses-->
-                <exclude name="projectui/src/org/netbeans/modules/project/ui/resources/license-default.txt" /> <!--licenses-->
-                <exclude name="java.editor/src/org/netbeans/modules/java/editor/resources/JavaExample" /> <!--no degree of creativity-->
-                <exclude name="java.editor/test/qa-functional/data/**" /> <!--test data-->
-                <exclude name="java.editor/test/unit/data/**" /> <!--test data-->
-                <exclude name="java.editor.base/test/unit/data/**" /> <!--test data-->
+	    <fileset dir="${nb_all}">
+                <patternset refid="non.rat" />
+            </fileset>
+        </rat:report>
+        <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" format="xml" reportfile="build/rat-report.xml">
+            <rat:substringMatcher licenseFamilyCategory="w3c2" licenseFamilyName="W3C Software and Document Notice and License">
+                <pattern substring="W3C Software and Document Notice and License"/>
+            </rat:substringMatcher>
+            <rat:substringMatcher licenseFamilyCategory="oasis" licenseFamilyName="OASIS">
+                <pattern substring="[OASIS]"/>
+            </rat:substringMatcher>
+            <rat:fullTextMatcher licenseFamilyCategory="wsdl" licenseFamilyName="WSDL Schema Files">
+                International Business Machines Corporation and Microsoft Corporation
+                All Rights Reserved
+                License for WSDL Schema Files
+            </rat:fullTextMatcher>
+            <rat:approvedLicense familyName="W3C Software and Document Notice and License"/>
+            <rat:approvedLicense familyName="OASIS"/>
+            <rat:approvedLicense familyName="WSDL Schema Files" />
+	    <fileset dir="${nb_all}">
+                <patternset refid="non.rat" />
             </fileset>
         </rat:report>
+        <taskdef name="rattohtml" classname="org.netbeans.nbbuild.RatReportTask" classpath="${build.ant.classes.dir}"/>
+        <loadproperties srcFile="cluster.properties" />
+        <rattohtml source="build/rat-report.xml" report="${nb.build.dir}/rat/"/>
     </target>
 
 </project>