Skip to content

Commit

Permalink
chore(build): moved kotlin compiler options into BugsnagBuildPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lemnik committed Apr 30, 2024
1 parent df49669 commit 083998a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 26 deletions.
2 changes: 0 additions & 2 deletions bugsnag-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ tasks.getByName<DokkaTask>("dokkaHtml") {
}
}

apply(from = "../gradle/kotlin.gradle")

// pick up dsl-json by adding to the default sourcesets
android {
sourceSets {
Expand Down
2 changes: 0 additions & 2 deletions bugsnag-plugin-android-anr/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ bugsnagBuildOptions {
dependencies {
add("api", project(":bugsnag-android-core"))
}

apply(from = "../gradle/kotlin.gradle")
5 changes: 0 additions & 5 deletions bugsnag-plugin-android-exitinfo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ plugins {

dependencies {
api(project(":bugsnag-android-core"))
}

apply(from = "../gradle/kotlin.gradle")

dependencies {
implementation("com.google.protobuf:protobuf-javalite:3.24.2")
}

Expand Down
2 changes: 0 additions & 2 deletions bugsnag-plugin-android-ndk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ dependencies {
api(project(":bugsnag-android-core"))
}

apply(from = "../gradle/kotlin.gradle")

afterEvaluate {
tasks.create("prefabReleasePackage") {
doLast {
Expand Down
2 changes: 0 additions & 2 deletions bugsnag-plugin-android-okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ plugins {
id("com.android.library")
}

apply(from = "../gradle/kotlin.gradle")

dependencies {
add("api", project(":bugsnag-android-core"))

Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ repositories {
dependencies {
compileOnly(gradleApi())
implementation("com.android.tools.build:gradle:7.0.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
}
18 changes: 18 additions & 0 deletions buildSrc/src/main/kotlin/com/bugsnag/android/BugsnagBuildPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import java.io.File

/**
Expand Down Expand Up @@ -65,6 +66,8 @@ class BugsnagBuildPlugin : Plugin<Project> {
project.apply(from = project.file("../gradle/license-check.gradle"))

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

project.apply(from = project.file("../gradle/detekt.gradle"))
project.apply(from = project.file("../gradle/checkstyle.gradle"))
}
Expand Down Expand Up @@ -175,6 +178,21 @@ class BugsnagBuildPlugin : Plugin<Project> {
}
}

private fun Project.configureKotlinOptions() {
tasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions {
allWarningsAsErrors = true
apiVersion = Versions.kotlinLang
languageVersion = Versions.kotlinLang
freeCompilerArgs += listOf(
"-Xno-call-assertions",
"-Xno-receiver-assertions",
"-Xno-param-assertions"
)
}
}
}

/**
* Configures Android project defaults such as minSdkVersion.
*/
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/com/bugsnag/android/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object Versions {
val ndk = "23.1.7779620"
val java = JavaVersion.VERSION_1_8
val kotlin = "1.5.10"
val kotlinLang = "1.5"

// plugins
val androidGradlePlugin = "7.0.4"
Expand Down
13 changes: 0 additions & 13 deletions gradle/kotlin.gradle

This file was deleted.

0 comments on commit 083998a

Please sign in to comment.