diff --git a/bramble-api/build.gradle b/bramble-api/build.gradle index 926386b02..dbf8cf973 100644 --- a/bramble-api/build.gradle +++ b/bramble-api/build.gradle @@ -5,6 +5,7 @@ targetCompatibility = 1.8 apply plugin: 'ru.vyarus.animalsniffer' apply plugin: 'witness' apply from: 'witness.gradle' +apply plugin: 'checkstyle' dependencies { implementation "com.google.dagger:dagger:$dagger_version" diff --git a/bramble-core/build.gradle b/bramble-core/build.gradle index 631629342..84e7d8c8e 100644 --- a/bramble-core/build.gradle +++ b/bramble-core/build.gradle @@ -7,6 +7,7 @@ apply plugin: 'idea' apply plugin: 'witness' apply from: 'witness.gradle' apply from: '../dagger.gradle' +apply plugin: 'checkstyle' dependencies { implementation project(path: ':bramble-api', configuration: 'default') diff --git a/bramble-java/build.gradle b/bramble-java/build.gradle index fb3414d7d..9a5a508fa 100644 --- a/bramble-java/build.gradle +++ b/bramble-java/build.gradle @@ -6,6 +6,7 @@ apply plugin: 'idea' apply plugin: 'witness' apply from: 'witness.gradle' apply from: '../dagger.gradle' +apply plugin: 'checkstyle' configurations { tor diff --git a/briar-android/build.gradle b/briar-android/build.gradle index f2f325e57..e397dc1d5 100644 --- a/briar-android/build.gradle +++ b/briar-android/build.gradle @@ -1,6 +1,10 @@ apply plugin: 'com.android.application' apply plugin: 'witness' apply from: 'witness.gradle' +apply plugin: 'checkstyle' +// Need to manually apply this as the Java plugin is not applied to this module hence this is not +// done automatically. +apply from: "${rootProject.rootDir}/gradle/checkstyle.gradle" def getStdout = { command, defaultValue -> def stdout = new ByteArrayOutputStream() diff --git a/briar-api/build.gradle b/briar-api/build.gradle index 06b7700af..719cd4ae1 100644 --- a/briar-api/build.gradle +++ b/briar-api/build.gradle @@ -5,6 +5,7 @@ targetCompatibility = 1.8 apply plugin: 'ru.vyarus.animalsniffer' apply plugin: 'witness' apply from: 'witness.gradle' +apply plugin: 'checkstyle' dependencies { implementation project(path: ':bramble-api', configuration: 'default') diff --git a/briar-core/build.gradle b/briar-core/build.gradle index 481c0b5c3..eeec8609e 100644 --- a/briar-core/build.gradle +++ b/briar-core/build.gradle @@ -7,6 +7,7 @@ apply plugin: 'idea' apply plugin: 'witness' apply from: 'witness.gradle' apply from: '../dagger.gradle' +apply plugin: 'checkstyle' dependencies { implementation project(path: ':briar-api', configuration: 'default') diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 000000000..49f802bdf --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/gradle/checkstyle.gradle b/gradle/checkstyle.gradle new file mode 100644 index 000000000..a280dc68c --- /dev/null +++ b/gradle/checkstyle.gradle @@ -0,0 +1,29 @@ +task checkstyleMain(type: Checkstyle) { + source 'src/main/java' + include '**/*.java' + classpath = files() + reports { + xml { + destination file("build/reports/checkstyle/main.xml") + } + html { + destination file("build/reports/checkstyle/main.html") + } + } + check.dependsOn it +} + +task checkstyleTest(type: Checkstyle) { + source 'src/test/java' + include '**/*.java' + classpath = files() + reports { + xml { + destination file("build/reports/checkstyle/test.xml") + } + html { + destination file("build/reports/checkstyle/test.html") + } + } + check.dependsOn it +}