[ https://issues.apache.org/jira/browse/KAFKA-7308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16584814#comment-16584814 ]
ASF GitHub Bot commented on KAFKA-7308: --------------------------------------- ijuma closed pull request #5529: KAFKA-7308: Fix rat and checkstyle config for Java 11 support URL: https://github.com/apache/kafka/pull/5529 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/build.gradle b/build.gradle index f8dfeb7fc72..0892ed19402 100644 --- a/build.gradle +++ b/build.gradle @@ -109,12 +109,12 @@ ext { apply from: file('wrapper.gradle') -if (new File('.git').exists()) { +if (file('.git').exists()) { apply from: file('gradle/rat.gradle') rat { // Exclude everything under the directory that git should be ignoring via .gitignore or that isn't checked in. These // restrict us only to files that are checked in or are staged. - def repo = Grgit.open(project.file('.')) + def repo = Grgit.open(project.getRootDir()) excludes = new ArrayList<String>(repo.clean(ignore: false, directories: true, dryRun: true)) // And some of the files that we have checked in should also be excluded from this check excludes.addAll([ @@ -359,7 +359,7 @@ subprojects { checkstyle { configFile = new File(rootDir, "checkstyle/checkstyle.xml") - configProperties = [importControlFile: "$rootDir/checkstyle/import-control.xml"] + configProperties = checkstyleConfigProperties("import-control.xml") toolVersion = '8.10' } test.dependsOn('checkstyleMain', 'checkstyleTest') @@ -444,6 +444,12 @@ def fineTuneEclipseClasspathFile(eclipse, project) { } } +def checkstyleConfigProperties(configFileName) { + [importControlFile: "$rootDir/checkstyle/$configFileName", + suppressionsFile: "$rootDir/checkstyle/suppressions.xml", + headerFile: "$rootDir/checkstyle/java.header"] +} + // Aggregates all jacoco results into the root project directory task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) { def javaProjects = subprojects.findAll { it.path != ':core' } @@ -775,7 +781,7 @@ project(':core') { systemTestLibs.dependsOn('jar', 'testJar', 'copyDependantTestLibs') checkstyle { - configProperties = [importControlFile: "$rootDir/checkstyle/import-control-core.xml"] + configProperties = checkstyleConfigProperties("import-control-core.xml") } } @@ -791,7 +797,7 @@ project(':examples') { } checkstyle { - configProperties = [importControlFile: "$rootDir/checkstyle/import-control-core.xml"] + configProperties = checkstyleConfigProperties("import-control-core.xml") } } diff --git a/checkstyle/checkstyle.xml b/checkstyle/checkstyle.xml index 6eb1a82dde0..13cfdb82bd0 100644 --- a/checkstyle/checkstyle.xml +++ b/checkstyle/checkstyle.xml @@ -25,7 +25,7 @@ <!-- header --> <module name="Header"> - <property name="headerFile" value="checkstyle/java.header" /> + <property name="headerFile" value="${headerFile}" /> </module> <module name="TreeWalker"> @@ -137,6 +137,6 @@ </module> <module name="SuppressionFilter"> - <property name="file" value="checkstyle/suppressions.xml"/> + <property name="file" value="${suppressionsFile}"/> </module> </module> diff --git a/gradle/rat.gradle b/gradle/rat.gradle index a51876c23ea..513e9520ed6 100644 --- a/gradle/rat.gradle +++ b/gradle/rat.gradle @@ -17,9 +17,6 @@ * under the License. */ -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.Task import org.gradle.api.internal.project.IsolatedAntBuilder apply plugin: RatPlugin @@ -28,18 +25,19 @@ class RatTask extends DefaultTask { @Input List<String> excludes - def reportPath = 'build/rat' - def stylesheet = 'gradle/resources/rat-output-to-html.xsl' - def xmlReport = reportPath + '/rat-report.xml' - def htmlReport = reportPath + '/rat-report.html' + def reportDir = project.file('build/rat') + def stylesheet = project.file('gradle/resources/rat-output-to-html.xsl').getAbsolutePath() + def xmlReport = new File(reportDir, 'rat-report.xml') + def htmlReport = new File(reportDir, 'rat-report.html') def generateXmlReport(File reportDir) { def antBuilder = services.get(IsolatedAntBuilder) def ratClasspath = project.configurations.rat + def projectPath = project.getRootDir().getAbsolutePath() antBuilder.withClasspath(ratClasspath).execute { ant.taskdef(resource: 'org/apache/rat/anttasks/antlib.xml') ant.report(format: 'xml', reportFile: xmlReport) { - fileset(dir: ".") { + fileset(dir: projectPath) { patternset { excludes.each { exclude(name: it) @@ -80,7 +78,6 @@ class RatTask extends DefaultTask { @TaskAction def rat() { - File reportDir = new File(reportPath) if (!reportDir.exists()) { reportDir.mkdirs() } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix rat and checkstyle plugins configuration for Java 11 support > ---------------------------------------------------------------- > > Key: KAFKA-7308 > URL: https://issues.apache.org/jira/browse/KAFKA-7308 > Project: Kafka > Issue Type: Sub-task > Reporter: Ismael Juma > Assignee: Ismael Juma > Priority: Major > Fix For: 2.1.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)