diff --git a/build.gradle.kts b/build.gradle.kts index 278b2a9422..1f331dfa6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,18 +46,19 @@ apiValidation { ignoredProjects.addAll( listOf( "sentry-samples-android", - "sentry-samples-console", - "sentry-samples-jul", - "sentry-samples-log4j2", - "sentry-samples-logback", - "sentry-samples-openfeign", - "sentry-samples-servlet", - "sentry-samples-spring", - "sentry-samples-spring-boot", - "sentry-samples-spring-boot-webflux", - "sentry-samples-netflix-dgs", - "sentry-uitest-android", - "sentry-uitest-android-benchmark", + "sentry-samples-android-minsdk", +// "sentry-samples-console", +// "sentry-samples-jul", +// "sentry-samples-log4j2", +// "sentry-samples-logback", +// "sentry-samples-openfeign", +// "sentry-samples-servlet", +// "sentry-samples-spring", +// "sentry-samples-spring-boot", +// "sentry-samples-spring-boot-webflux", +// "sentry-samples-netflix-dgs", +// "sentry-uitest-android", +// "sentry-uitest-android-benchmark", ) ) } diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index c4f305dda4..4fa0eac0ee 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -8,7 +8,7 @@ object Config { val kotlinCompatibleLanguageVersion = "1.4" object BuildPlugins { - val androidGradle = "com.android.tools.build:gradle:7.2.0" + val androidGradle = "com.android.tools.build:gradle:7.2.1" val kotlinGradlePlugin = "gradle-plugin" val buildConfig = "com.github.gmazzo.buildconfig" val buildConfigVersion = "3.0.3" @@ -154,6 +154,7 @@ object Config { val binaryCompatibilityValidatorVersion = "0.8.0" val binaryCompatibilityValidatorPlugin = "org.jetbrains.kotlinx:binary-compatibility-validator:$binaryCompatibilityValidatorVersion" val binaryCompatibilityValidator = "org.jetbrains.kotlinx.binary-compatibility-validator" + val androidLint = "com.android.lint" } object Sentry { diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index 73243b80fa..86e3347345 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -49,7 +49,8 @@ android { // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. checkReleaseBuilds = false - disable += "LogNotTimber" + checkAllWarnings = true + disable.addAll(listOf("TrulyRandom", "SyntheticAccessor", "LogConditional", "UnknownNullness", "LogNotTimber")) } // needed because of Kotlin 1.4.x diff --git a/sentry-android-fragment/build.gradle.kts b/sentry-android-fragment/build.gradle.kts index a0bab5910e..90089d4504 100644 --- a/sentry-android-fragment/build.gradle.kts +++ b/sentry-android-fragment/build.gradle.kts @@ -45,6 +45,8 @@ android { // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. checkReleaseBuilds = false + checkAllWarnings = true + disable.addAll(listOf("TrulyRandom", "SyntheticAccessor", "InvalidPackage")) } variantFilter { diff --git a/sentry-android-ndk/build.gradle.kts b/sentry-android-ndk/build.gradle.kts index 152e95084e..cd885f15eb 100644 --- a/sentry-android-ndk/build.gradle.kts +++ b/sentry-android-ndk/build.gradle.kts @@ -77,6 +77,8 @@ android { // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. checkReleaseBuilds = false + checkAllWarnings = true + disable.addAll(listOf("TrulyRandom", "SyntheticAccessor")) } nativeBundleExport { diff --git a/sentry-android-okhttp/build.gradle.kts b/sentry-android-okhttp/build.gradle.kts index 5324322508..3ac8c1e963 100644 --- a/sentry-android-okhttp/build.gradle.kts +++ b/sentry-android-okhttp/build.gradle.kts @@ -47,6 +47,8 @@ android { // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. checkReleaseBuilds = false + checkAllWarnings = true + disable.addAll(listOf("TrulyRandom", "SyntheticAccessor")) } variantFilter { diff --git a/sentry-android-timber/build.gradle.kts b/sentry-android-timber/build.gradle.kts index 16649360d2..6617f78507 100644 --- a/sentry-android-timber/build.gradle.kts +++ b/sentry-android-timber/build.gradle.kts @@ -50,6 +50,8 @@ android { // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. checkReleaseBuilds = false + checkAllWarnings = true + disable.addAll(listOf("TrulyRandom", "SyntheticAccessor")) } variantFilter { diff --git a/sentry-android/build.gradle.kts b/sentry-android/build.gradle.kts index a1f62f837d..1c70ee9068 100644 --- a/sentry-android/build.gradle.kts +++ b/sentry-android/build.gradle.kts @@ -22,6 +22,16 @@ android { ignore = true } } + + 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 + checkAllWarnings = true + disable.addAll(listOf("TrulyRandom", "SyntheticAccessor")) + } } dependencies { diff --git a/sentry-apollo/build.gradle.kts b/sentry-apollo/build.gradle.kts index 516bd7bd1d..3c27785d5b 100644 --- a/sentry-apollo/build.gradle.kts +++ b/sentry-apollo/build.gradle.kts @@ -1,3 +1,4 @@ +import com.android.build.api.dsl.Lint import net.ltgt.gradle.errorprone.errorprone import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -8,6 +9,7 @@ plugins { id(Config.QualityPlugins.errorProne) id(Config.QualityPlugins.gradleVersions) id(Config.BuildPlugins.buildConfig) version Config.BuildPlugins.buildConfigVersion + id(Config.QualityPlugins.androidLint) } configure { @@ -20,6 +22,16 @@ tasks.withType().configureEach { kotlinOptions.languageVersion = Config.kotlinCompatibleLanguageVersion } +configure { + warningsAsErrors = true + checkDependencies = true + + // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. + checkReleaseBuilds = false + disable.addAll(listOf("TrulyRandom")) + checkAllWarnings = true +} + dependencies { api(projects.sentry) api(projects.sentryKotlinExtensions) diff --git a/sentry-samples/sentry-samples-android-minsdk/.gitignore b/sentry-samples/sentry-samples-android-minsdk/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/.gitignore @@ -0,0 +1 @@ +/build diff --git a/sentry-samples/sentry-samples-android-minsdk/build.gradle.kts b/sentry-samples/sentry-samples-android-minsdk/build.gradle.kts new file mode 100644 index 0000000000..f22b17e53d --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/build.gradle.kts @@ -0,0 +1,91 @@ +plugins { + id("com.android.application") + kotlin("android") +} + +android { + compileSdk = Config.Android.compileSdkVersion + + defaultConfig { + applicationId = "io.sentry.samples.android.minsdk" + minSdk = Config.Android.minSdkVersion + targetSdk = Config.Android.targetSdkVersion + versionCode = 2 + versionName = "1.1.0" + } + + buildFeatures { + // Determines whether to support View Binding. + // Note that the viewBinding.enabled property is now deprecated. + viewBinding = true + } + + dependenciesInfo { + // Disables dependency metadata when building APKs. + includeInApk = false + // Disables dependency metadata when building Android App Bundles. + includeInBundle = false + } + + signingConfigs { + getByName("debug") { + storeFile = rootProject.file("debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" + } + } + + buildTypes { + getByName("debug") { + addManifestPlaceholders( + mapOf( + "sentryDebug" to true + ) + ) + } + getByName("release") { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("debug") // to be able to run release mode + isShrinkResources = true + + addManifestPlaceholders( + mapOf( + "sentryDebug" to false + ) + ) + } + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } + + variantFilter { + if (Config.Android.shouldSkipDebugVariant(buildType.name)) { + ignore = true + } + } + + 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 + disable.addAll(listOf("TrulyRandom", "InvalidPackage", "SyntheticAccessor", "UnknownNullness")) + checkAllWarnings = true + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + + implementation(projects.sentryAndroid) + implementation(projects.sentryAndroidFragment) + implementation(projects.sentryAndroidTimber) + implementation(projects.sentryApollo) + + implementation(Config.Libs.appCompat) +} diff --git a/sentry-samples/sentry-samples-android-minsdk/proguard-rules.pro b/sentry-samples/sentry-samples-android-minsdk/proguard-rules.pro new file mode 100644 index 0000000000..95c4bb7bbc --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/proguard-rules.pro @@ -0,0 +1,35 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# To ensure that stack traces is unambiguous +# https://developer.android.com/studio/build/shrink-code#decode-stack-trace +-keepattributes LineNumberTable,SourceFile + + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames,includedescriptorclasses class * { + native ; +} + +# Please add these rules to your existing keep rules in order to suppress warnings. +# This is generated automatically by the Android Gradle plugin. +-dontwarn org.bouncycastle.jsse.BCSSLParameters +-dontwarn org.bouncycastle.jsse.BCSSLSocket +-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider +-dontwarn org.conscrypt.Conscrypt$Version +-dontwarn org.conscrypt.Conscrypt +-dontwarn org.conscrypt.ConscryptHostnameVerifier +-dontwarn org.openjsse.javax.net.ssl.SSLParameters +-dontwarn org.openjsse.javax.net.ssl.SSLSocket +-dontwarn org.openjsse.net.ssl.OpenJSSE diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..3caaf41794 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/AndroidManifest.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/java/io/sentry/samples/android/minsdk/MainActivity.java b/sentry-samples/sentry-samples-android-minsdk/src/main/java/io/sentry/samples/android/minsdk/MainActivity.java new file mode 100644 index 0000000000..f8bb797af3 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/java/io/sentry/samples/android/minsdk/MainActivity.java @@ -0,0 +1,17 @@ +package io.sentry.samples.android.minsdk; + +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import io.sentry.samples.android.minsdk.databinding.ActivityMainBinding; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + final ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater()); + + setContentView(binding.getRoot()); + } +} diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/drawable-v24/ic_launcher_foreground.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000..84330a705f --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/drawable/ic_launcher_background.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000..cdfecfb0f5 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/layout/activity_main.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000..afa211a77f --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/layout/activity_main.xml @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000..ea737cd487 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000..ea737cd487 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-hdpi/ic_launcher.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..898f3ed59a Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-hdpi/ic_launcher_round.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000000..dffca3601e Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-mdpi/ic_launcher.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..64ba76f75e Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-mdpi/ic_launcher_round.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000000..dae5e08234 Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xhdpi/ic_launcher.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..e5ed46597e Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..14ed0af350 Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..b0907cac3b Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..d8ae031549 Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..2c18de9e66 Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000..beed3cdd2c Binary files /dev/null and b/sentry-samples/sentry-samples-android-minsdk/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/colors.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/colors.xml new file mode 100644 index 0000000000..b2b42674a5 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #008577 + #00574B + #D81B60 + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/strings.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/strings.xml new file mode 100644 index 0000000000..aa9978d38a --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Sentry sample + diff --git a/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/styles.xml b/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/styles.xml new file mode 100644 index 0000000000..705be27764 --- /dev/null +++ b/sentry-samples/sentry-samples-android-minsdk/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index 33b5010909..00c7b31e7e 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -93,6 +93,16 @@ android { ignore = true } } + + 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 + disable.addAll(listOf("TrulyRandom", "InvalidPackage", "SyntheticAccessor", "UnusedIds", "ConvertToWebp", "UnknownNullness")) + checkAllWarnings = true + } } dependencies { diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index ab6ece24c2..851778ce2f 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ diff --git a/sentry-samples/sentry-samples-android/src/main/res/layout/activity_second.xml b/sentry-samples/sentry-samples-android/src/main/res/layout/activity_second.xml index 57d3a04c11..f749179d3d 100644 --- a/sentry-samples/sentry-samples-android/src/main/res/layout/activity_second.xml +++ b/sentry-samples/sentry-samples-android/src/main/res/layout/activity_second.xml @@ -9,7 +9,9 @@ diff --git a/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml b/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml index c160543940..2d4f4e7ad8 100644 --- a/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml +++ b/sentry-samples/sentry-samples-android/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - + Sentry sample Crash from Java (UncaughtException) Send Message @@ -21,7 +21,7 @@ Test Timber Back to Main Activity text - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin nibh lorem, venenatis sed nulla vel, venenatis sodales augue. Mauris varius elit eu ligula volutpat, sed tincidunt orci porttitor. Donec et dignissim lacus, sed luctus ipsum. Praesent ornare luctus tortor sit amet ultricies. Cras iaculis et diam et vulputate. Cras ut iaculis mauris, non pellentesque diam. Nunc in laoreet diam, vitae accumsan eros. Morbi non nunc ac eros molestie placerat vitae id dolor. Quisque ornare aliquam ipsum, a dapibus tortor. In eu sodales tellus. + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin nibh lorem, venenatis sed nulla vel, venenatis sodales augue. Mauris varius elit eu ligula volutpat, sed tincidunt orci porttitor. Donec et dignissim lacus, sed luctus ipsum. Praesent ornare luctus tortor sit amet ultricies. Cras iaculis et diam et vulputate. Cras ut iaculis mauris, non pellentesque diam. Nunc in laoreet diam, vitae accumsan eros. Morbi non nunc ac eros molestie placerat vitae id dolor. Quisque ornare aliquam ipsum, a dapibus tortor. In eu sodales tellus. Aliquam tristique, nisi eu sodales rhoncus, ex arcu blandit quam, sed suscipit enim lorem at metus. Vivamus nec aliquet dolor. Nulla molestie sem eget nunc sollicitudin placerat. Duis lobortis nisi at dui scelerisque tincidunt. Aenean fringilla tempus justo vel finibus. Sed ut mi vulputate leo lobortis interdum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tempus interdum scelerisque. Integer vitae turpis imperdiet tellus facilisis pretium. @@ -33,4 +33,5 @@ Nulla interdum gravida augue, vel fringilla lorem bibendum vel. In hac habitasse Camera Permission Write External Storage Permission + getsentry diff --git a/sentry/build.gradle.kts b/sentry/build.gradle.kts index 2f35cbd4f7..8cf0a48e3f 100644 --- a/sentry/build.gradle.kts +++ b/sentry/build.gradle.kts @@ -1,3 +1,4 @@ +import com.android.build.api.dsl.Lint import net.ltgt.gradle.errorprone.errorprone import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -8,6 +9,7 @@ plugins { id(Config.QualityPlugins.errorProne) id(Config.QualityPlugins.gradleVersions) id(Config.BuildPlugins.buildConfig) version Config.BuildPlugins.buildConfigVersion + id(Config.QualityPlugins.androidLint) } configure { @@ -19,6 +21,16 @@ tasks.withType().configureEach { kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString() } +configure { + warningsAsErrors = true + checkDependencies = true + + // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. + checkReleaseBuilds = false + disable.addAll(listOf("TrulyRandom", "KotlinPropertyAccess", "LambdaLast", "UnknownNullness")) + checkAllWarnings = true +} + dependencies { compileOnly(Config.CompileOnly.nopen) errorprone(Config.CompileOnly.nopenChecker) diff --git a/sentry/src/main/java/io/sentry/Baggage.java b/sentry/src/main/java/io/sentry/Baggage.java index 4ebb46c68b..523cabb6a1 100644 --- a/sentry/src/main/java/io/sentry/Baggage.java +++ b/sentry/src/main/java/io/sentry/Baggage.java @@ -3,6 +3,7 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -15,7 +16,7 @@ @ApiStatus.Experimental public final class Baggage { - static final @NotNull String CHARSET = "UTF-8"; + static final @NotNull String CHARSET = StandardCharsets.UTF_8.toString(); static final @NotNull Integer MAX_BAGGAGE_STRING_LENGTH = 8192; static final @NotNull Integer MAX_BAGGAGE_LIST_MEMBER_COUNT = 64; diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index fc7834d0f2..9b398ee50e 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -40,6 +40,8 @@ public boolean isEnabled() { return enabled; } + // @SuppressLint does not exist for Java projects + @SuppressWarnings("TrulyRandom") SentryClient(final @NotNull SentryOptions options) { this.options = Objects.requireNonNull(options, "SentryOptions is required."); this.enabled = true; diff --git a/sentry/src/main/java/io/sentry/TracesSampler.java b/sentry/src/main/java/io/sentry/TracesSampler.java index 9f14ec9502..d39c7fa680 100644 --- a/sentry/src/main/java/io/sentry/TracesSampler.java +++ b/sentry/src/main/java/io/sentry/TracesSampler.java @@ -9,6 +9,8 @@ final class TracesSampler { private final @NotNull SentryOptions options; private final @NotNull SecureRandom random; + // @SuppressLint does not exist for Java projects + @SuppressWarnings("TrulyRandom") public TracesSampler(final @NotNull SentryOptions options) { this(Objects.requireNonNull(options, "options are required"), new SecureRandom()); } diff --git a/sentry/src/test/java/io/sentry/TransactionContextsTest.kt b/sentry/src/test/java/io/sentry/TransactionContextsTest.kt deleted file mode 100644 index 8b13789179..0000000000 --- a/sentry/src/test/java/io/sentry/TransactionContextsTest.kt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/settings.gradle.kts b/settings.gradle.kts index 5fe49492ca..cd505d9714 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,35 +14,36 @@ include( "sentry-android-fragment", "sentry-apollo", "sentry-test-support", - "sentry-log4j2", - "sentry-logback", - "sentry-jul", - "sentry-servlet", - "sentry-servlet-jakarta", - "sentry-apache-http-client-5", - "sentry-spring", - "sentry-spring-boot-starter", +// "sentry-log4j2", +// "sentry-logback", +// "sentry-jul", +// "sentry-servlet", +// "sentry-servlet-jakarta", +// "sentry-apache-http-client-5", +// "sentry-spring", +// "sentry-spring-boot-starter", "sentry-bom", - "sentry-openfeign", - "sentry-graphql", - "sentry-jdbc", +// "sentry-openfeign", +// "sentry-graphql", +// "sentry-jdbc", "sentry-samples:sentry-samples-android", - "sentry-samples:sentry-samples-console", - "sentry-samples:sentry-samples-jul", - "sentry-samples:sentry-samples-log4j2", - "sentry-samples:sentry-samples-logback", - "sentry-samples:sentry-samples-openfeign", - "sentry-samples:sentry-samples-servlet", - "sentry-samples:sentry-samples-spring", - "sentry-samples:sentry-samples-spring-boot", - "sentry-samples:sentry-samples-spring-boot-webflux", - "sentry-samples:sentry-samples-netflix-dgs", - "sentry-android-integration-tests:sentry-uitest-android-benchmark", - "sentry-android-integration-tests:sentry-uitest-android" + "sentry-samples:sentry-samples-android-minsdk" +// "sentry-samples:sentry-samples-console", +// "sentry-samples:sentry-samples-jul", +// "sentry-samples:sentry-samples-log4j2", +// "sentry-samples:sentry-samples-logback", +// "sentry-samples:sentry-samples-openfeign", +// "sentry-samples:sentry-samples-servlet", +// "sentry-samples:sentry-samples-spring", +// "sentry-samples:sentry-samples-spring-boot", +// "sentry-samples:sentry-samples-spring-boot-webflux", +// "sentry-samples:sentry-samples-netflix-dgs", +// "sentry-android-integration-tests:sentry-uitest-android-benchmark", +// "sentry-android-integration-tests:sentry-uitest-android" ) gradle.beforeProject { - if (project.name == "sentry-android-ndk" || project.name == "sentry-samples-android") { + if (project.name == "sentry-android-ndk" || project.name.startsWith("sentry-samples-android")) { exec { logger.log(LogLevel.LIFECYCLE, "Initializing git submodules") commandLine("git", "submodule", "update", "--init", "--recursive")