Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ plugins {
}

repositories {
google()
gradlePluginPortal()
}

dependencies {
implementation(libs.animalsniffer.gradle.plugin)
implementation(libs.spotlessLib)
compileOnly(libs.android.gradle.plugin)
}

gradlePlugin {
Expand Down
25 changes: 25 additions & 0 deletions build-logic/src/main/kotlin/io.sentry.android.lint.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import com.android.build.api.dsl.CommonExtension

// Shared Android lint configuration for the SDK's library and application modules.
// See Tor Norbye's rationale for checkGeneratedSources/checkDependencies:
// https://groups.google.com/forum/#!msg/lint-dev/JqTI4eQ8GpI/nBfS7xLKBwAJ
pluginManager.withPlugin("com.android.base") {
extensions.configure(CommonExtension::class.java) {
lint {
warningsAsErrors = true
// Avoids false "unused" reports for code used only by generated classes (e.g. ViewBinding).
checkGeneratedSources = true
// Lets `:module:lint` also analyze dependency modules.
checkDependencies = true
// Test sources dominate lint time; skipping them is the main speed-up.
ignoreTestSources = true

// Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36. Only the
// application modules set targetSdk, so this is a no-op for the library modules.
disable += "OldTargetApi"

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}
}
}
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ otelSemanticConventionsAlpha = "1.42.0-alpha"
retrofit = "2.9.0"
room2 = "2.8.4"
room3 = "3.0.0-rc01"
# Keep in sync with Config.AGP in buildSrc (the version modules actually build with).
# Used compile-only by build-logic to configure the Android lint DSL.
agp = "8.13.1"
sagp = "6.13.0"
sqlite = "2.6.2"
sqliteRc = "2.7.0-rc01" # Required by Room3 3.0.0-rc*
Expand Down Expand Up @@ -77,6 +80,7 @@ sentry = { id = "io.sentry.android.gradle", version.ref = "sagp"}
shadow = { id = "com.gradleup.shadow", version = "9.4.1" }

[libraries]
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }
animalsniffer-gradle-plugin = { module = "ru.vyarus:gradle-animalsniffer-plugin", version.ref = "animalsniffer" }
apache-httpclient = { module = "org.apache.httpcomponents.client5:httpclient5", version = "5.0.4" }
apollo2-coroutines = { module = "com.apollographql.apollo:apollo-coroutines-support", version.ref = "apollo" }
Expand Down
9 changes: 1 addition & 8 deletions sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.errorprone)
alias(libs.plugins.gradle.versions)
id("io.sentry.android.lint")
}

android {
Expand Down Expand Up @@ -49,14 +50,6 @@ android {
}
}

lint {
warningsAsErrors = true
checkDependencies = true

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}

buildFeatures { buildConfig = true }

// needed because of Kotlin 1.4.x
Expand Down
1 change: 1 addition & 0 deletions sentry-android-distribution/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
id("com.android.library")
alias(libs.plugins.kotlin.android)
id("io.sentry.android.lint")
}

android {
Expand Down
9 changes: 1 addition & 8 deletions sentry-android-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.detekt)
id("io.sentry.android.lint")
}

android {
Expand Down Expand Up @@ -37,14 +38,6 @@ android {
}
}

lint {
warningsAsErrors = true
checkDependencies = true

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}

buildFeatures { buildConfig = true }

androidComponents.beforeVariants {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
alias(libs.plugins.errorprone)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.detekt)
id("io.sentry.android.lint")
}

android {
Expand Down Expand Up @@ -66,16 +67,6 @@ android {

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }

lint {
warningsAsErrors = true
checkDependencies = true
// Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36
disable += "OldTargetApi"

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}

androidComponents.beforeVariants {
if (it.buildType == "debug") {
it.enable = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ plugins {
id("com.android.application")
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
id("io.sentry.android.lint")
}

android {
compileSdk = libs.versions.compileSdk.get().toInt()
namespace = "io.sentry.uitest.android.critical"

// Baseline the pre-existing lint issues in this test app; only new issues fail the build.
lint { baseline = file("lint-baseline.xml") }

signingConfigs {
getByName("debug") {
// Debug config remains unchanged
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.13.1" type="baseline" client="gradle" dependencies="true" name="AGP (8.13.1)" variant="all" version="8.13.1">

<issue
id="SuspiciousImport"
message="Don&apos;t include `android.R` here; use a fully qualified name for each usage instead"
errorLine1="import android.R"
errorLine2="~~~~~~~~~~~~~~~~">
<location
file="src/main/java/io/sentry/uitest/android/critical/NotificationHelper.kt"
line="3"
column="1"/>
</issue>

<issue
id="MissingApplicationIcon"
message="Should explicitly set `android:icon`, there is no default"
errorLine1=" &lt;application"
errorLine2=" ~~~~~~~~~~~">
<location
file="src/main/AndroidManifest.xml"
line="7"
column="4"/>
</issue>

</issues>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.errorprone)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.detekt)
id("io.sentry.android.lint")
}

android {
Expand Down Expand Up @@ -64,16 +65,6 @@ android {

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }

lint {
warningsAsErrors = true
checkDependencies = true
// Suppress OldTargetApi: lint 8.13.1 expects API 37 but we target 36
disable += "OldTargetApi"

// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks.
checkReleaseBuilds = false
}

androidComponents.beforeVariants {
if (it.buildType == "debug") {
it.enable = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
plugins { id("com.android.application") }
plugins {
id("com.android.application")
id("io.sentry.android.lint")
}

android {
compileSdk = libs.versions.compileSdk.get().toInt()
namespace = "io.sentry.java.tests.perf.appplain"

// Baseline the pre-existing lint issues in this test app; only new issues fail the build.
lint { baseline = file("lint-baseline.xml") }

defaultConfig {
applicationId = "io.sentry.java.tests.perf.appplain"
minSdk = libs.versions.minSdk.get().toInt()
Expand Down
Loading
Loading