Skip to content

Commit 925482b

Browse files
committed
chore(build): moved checkstyle options into BugsnagBuildPlugin
1 parent 083998a commit 925482b

File tree

7 files changed

+29
-5
lines changed

7 files changed

+29
-5
lines changed

buildSrc/src/main/kotlin/com/bugsnag/android/BugsnagBuildPlugin.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ class BugsnagBuildPlugin : Plugin<Project> {
6767

6868
if (bugsnag.compilesCode) {
6969
project.configureKotlinOptions()
70+
project.configureCheckstyle()
7071

7172
project.apply(from = project.file("../gradle/detekt.gradle"))
72-
project.apply(from = project.file("../gradle/checkstyle.gradle"))
7373
}
7474
}
7575

@@ -215,6 +215,7 @@ class BugsnagBuildPlugin : Plugin<Project> {
215215
plugins.apply("com.github.hierynomus.license")
216216

217217
if (bugsnag.compilesCode) {
218+
plugins.apply("checkstyle")
218219
plugins.apply("kotlin-android")
219220
plugins.apply("io.gitlab.arturbosch.detekt")
220221
plugins.apply("org.jlleitschuh.gradle.ktlint")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.bugsnag.android
2+
3+
import org.gradle.api.Project
4+
import org.gradle.api.plugins.quality.Checkstyle
5+
import org.gradle.api.plugins.quality.CheckstyleExtension
6+
import org.gradle.kotlin.dsl.get
7+
8+
fun Project.configureCheckstyle() {
9+
extensions.getByType(CheckstyleExtension::class.java).apply {
10+
toolVersion = "8.18"
11+
}
12+
13+
val checkstyle = tasks.register("checkstyle", Checkstyle::class.java) {
14+
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
15+
source = fileTree("src/") {
16+
include("**/*.java")
17+
exclude("**/external/**/*.java")
18+
}
19+
classpath = files()
20+
}
21+
22+
tasks["check"].dependsOn(checkstyle)
23+
}

features/fixtures/mazerunner/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ dependencies {
9494

9595
apply from: "../bugsnag-dependency.gradle"
9696
apply from: "../../../../gradle/detekt.gradle"
97-
apply from: "../../../../gradle/checkstyle.gradle"
97+
apply from: "../gradle/checkstyle.gradle"

features/fixtures/mazerunner/cxx-scenarios-bugsnag/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ dependencies {
4646
}
4747

4848
apply from: "../../../../gradle/detekt.gradle"
49-
apply from: "../../../../gradle/checkstyle.gradle"
49+
apply from: "../gradle/checkstyle.gradle"

features/fixtures/mazerunner/cxx-scenarios/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ dependencies {
4343

4444
apply from: "../bugsnag-dependency.gradle"
4545
apply from: "../../../../gradle/detekt.gradle"
46-
apply from: "../../../../gradle/checkstyle.gradle"
46+
apply from: "../gradle/checkstyle.gradle"
File renamed without changes.

features/fixtures/mazerunner/jvm-scenarios/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ private boolean useLegacyOkHttp() {
4848

4949
apply from: "../bugsnag-dependency.gradle"
5050
apply from: "../../../../gradle/detekt.gradle"
51-
apply from: "../../../../gradle/checkstyle.gradle"
51+
apply from: "../gradle/checkstyle.gradle"

0 commit comments

Comments
 (0)