Skip to content

Commit

Permalink
config: migrate all openjdk repositories in projects-to-test-on to gi…
Browse files Browse the repository at this point in the history
…thub mirrors(#524)
  • Loading branch information
nrmancuso committed Jan 6, 2021
1 parent db4e362 commit 295bf49
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 87 deletions.
64 changes: 0 additions & 64 deletions checkstyle-tester/launch.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -248,77 +248,13 @@ 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,
value: getOsSpecificPath("$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<String>()
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)
Expand Down
17 changes: 0 additions & 17 deletions checkstyle-tester/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<checkstyle-plugin.version>3.1.1</checkstyle-plugin.version>
<checkstyle.version>8.40-SNAPSHOT</checkstyle.version>
<sevntu-checkstyle.version>1.38.0</sevntu-checkstyle.version>
<jxr-plugin.version>2.5</jxr-plugin.version>
<checkstyle.config.location>https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml</checkstyle.config.location>
<checkstyle.failsOnError>true</checkstyle.failsOnError>
</properties>
Expand All @@ -36,11 +35,6 @@
<artifactId>sevntu-checks</artifactId>
<version>${sevntu-checkstyle.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>${jxr-plugin.version}</version>
</dependency>
</dependencies>
</plugin>

Expand Down Expand Up @@ -70,17 +64,6 @@
<failsOnError>${checkstyle.failsOnError}</failsOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>${jxr-plugin.version}</version>
<!-- plugin do not have ability to define followinng by system property -->
<configuration>
<excludes>
<exclude>**/.ci-temp/**/*</exclude>
</excludes>
</configuration>
</plugin>

</plugins>
</reporting>
Expand Down
7 changes: 1 addition & 6 deletions checkstyle-tester/projects-to-test-on.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
#sevntu-checkstyle|git|https://github.com/sevntu-checkstyle/sevntu.checkstyle|master||
#checkstyle-sonar|git|https://github.com/checkstyle/sonar-checkstyle|master||

#openjdk7|hg|http://hg.openjdk.java.net/jdk7/jdk7/jdk/|||
#openjdk8|hg|http://hg.openjdk.java.net/jdk8/jdk8/jdk/|default|
#All details at checkstyle/checkstyle#3033: ModalDialogActivationTest till JDK-8166015 ; 'jxc/8073519/**' not compilable by design ; ', jhsdb/**' - checkstyle do not support unicode identifiers
#openjdk9|hg|http://hg.openjdk.java.net/jdk9/jdk9/jdk/|default|**/test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java,**/test/javax/xml/bind/jxc/8073519/**,**/test/sun/tools/jhsdb/**
#openjdk10|hg|http://hg.openjdk.java.net/jdk10/jdk10/jdk/|default|**/test/javax/xml/bind/jxc/8073519/**,**/test/sun/tools/jhsdb/**
#openjdk11|git|https://github.com/openjdk/jdk11u|master||
#openjdk10|git|https://github.com/AdoptOpenJDK/openjdk-jdk10u|dev|**/test/javax/xml/bind/jxc/8073519/**,**/test/sun/tools/jhsdb/**
guava|git|https://github.com/google/guava|v28.2||

#spotbugs|git|https://github.com/spotbugs/spotbugs|3.1.2||
Expand Down

0 comments on commit 295bf49

Please sign in to comment.