Skip to content

Commit

Permalink
Merge pull request #2028 from bugsnag/release/v6.5.0
Browse files Browse the repository at this point in the history
Release/v6.5.0
  • Loading branch information
lemnik committed May 15, 2024
2 parents c300eff + 2992145 commit 5946001
Show file tree
Hide file tree
Showing 83 changed files with 730 additions and 384 deletions.
2 changes: 2 additions & 0 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ steps:
timeout_in_minutes: 5
agents:
queue: macos-14
env:
JAVA_VERSION: 17
command: 'make example-app'

- label: ':android: Build debug fixture APK'
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/build.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 6.5.0 (2024-05-15)

### Enhancements

* `Configuration.maxBreadcrumbs` is now obeyed by `bugsnag-plugin-android-ndk`, so native events will include the correct number of breadcrumbs
[#2020](https://github.com/bugsnag/bugsnag-android/pull/2020)
* `bugsnag-plugin-android-ndk` will no longer create an `ArrayList` copy of metadata keys when leaving breadcrumbs
[#2022](https://github.com/bugsnag/bugsnag-android/pull/2022)

## 6.4.0 (2024-04-15)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fixture-debug: notifier
example-app:
@./gradlew assembleRelease publishToMavenLocal -x check
# Build Android example app
@./examples/sdk-app-example/gradlew clean assembleRelease
@cd ./examples/sdk-app-example/ && ./gradlew clean assembleRelease

bump:
ifneq ($(shell git diff --staged),)
Expand Down
3 changes: 2 additions & 1 deletion bugsnag-android-core/api/bugsnag-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,10 @@ public final class com/bugsnag/android/StateEvent$Install : com/bugsnag/android/
public final field buildUuid Ljava/lang/String;
public final field consecutiveLaunchCrashes I
public final field lastRunInfoPath Ljava/lang/String;
public final field maxBreadcrumbs I
public final field releaseStage Ljava/lang/String;
public final field sendThreads Lcom/bugsnag/android/ThreadSendPolicy;
public fun <init> (Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILcom/bugsnag/android/ThreadSendPolicy;)V
public fun <init> (Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILcom/bugsnag/android/ThreadSendPolicy;I)V
}

public final class com/bugsnag/android/StateEvent$NotifyHandled : com/bugsnag/android/StateEvent {
Expand Down
39 changes: 0 additions & 39 deletions bugsnag-android-core/build.gradle

This file was deleted.

41 changes: 41 additions & 0 deletions bugsnag-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import kotlinx.validation.ApiValidationExtension
import org.jetbrains.dokka.gradle.DokkaTask

plugins {
id("bugsnag-build-plugin")
}

bugsnagBuildOptions {
usesNdk = true

// pick up dsl-json by adding to the default sourcesets
android {
sourceSets {
named("main") {
java.srcDirs("dsl-json/library/src/main/java")
}
named("test") {
java.srcDirs("dsl-json/library/src/test/java")
}
}
}
}

apply(plugin = "com.android.library")
apply(plugin = "org.jetbrains.dokka")

tasks.getByName<DokkaTask>("dokkaHtml") {
dokkaSourceSets {
named("main") {
noAndroidSdkLink.set(false)
perPackageOption {
matchingRegex.set("com\\.bugsnag\\.android\\..*")
suppress.set(true)
}
}
}
}

plugins.withId("org.jetbrains.kotlinx.binary-compatibility-validator") {
project.extensions.getByType(ApiValidationExtension::class.java).ignoredPackages.add("com.bugsnag.android.repackaged.dslplatform.json")
}
2 changes: 1 addition & 1 deletion bugsnag-android-core/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ID>LongParameterList:EventInternal.kt$EventInternal$( apiKey: String, logger: Logger, breadcrumbs: MutableList&lt;Breadcrumb> = mutableListOf(), discardClasses: Set&lt;Pattern> = setOf(), errors: MutableList&lt;Error> = mutableListOf(), metadata: Metadata = Metadata(), featureFlags: FeatureFlags = FeatureFlags(), originalError: Throwable? = null, projectPackages: Collection&lt;String> = setOf(), severityReason: SeverityReason = SeverityReason.newInstance(SeverityReason.REASON_HANDLED_EXCEPTION), threads: MutableList&lt;Thread> = mutableListOf(), user: User = User(), redactionKeys: Set&lt;Pattern>? = null )</ID>
<ID>LongParameterList:EventStorageModule.kt$EventStorageModule$( contextModule: ContextModule, configModule: ConfigModule, dataCollectionModule: DataCollectionModule, bgTaskService: BackgroundTaskService, trackerModule: TrackerModule, systemServiceModule: SystemServiceModule, notifier: Notifier, callbackState: CallbackState )</ID>
<ID>LongParameterList:NativeStackframe.kt$NativeStackframe$( /** * The name of the method that was being executed */ var method: String?, /** * The location of the source file */ var file: String?, /** * The line number within the source file this stackframe refers to */ var lineNumber: Number?, /** * The address of the instruction where the event occurred. */ var frameAddress: Long?, /** * The address of the function where the event occurred. */ var symbolAddress: Long?, /** * The address of the library where the event occurred. */ var loadAddress: Long?, /** * Whether this frame identifies the program counter */ var isPC: Boolean?, /** * The type of the error */ var type: ErrorType? = null, /** * Identifies the exact build this frame originates from. */ var codeIdentifier: String? = null, )</ID>
<ID>LongParameterList:StateEvent.kt$StateEvent.Install$( @JvmField val apiKey: String, @JvmField val autoDetectNdkCrashes: Boolean, @JvmField val appVersion: String?, @JvmField val buildUuid: String?, @JvmField val releaseStage: String?, @JvmField val lastRunInfoPath: String, @JvmField val consecutiveLaunchCrashes: Int, @JvmField val sendThreads: ThreadSendPolicy )</ID>
<ID>LongParameterList:StateEvent.kt$StateEvent.Install$( @JvmField val apiKey: String, @JvmField val autoDetectNdkCrashes: Boolean, @JvmField val appVersion: String?, @JvmField val buildUuid: String?, @JvmField val releaseStage: String?, @JvmField val lastRunInfoPath: String, @JvmField val consecutiveLaunchCrashes: Int, @JvmField val sendThreads: ThreadSendPolicy, @JvmField val maxBreadcrumbs: Int )</ID>
<ID>LongParameterList:ThreadState.kt$ThreadState$( allThreads: List&lt;JavaThread>, currentThread: JavaThread, exc: Throwable?, isUnhandled: Boolean, maxThreadCount: Int, threadCollectionTimeLimitMillis: Long, projectPackages: Collection&lt;String>, logger: Logger )</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$299</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$429</ID>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -34,6 +36,7 @@ public class MemoryTrimTest {
@Test
public void onLowMemoryEvent() {
when(context.getApplicationContext()).thenReturn(context);
doNothing().when(context).registerComponentCallbacks(any());
Client client = new Client(context, BugsnagTestUtils.generateConfiguration());

// block until observer is registered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ internal class ClientObservable : BaseObservable() {
conf.releaseStage,
lastRunInfoPath,
consecutiveLaunchCrashes,
conf.sendThreads
conf.sendThreads,
conf.maxBreadcrumbs
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ internal class EventStore(
}

private fun handleEventFlushFailure(exc: Exception, eventFile: File) {
delegate?.onErrorIOFailure(exc, eventFile, "Crash Report Deserialization")
logger.e(exc.message ?: "Failed to send event", exc)
deleteStoredFiles(setOf(eventFile))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.io.IOException
*/
class Notifier @JvmOverloads constructor(
var name: String = "Android Bugsnag Notifier",
var version: String = "6.4.0",
var version: String = "6.5.0",
var url: String = "https://bugsnag.com"
) : JsonStream.Streamable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public final class Session implements JsonStream.Streamable, UserAware {
private App app;
private Device device;

private final AtomicBoolean autoCaptured = new AtomicBoolean(false);
private volatile boolean autoCaptured = false;
private final AtomicInteger unhandledCount = new AtomicInteger();
private final AtomicInteger handledCount = new AtomicInteger();
private final AtomicBoolean tracked = new AtomicBoolean(false);
final AtomicBoolean isPaused = new AtomicBoolean(false);
private final AtomicBoolean isPaused = new AtomicBoolean(false);

private String apiKey;

Expand All @@ -41,7 +41,7 @@ static Session copySession(Session session) {
session.unhandledCount.get(), session.handledCount.get(), session.notifier,
session.logger, session.getApiKey());
copy.tracked.set(session.tracked.get());
copy.autoCaptured.set(session.isAutoCaptured());
copy.autoCaptured = session.isAutoCaptured();
return copy;
}

Expand All @@ -68,7 +68,7 @@ static Session copySession(Session session) {
this.id = id;
this.startedAt = new Date(startedAt.getTime());
this.user = user;
this.autoCaptured.set(autoCaptured);
this.autoCaptured = autoCaptured;
this.apiKey = apiKey;
}

Expand Down Expand Up @@ -198,16 +198,28 @@ Session incrementUnhandledAndCopy() {
return copySession(this);
}

AtomicBoolean isTracked() {
return tracked;
boolean markTracked() {
return tracked.compareAndSet(false, true);
}

boolean markResumed() {
return isPaused.compareAndSet(true, false);
}

void markPaused() {
isPaused.set(true);
}

boolean isPaused() {
return isPaused.get();
}

boolean isAutoCaptured() {
return autoCaptured.get();
return autoCaptured;
}

void setAutoCaptured(boolean autoCaptured) {
this.autoCaptured.set(autoCaptured);
this.autoCaptured = autoCaptured;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void pauseSession() {
Session session = currentSession;

if (session != null) {
session.isPaused.set(true);
session.markPaused();
updateState(StateEvent.PauseSession.INSTANCE);
}
}
Expand All @@ -133,7 +133,7 @@ boolean resumeSession() {
session = startSession(false);
resumed = false;
} else {
resumed = session.isPaused.compareAndSet(true, false);
resumed = session.markResumed();
}

if (session != null) {
Expand Down Expand Up @@ -191,7 +191,7 @@ private boolean trackSessionIfNeeded(final Session session) {
session.setDevice(client.getDeviceDataCollector().generateDevice());
boolean deliverSession = callbackState.runOnSessionTasks(session, logger);

if (deliverSession && session.isTracked().compareAndSet(false, true)) {
if (deliverSession && session.markTracked()) {
currentSession = session;
notifySessionStartObserver(session);
flushInMemorySession(session);
Expand All @@ -205,7 +205,7 @@ private boolean trackSessionIfNeeded(final Session session) {
Session getCurrentSession() {
Session session = currentSession;

if (session != null && !session.isPaused.get()) {
if (session != null && !session.isPaused()) {
return session;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ sealed class StateEvent { // JvmField allows direct field access optimizations
@JvmField val releaseStage: String?,
@JvmField val lastRunInfoPath: String,
@JvmField val consecutiveLaunchCrashes: Int,
@JvmField val sendThreads: ThreadSendPolicy
@JvmField val sendThreads: ThreadSendPolicy,
@JvmField val maxBreadcrumbs: Int
) : StateEvent()

object DeliverPending : StateEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ class SessionTest {
assertEquals(startedAt, copy.startedAt)
assertEquals(getUser(), copy.getUser()) // make a shallow copy
assertEquals(isAutoCaptured, copy.isAutoCaptured)
assertEquals(isTracked.get(), copy.isTracked.get())
assertEquals(markTracked(), copy.markTracked())
assertEquals(markResumed(), copy.markResumed())
assertEquals(isPaused, copy.isPaused)
assertEquals(markPaused(), copy.markPaused())
assertEquals(session.unhandledCount, copy.unhandledCount)
assertEquals(session.handledCount, copy.handledCount)
}
Expand Down
15 changes: 0 additions & 15 deletions bugsnag-android/build.gradle

This file was deleted.

14 changes: 14 additions & 0 deletions bugsnag-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("bugsnag-build-plugin")
id("com.android.library")
}

bugsnagBuildOptions {
compilesCode = false
}

dependencies {
add("api", project(":bugsnag-android-core"))
add("api", project(":bugsnag-plugin-android-anr"))
add("api", project(":bugsnag-plugin-android-ndk"))
}
Loading

0 comments on commit 5946001

Please sign in to comment.