diff --git a/README.md b/README.md index 367f765b..6e2cd716 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ and run the Java examples in the book. To compile everything, the command is: -`gradlew build` +`gradlew classes` To run everything (including compiling if necessary), the command is: @@ -15,7 +15,7 @@ To run everything (including compiling if necessary), the command is: To compile only a single chapter (including dependencies), use for example: -`gradlew :strings:build` +`gradlew :strings:classes` To run only a single chapter, say: diff --git a/build.gradle b/build.gradle index 63b5541b..afd39a4a 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,8 @@ subprojects { apply from: "$rootProject.projectDir/gradle/java.gradle" apply from: "$rootProject.projectDir/gradle/junit-jupiter.gradle" apply from: "$rootProject.projectDir/gradle/jmh.gradle" - apply from: "$rootProject.projectDir/gradle/code-analysis.gradle" + apply from: "$rootProject.projectDir/gradle/checkstyle.gradle" + apply from: "$rootProject.projectDir/gradle/findbugs.gradle" apply plugin: 'com.mindviewinc.tagging' } diff --git a/gradle/checkstyle.gradle b/gradle/checkstyle.gradle new file mode 100644 index 00000000..5ba4048d --- /dev/null +++ b/gradle/checkstyle.gradle @@ -0,0 +1,19 @@ +apply plugin: 'checkstyle' + +checkstyle { + ignoreFailures = true + configFile = new File(rootProject.projectDir, 'sun_checks.xml') +} + +tasks.withType(Checkstyle) { + reports { + xml.enabled = false + html.enabled = true + } +} + +task checkstyle { + group = 'Verification' + description = 'Runs Checkstyle analysis for all classes.' + dependsOn tasks.withType(Checkstyle) +} \ No newline at end of file diff --git a/gradle/code-analysis.gradle b/gradle/code-analysis.gradle deleted file mode 100644 index db50436b..00000000 --- a/gradle/code-analysis.gradle +++ /dev/null @@ -1,27 +0,0 @@ -//apply plugin: 'checkstyle' -//apply plugin: 'findbugs' - - // See: http://blog.jessitron.com/2012/07/using-checkstyle-in-gradle.html - // https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml - // http://checkstyle.sourceforge.net/reports/google-java-style.html -/* checkstyle { - // configFile = new File(rootDir, "checkstyle.xml") - toolVersion = '6.7' - }*/ - -/* findbugsMain { - reports { - xml.enabled = false - html.enabled = true - } - ignoreFailures = true - } - - findbugsJmh { - reports { - xml.enabled = false - html.enabled = true - } - ignoreFailures = true - } -*/ \ No newline at end of file diff --git a/gradle/findbugs.gradle b/gradle/findbugs.gradle new file mode 100644 index 00000000..4c0631ce --- /dev/null +++ b/gradle/findbugs.gradle @@ -0,0 +1,18 @@ +apply plugin: 'findbugs' + +findbugs { + ignoreFailures = true +} + +tasks.withType(FindBugs) { + reports { + xml.enabled = false + html.enabled = true + } +} + +task findbugs { + group = 'Verification' + description = 'Runs FindBugs analysis for all classes.' + dependsOn tasks.withType(FindBugs) +} \ No newline at end of file diff --git a/sun_checks.xml b/sun_checks.xml new file mode 100644 index 00000000..34380c59 --- /dev/null +++ b/sun_checks.xml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file