Skip to content

Commit

Permalink
chore(build): moved checkstyle options into BugsnagBuildPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lemnik committed May 1, 2024
1 parent 083998a commit 925482b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class BugsnagBuildPlugin : Plugin<Project> {

if (bugsnag.compilesCode) {
project.configureKotlinOptions()
project.configureCheckstyle()

project.apply(from = project.file("../gradle/detekt.gradle"))
project.apply(from = project.file("../gradle/checkstyle.gradle"))
}
}

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

if (bugsnag.compilesCode) {
plugins.apply("checkstyle")
plugins.apply("kotlin-android")
plugins.apply("io.gitlab.arturbosch.detekt")
plugins.apply("org.jlleitschuh.gradle.ktlint")
Expand Down
23 changes: 23 additions & 0 deletions buildSrc/src/main/kotlin/com/bugsnag/android/Checkstyle.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.bugsnag.android

import org.gradle.api.Project
import org.gradle.api.plugins.quality.Checkstyle
import org.gradle.api.plugins.quality.CheckstyleExtension
import org.gradle.kotlin.dsl.get

fun Project.configureCheckstyle() {
extensions.getByType(CheckstyleExtension::class.java).apply {
toolVersion = "8.18"
}

val checkstyle = tasks.register("checkstyle", Checkstyle::class.java) {
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
source = fileTree("src/") {
include("**/*.java")
exclude("**/external/**/*.java")
}
classpath = files()
}

tasks["check"].dependsOn(checkstyle)
}
2 changes: 1 addition & 1 deletion features/fixtures/mazerunner/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ dependencies {

apply from: "../bugsnag-dependency.gradle"
apply from: "../../../../gradle/detekt.gradle"
apply from: "../../../../gradle/checkstyle.gradle"
apply from: "../gradle/checkstyle.gradle"
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ dependencies {
}

apply from: "../../../../gradle/detekt.gradle"
apply from: "../../../../gradle/checkstyle.gradle"
apply from: "../gradle/checkstyle.gradle"
2 changes: 1 addition & 1 deletion features/fixtures/mazerunner/cxx-scenarios/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ dependencies {

apply from: "../bugsnag-dependency.gradle"
apply from: "../../../../gradle/detekt.gradle"
apply from: "../../../../gradle/checkstyle.gradle"
apply from: "../gradle/checkstyle.gradle"
File renamed without changes.
2 changes: 1 addition & 1 deletion features/fixtures/mazerunner/jvm-scenarios/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ private boolean useLegacyOkHttp() {

apply from: "../bugsnag-dependency.gradle"
apply from: "../../../../gradle/detekt.gradle"
apply from: "../../../../gradle/checkstyle.gradle"
apply from: "../gradle/checkstyle.gradle"

0 comments on commit 925482b

Please sign in to comment.