diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cb159464e..a12183bf4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ # vNext +* Bump: AGP 4.1.1 +* Fix: use neutral Locale for String operations #1033 * Update to sentry-native 0.4.4 and fix shared library builds (#1039) + +# 3.1.3 + +* Fix broken NDK integration on 3.1.2 (release failed on packaging a .so file) * Increase max cached events to 30 (#1029) * Normalize DSN URI (#1030) -* fix: use neutral Locale for String operations #1033 # 3.1.2 diff --git a/Makefile b/Makefile index 44e23a5cb0..4174cc696a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ all: clean compile update dryRelease # deep clean clean: - ./gradlew clean cleanBuildCache + ./gradlew clean # build and run tests compile: diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 95545b6196..b59ab0c548 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -9,7 +9,7 @@ object Config { val springKotlinCompatibleLanguageVersion = "1.3" object BuildPlugins { - val androidGradle = "com.android.tools.build:gradle:4.0.2" + val androidGradle = "com.android.tools.build:gradle:4.1.1" val kotlinGradlePlugin = "gradle-plugin" val buildConfig = "com.github.gmazzo.buildconfig" val buildConfigVersion = "2.0.2" @@ -25,7 +25,10 @@ object Config { val minSdkVersionNdk = 16 val targetSdkVersion = sdkVersion val compileSdkVersion = sdkVersion - val cmakeVersion = "3.10.2" + // CMake: Projects that don't set a specific CMake version are built with CMake 3.10.2 + + // ndk is set to 21.3.x but I see on the logs the version 21.1.x, not sure if it's a bug + // on the Gradle plugin picking up the wrong version. val ndkVersion = "21.3.6528147" val abiFilters = listOf("x86", "armeabi-v7a", "x86_64", "arm64-v8a") } @@ -35,7 +38,7 @@ object Config { val timber = "com.jakewharton.timber:timber:4.7.1" // only bump gson if https://github.com/google/gson/issues/1597 is fixed val gson = "com.google.code.gson:gson:2.8.5" - val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.4" + val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.5" private val lifecycleVersion = "2.2.0" val lifecycleProcess = "androidx.lifecycle:lifecycle-process:$lifecycleVersion" @@ -71,7 +74,7 @@ object Config { val androidxJunit = "androidx.test.ext:junit:1.1.2" val robolectric = "org.robolectric:robolectric:4.4" val mockitoKotlin = "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" - val mockitoInline = "org.mockito:mockito-inline:3.5.13" + val mockitoInline = "org.mockito:mockito-inline:3.6.0" val awaitility = "org.awaitility:awaitility-kotlin:4.0.3" } @@ -81,13 +84,13 @@ object Config { val minimumCoverage = BigDecimal.valueOf(0.6) } val spotless = "com.diffplug.spotless" - val spotlessVersion = "5.3.0" + val spotlessVersion = "5.7.0" val errorProne = "net.ltgt.errorprone" - val errorpronePlugin = "net.ltgt.gradle:gradle-errorprone-plugin:1.2.1" - val gradleVersionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.31.0" + val errorpronePlugin = "net.ltgt.gradle:gradle-errorprone-plugin:1.3.0" + val gradleVersionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.34.0" val gradleVersions = "com.github.ben-manes.versions" val detekt = "io.gitlab.arturbosch.detekt" - val detektVersion = "1.12.0" + val detektVersion = "1.14.2" val detektPlugin = "io.gitlab.arturbosch.detekt" } @@ -134,7 +137,7 @@ object Config { } object NativePlugins { - val nativeBundlePlugin = "com.ydq.android.gradle.build.tool:nativeBundle:1.0.6" + val nativeBundlePlugin = "com.ydq.android.gradle.build.tool:nativeBundle:1.0.7" val nativeBundleExport = "com.ydq.android.gradle.native-aar.export" } } diff --git a/gradle.properties b/gradle.properties index 311757bf4f..ce189ade63 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,7 @@ # Daemon’s heap size -org.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=512m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -# Gradle will try to reuse outputs from previous builds for all builds -org.gradle.caching=true - -# AndroidX required by AGP 3.6.x +# AndroidX required by AGP >= 3.6.x android.useAndroidX=true # Release information diff --git a/sentry-android-core/build.gradle.kts b/sentry-android-core/build.gradle.kts index 0596335113..01f70f1891 100644 --- a/sentry-android-core/build.gradle.kts +++ b/sentry-android-core/build.gradle.kts @@ -21,6 +21,9 @@ android { versionCode = project.properties[Config.Sentry.buildVersionCodeProp].toString().toInt() buildConfigField("String", "SENTRY_ANDROID_SDK_NAME", "\"${Config.Sentry.SENTRY_ANDROID_SDK_NAME}\"") + + // for AGP 4.1 + buildConfigField("String", "VERSION_NAME", "\"$versionName\"") } buildTypes { @@ -44,13 +47,6 @@ android { unitTests.apply { isReturnDefaultValues = true isIncludeAndroidResources = true - all(KotlinClosure1({ - (this as Test).also { testTask -> - testTask.extensions - .getByType(JacocoTaskExtension::class.java) - .isIncludeNoLocationClasses = true - } - }, this)) } } @@ -68,6 +64,12 @@ android { } } +tasks.withType { + configure { + isIncludeNoLocationClasses = false + } +} + dependencies { api(project(":sentry")) diff --git a/sentry-android-ndk/CMakeLists.txt b/sentry-android-ndk/CMakeLists.txt index 7024411f14..c9a0181935 100644 --- a/sentry-android-ndk/CMakeLists.txt +++ b/sentry-android-ndk/CMakeLists.txt @@ -4,6 +4,7 @@ project(Sentry-Android LANGUAGES C CXX) # Add sentry-android shared library add_library(sentry-android SHARED src/main/jni/sentry.c) +# make sure that we build it as a shared lib instead of a static lib set(BUILD_SHARED_LIBS ON) set(SENTRY_BUILD_SHARED_LIBS ON) diff --git a/sentry-android-ndk/build.gradle.kts b/sentry-android-ndk/build.gradle.kts index cfb35bdff7..05b7b69650 100644 --- a/sentry-android-ndk/build.gradle.kts +++ b/sentry-android-ndk/build.gradle.kts @@ -37,15 +37,18 @@ android { } ndk { - setAbiFilters(Config.Android.abiFilters) - ndkVersion = Config.Android.ndkVersion + abiFilters.addAll(Config.Android.abiFilters) } + + // for AGP 4.1 + buildConfigField("String", "VERSION_NAME", "\"$versionName\"") } + ndkVersion = Config.Android.ndkVersion + externalNativeBuild { cmake { - version = Config.Android.cmakeVersion - setPath("CMakeLists.txt") + path("CMakeLists.txt") } } @@ -70,13 +73,6 @@ android { unitTests.apply { isReturnDefaultValues = true isIncludeAndroidResources = true - all(KotlinClosure1({ - (this as Test).also { testTask -> - testTask.extensions - .getByType(JacocoTaskExtension::class.java) - .isIncludeNoLocationClasses = true - } - }, this)) } } @@ -98,6 +94,12 @@ android { } } +tasks.withType { + configure { + isIncludeNoLocationClasses = false + } +} + dependencies { api(project(":sentry")) api(project(":sentry-android-core")) diff --git a/sentry-android-timber/build.gradle.kts b/sentry-android-timber/build.gradle.kts index aad8ad5d59..450bc7f397 100644 --- a/sentry-android-timber/build.gradle.kts +++ b/sentry-android-timber/build.gradle.kts @@ -21,6 +21,9 @@ android { versionName = project.version.toString() versionCode = project.properties[Config.Sentry.buildVersionCodeProp].toString().toInt() + + // for AGP 4.1 + buildConfigField("String", "VERSION_NAME", "\"$versionName\"") } buildTypes { @@ -44,13 +47,6 @@ android { unitTests.apply { isReturnDefaultValues = true isIncludeAndroidResources = true - all(KotlinClosure1({ - (this as Test).also { testTask -> - testTask.extensions - .getByType(JacocoTaskExtension::class.java) - .isIncludeNoLocationClasses = true - } - }, this)) } } @@ -63,6 +59,12 @@ android { } } +tasks.withType { + configure { + isIncludeNoLocationClasses = false + } +} + dependencies { api(project(":sentry")) diff --git a/sentry-samples/sentry-samples-android/CMakeLists.txt b/sentry-samples/sentry-samples-android/CMakeLists.txt index 35a464e58b..ad170fe404 100644 --- a/sentry-samples/sentry-samples-android/CMakeLists.txt +++ b/sentry-samples/sentry-samples-android/CMakeLists.txt @@ -3,6 +3,7 @@ project(Sentry-Sample LANGUAGES C CXX) add_library(native-sample SHARED src/main/cpp/native-sample.cpp) +# make sure that we build it as a shared lib instead of a static lib set(BUILD_SHARED_LIBS ON) set(SENTRY_BUILD_SHARED_LIBS ON) diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index 5d93a66cf6..51d52e87e6 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -28,11 +28,12 @@ android { } ndk { - setAbiFilters(Config.Android.abiFilters) - ndkVersion = Config.Android.ndkVersion + abiFilters.addAll(Config.Android.abiFilters) } } + ndkVersion = Config.Android.ndkVersion + buildFeatures { // Determines whether to support View Binding. // Note that the viewBinding.enabled property is now deprecated. @@ -48,8 +49,7 @@ android { externalNativeBuild { cmake { - version = Config.Android.cmakeVersion - setPath("CMakeLists.txt") + path("CMakeLists.txt") } } @@ -64,10 +64,10 @@ android { buildTypes { getByName("debug") { - manifestPlaceholders = mapOf( + addManifestPlaceholders(mapOf( "sentryDebug" to true, "sentryEnvironment" to "debug" - ) + )) } getByName("release") { isMinifyEnabled = true @@ -75,10 +75,10 @@ android { signingConfig = signingConfigs.getByName("debug") // to be able to run release mode isShrinkResources = true - manifestPlaceholders = mapOf( + addManifestPlaceholders(mapOf( "sentryDebug" to false, "sentryEnvironment" to "release" - ) + )) } } diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index ff068e1d41..b11d05783a 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -20,7 +20,6 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" - android:supportsRtl="true" android:theme="@style/AppTheme" android:allowNativeHeapPointerTagging="false" android:extractNativeLibs="true"