From 7a8ff4bb4ae98736b180984300fc02e7027182ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Sun, 1 Oct 2023 16:15:59 +0200 Subject: [PATCH] fix build --- build.gradle | 5 +- gradle/quality/checkstyle.gradle | 19 + gradle/quality/checkstyle.xml | 333 ++++++++++++++++++ gradle/quality/cyclonedx.gradle | 11 + gradle/quality/pmd.gradle | 17 + gradle/quality/sonarqube.gradle | 10 + gradle/quality/spotbugs.gradle | 15 + settings.gradle | 1 - .../java/org/xbib/event/async/Context.java | 4 +- 9 files changed, 411 insertions(+), 4 deletions(-) create mode 100644 gradle/quality/checkstyle.gradle create mode 100644 gradle/quality/checkstyle.xml create mode 100644 gradle/quality/cyclonedx.gradle create mode 100644 gradle/quality/pmd.gradle create mode 100644 gradle/quality/sonarqube.gradle create mode 100644 gradle/quality/spotbugs.gradle diff --git a/build.gradle b/build.gradle index d967624..bd6f865 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id 'maven-publish' id 'signing' id "io.github.gradle-nexus.publish-plugin" version "2.0.0-rc-1" - id "com.github.spotbugs" version "6.0.0-beta.3" + //id "com.github.spotbugs" version "6.0.0-beta.3" id "org.cyclonedx.bom" version "1.7.4" id "org.xbib.gradle.plugin.asciidoctor" version "3.0.0" } @@ -34,6 +34,9 @@ apply plugin: 'java-library' apply from: rootProject.file('gradle/compile/java.gradle') apply from: rootProject.file('gradle/test/junit5.gradle') apply from: rootProject.file('gradle/repositories/maven.gradle') +apply from: rootProject.file('gradle/quality/checkstyle.gradle') +apply from: rootProject.file('gradle/quality/pmd.gradle') +//apply from: rootProject.file('gradle/quality/spotbugs.gradle') apply from: rootProject.file('gradle/publish/maven.gradle') dependencies { diff --git a/gradle/quality/checkstyle.gradle b/gradle/quality/checkstyle.gradle new file mode 100644 index 0000000..85b8bd8 --- /dev/null +++ b/gradle/quality/checkstyle.gradle @@ -0,0 +1,19 @@ + +apply plugin: 'checkstyle' + +tasks.withType(Checkstyle) { + ignoreFailures = true + reports { + xml.getRequired().set(true) + html.getRequired().set(true) + } +} + +checkstyle { + configFile = rootProject.file('gradle/quality/checkstyle.xml') + ignoreFailures = true + showViolations = true + checkstyleMain { + source = sourceSets.main.allSource + } +} diff --git a/gradle/quality/checkstyle.xml b/gradle/quality/checkstyle.xml new file mode 100644 index 0000000..66a9aae --- /dev/null +++ b/gradle/quality/checkstyle.xml @@ -0,0 +1,333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradle/quality/cyclonedx.gradle b/gradle/quality/cyclonedx.gradle new file mode 100644 index 0000000..d94a87c --- /dev/null +++ b/gradle/quality/cyclonedx.gradle @@ -0,0 +1,11 @@ +cyclonedxBom { + includeConfigs = [ 'runtimeClasspath' ] + skipConfigs = [ 'compileClasspath', 'testCompileClasspath' ] + projectType = "library" + schemaVersion = "1.4" + destination = file("build/reports") + outputName = "bom" + outputFormat = "json" + includeBomSerialNumber = true + componentVersion = "2.0.0" +} \ No newline at end of file diff --git a/gradle/quality/pmd.gradle b/gradle/quality/pmd.gradle new file mode 100644 index 0000000..55fcfda --- /dev/null +++ b/gradle/quality/pmd.gradle @@ -0,0 +1,17 @@ + +apply plugin: 'pmd' + +tasks.withType(Pmd) { + ignoreFailures = true + reports { + xml.getRequired().set(true) + html.getRequired().set(true) + } +} + +pmd { + ignoreFailures = true + consoleOutput = false + toolVersion = "6.51.0" + ruleSetFiles = rootProject.files('gradle/quality/pmd/category/java/bestpractices.xml') +} diff --git a/gradle/quality/sonarqube.gradle b/gradle/quality/sonarqube.gradle new file mode 100644 index 0000000..d8eddd0 --- /dev/null +++ b/gradle/quality/sonarqube.gradle @@ -0,0 +1,10 @@ + +sonarqube { + properties { + property "sonar.projectName", "${project.group} ${project.name}" + property "sonar.sourceEncoding", "UTF-8" + property "sonar.tests", "src/test/java" + property "sonar.scm.provider", "git" + property "sonar.junit.reportsPath", "build/test-results/test/" + } +} diff --git a/gradle/quality/spotbugs.gradle b/gradle/quality/spotbugs.gradle new file mode 100644 index 0000000..0b577c9 --- /dev/null +++ b/gradle/quality/spotbugs.gradle @@ -0,0 +1,15 @@ + +apply plugin: 'com.github.spotbugs' + +spotbugs { + //effort = "max" + //reportLevel = "low" + ignoreFailures = true +} + +spotbugsMain { + reports { + xml.getRequired().set(false) + html.getRequired().set(true) + } +} diff --git a/settings.gradle b/settings.gradle index 2fe2aa3..1be399b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -26,7 +26,6 @@ dependencyResolutionManagement { library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit') library('junit-jupiter-platform-launcher', 'org.junit.platform', 'junit-platform-launcher').version('1.10.0') library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2') - //library('junit4', 'junit', 'junit').version('4.13.2') library('settings-api', 'org.xbib', 'settings-api').versionRef('content') library('net', 'org.xbib', 'net').versionRef('net') library('datastructures-common', 'org.xbib', 'datastructures-common').versionRef('datastructures') diff --git a/src/main/java/org/xbib/event/async/Context.java b/src/main/java/org/xbib/event/async/Context.java index 0ab44cf..bf5a52c 100644 --- a/src/main/java/org/xbib/event/async/Context.java +++ b/src/main/java/org/xbib/event/async/Context.java @@ -116,7 +116,7 @@ public interface Context { * Is the current context an event loop context? *

* NOTE! when running blocking code using {@link Async#executeBlocking(Handler, boolean)}, - * the context will still an event loop context and this {@link this#isEventLoopContext()} + * the context will still an event loop context and this {@link #isEventLoopContext()} * will return true. * * @return true if false otherwise @@ -127,7 +127,7 @@ public interface Context { * Is the current context a worker context? *

* NOTE! when running blocking code using {@link Async#executeBlocking(Handler, boolean)}, - * the context will still an event loop context and this {@link this#isWorkerContext()} + * the context will still an event loop context and this {@link #isWorkerContext()} * will return false. * * @return true if the current context is a worker context, false otherwise