From 274889967e5e4ff13a7ef72f03fbd68bf0666cba Mon Sep 17 00:00:00 2001 From: Nick Mancuso Date: Tue, 29 Dec 2020 11:44:24 -0500 Subject: [PATCH] Issue #530: Remove JXR library from launch.groovy --- checkstyle-tester/launch.groovy | 64 --------------------------------- checkstyle-tester/pom.xml | 17 --------- 2 files changed, 81 deletions(-) diff --git a/checkstyle-tester/launch.groovy b/checkstyle-tester/launch.groovy index 8a6a2830..c1940196 100644 --- a/checkstyle-tester/launch.groovy +++ b/checkstyle-tester/launch.groovy @@ -248,15 +248,6 @@ def runMavenExecution(srcDir, excludes, checkstyleConfig, ignoreExceptions, chec } def postProcessCheckstyleReport(targetDir, repoName, repoPath) { - def siteDir = getOsSpecificPath("$targetDir", "site") - println 'linking report to index.html' - new File(getOsSpecificPath("$siteDir", "index.html")).renameTo getOsSpecificPath("$siteDir", "_index.html") - Files.createLink(Paths.get(getOsSpecificPath("$siteDir", "index.html")), - Paths.get(getOsSpecificPath("$siteDir", "checkstyle.html"))) - - removeNonReferencedXrefFiles(siteDir) - removeEmptyDirectories(new File(getOsSpecificPath("$siteDir", "xref"))) - new AntBuilder().replace( file: getOsSpecificPath("$targetDir", "checkstyle-result.xml"), token: new File(getOsSpecificPath("src", "main", "java", "$repoName")).absolutePath, @@ -264,61 +255,6 @@ def postProcessCheckstyleReport(targetDir, repoName, repoPath) { ) } -def removeNonReferencedXrefFiles(siteDir) { - println 'Removing non referenced xref files in report ...' - - def linesFromIndexHtml = Files.readAllLines(Paths.get("$siteDir/index.html")) - def filesReferencedInReport = getFilesReferencedInReport(linesFromIndexHtml) - - def xrefPath = Paths.get(getOsSpecificPath("$siteDir", "xref")) - if (Files.isDirectory(xrefPath)) { - xrefPath.toFile().eachFileRecurse { - fileObj -> - def path = fileObj.path - path = path.substring(path.indexOf("xref")) - if (isWindows()) { - path = path.replace("\\", "/") - } - def fileName = fileObj.name - if (fileObj.isFile() - && !filesReferencedInReport.contains(path) - && 'stylesheet.css' != fileName - && 'allclasses-frame.html' != fileName - && 'index.html' != fileName - && 'overview-frame.html' != fileName - && 'overview-summary.html' != fileName) { - fileObj.delete() - } - } - } -} - -def getFilesReferencedInReport(linesFromIndexHtml) { - def xrefStartIdx = 2 - def pattern = Pattern.compile('\\./xref/[^<>]+\\.html') - def referencedFiles = new HashSet() - linesFromIndexHtml.each { - line -> - def matcher = pattern.matcher(line) - if (matcher.find()) { - referencedFiles.addAll(matcher.collect { it.substring(xrefStartIdx) }) - } - } - return referencedFiles -} - -def removeEmptyDirectories(file) { - def contents = file.listFiles() - if (contents != null) { - for (File f : contents) { - removeEmptyDirectories(f) - } - } - if (file.isDirectory() && file.listFiles().length == 0) { - file.delete() - } -} - def executeCmd(cmd, dir = new File("").getAbsoluteFile()) { println "Running command: ${cmd}" def osSpecificCmd = getOsSpecificCmd(cmd) diff --git a/checkstyle-tester/pom.xml b/checkstyle-tester/pom.xml index c14c2dbf..99037560 100644 --- a/checkstyle-tester/pom.xml +++ b/checkstyle-tester/pom.xml @@ -14,7 +14,6 @@ 3.1.1 8.39-SNAPSHOT 1.38.0 - 2.5 https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml true @@ -36,11 +35,6 @@ sevntu-checks ${sevntu-checkstyle.version} - - org.apache.maven.plugins - maven-jxr-plugin - ${jxr-plugin.version} - @@ -70,17 +64,6 @@ ${checkstyle.failsOnError} - - org.apache.maven.plugins - maven-jxr-plugin - ${jxr-plugin.version} - - - - **/.ci-temp/**/* - - -