Skip to content

Commit

Permalink
Merge pull request #2043 from bugsnag/release/v6.6.0
Browse files Browse the repository at this point in the history
Release v6.6.0
  • Loading branch information
YYChen01988 authored Jun 19, 2024
2 parents 5946001 + 6544f39 commit 6974b07
Show file tree
Hide file tree
Showing 108 changed files with 2,926 additions and 2,812 deletions.
72 changes: 71 additions & 1 deletion .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ steps:
queue: macos-14
artifact_paths: build/fixture-minimal.apk
command: make fixture-minimal
env:
JAVA_VERSION: 17

- label: ':android: Build Example App'
timeout_in_minutes: 5
agents:
queue: macos-14
command: 'make example-app'
env:
JAVA_VERSION: 17
command: 'make example-app'

- label: ':android: Build debug fixture APK'
key: "fixture-debug"
Expand All @@ -24,6 +26,8 @@ steps:
- "build/fixture-debug.apk"
- "build/fixture-debug/*"
command: make fixture-debug
env:
JAVA_VERSION: 17

- label: ':android: Build Scan'
timeout_in_minutes: 10
Expand Down Expand Up @@ -488,6 +492,72 @@ steps:
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 14 NDK r21 end-to-end tests - batch 1'
depends_on: "fixture-r21"
timeout_in_minutes: 60
plugins:
artifacts#v1.9.0:
download:
- "build/fixture-r21-url.txt"
- "build/fixture-r21/*"
upload:
- "maze_output/failed/**/*"
- "maze_output/metrics.csv"
docker-compose#v4.7.0:
pull: maze-runner
run: maze-runner
service-ports: true
command:
- "features/full_tests"
- "--exclude=features/full_tests/[^a-k].*.feature"
- "--app=@build/fixture-r21-url.txt"
- "--app-activity=com.bugsnag.android.mazerunner.MainActivity"
- "--app-package=com.bugsnag.android.mazerunner"
- "--appium-version=1.22"
- "--farm=bb"
- "--device=ANDROID_14"
- "--no-tunnel"
- "--aws-public-ip"
- "--fail-fast"
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 14 NDK r21 end-to-end tests - batch 2'
depends_on: "fixture-r21"
timeout_in_minutes: 60
plugins:
artifacts#v1.9.0:
download:
- "build/fixture-r21-url.txt"
- "build/fixture-r21/*"
upload:
- "maze_output/failed/**/*"
- "maze_output/metrics.csv"
docker-compose#v4.7.0:
pull: maze-runner
run: maze-runner
service-ports: true
command:
- "features/full_tests"
- "--exclude=features/full_tests/[^l-z].*.feature"
- "--app=@build/fixture-r21-url.txt"
- "--app-activity=com.bugsnag.android.mazerunner.MainActivity"
- "--app-package=com.bugsnag.android.mazerunner"
- "--appium-version=1.22"
- "--farm=bb"
- "--device=ANDROID_14"
- "--no-tunnel"
- "--aws-public-ip"
- "--fail-fast"
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar'
concurrency_method: eager

# If there is a tag present activate a manual publishing step

- block: 'Trigger package publish'
Expand Down
48 changes: 48 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ steps:
- bundle install
- make fixture-r19
- bundle exec upload-app --farm=bb --app=./build/fixture-r19.apk --app-id-file=build/fixture-r19-url.txt
env:
JAVA_VERSION: 17

- label: ':android: Build fixture APK r21'
key: "fixture-r21"
Expand All @@ -35,6 +37,8 @@ steps:
- bundle install
- make fixture-r21
- bundle exec upload-app --farm=bb --app=./build/fixture-r21.apk --app-id-file=build/fixture-r21-url.txt
env:
JAVA_VERSION: 17

- label: ':android: Coding standards checks'
timeout_in_minutes: 20
Expand Down Expand Up @@ -67,6 +71,8 @@ steps:
commands:
- cd features/fixtures/mazerunner
- ./gradlew ktlintCheck detekt checkstyle
env:
JAVA_VERSION: 17

- label: ':android: Android size reporting'
timeout_in_minutes: 10
Expand All @@ -80,6 +86,16 @@ steps:
queue: macos-14
command: './gradlew test'

- label: ':android: Instrumentation tests'
timeout_in_minutes: 10
plugins:
artifacts#v1.9.0:
upload: "bugsnag-*/build/reports/androidTests/connected/**/*.html"
agents:
queue: macos-14
command: './scripts/run-connected-checks.rb'
env:
API_LEVEL: 30
#
# BitBar steps
#
Expand Down Expand Up @@ -346,6 +362,38 @@ steps:
concurrency_group: 'bitbar'
concurrency_method: eager

- label: ':bitbar: Android 14 NDK r21 smoke tests'
depends_on: "fixture-r21"
timeout_in_minutes: 60
plugins:
artifacts#v1.9.0:
download:
- "build/fixture-r21-url.txt"
- "build/fixture-r21/*"
upload:
- "maze_output/failed/**/*"
- "maze_output/metrics.csv"
docker-compose#v4.7.0:
pull: maze-runner
run: maze-runner
service-ports: true
command:
- "features/smoke_tests"
- "--app=@build/fixture-r21-url.txt"
- "--app-activity=com.bugsnag.android.mazerunner.MainActivity"
- "--app-package=com.bugsnag.android.mazerunner"
- "--appium-version=1.22"
- "--farm=bb"
- "--device=ANDROID_14"
- "--no-tunnel"
- "--aws-public-ip"
- "--fail-fast"
env:
TEST_FIXTURE_SYMBOL_DIR: "build/fixture-r21"
concurrency: 25
concurrency_group: 'bitbar'
concurrency_method: eager

- label: 'Conditionally include device farms/full tests'
agents:
queue: macos-14
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 6.6.0 (2024-06-19)

### Enhancements

* Support for Android Kernels with a 16kB page size
[#2040](https://github.com/bugsnag/bugsnag-android/pull/2040)

### Bug fixes

* Corrected the behavior when `Bugsnag.startSession` is called when `config.autoTrackSessions=true`, the first automatic session will now be correctly discarded
[#2033](https://github.com/bugsnag/bugsnag-android/pull/2033)
* Avoid a possible crash in the ANR plugin when the native ANR library failed to load.
[#2039](https://github.com/bugsnag/bugsnag-android/pull/2039)

## 6.5.0 (2024-05-15)

### Enhancements
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,31 @@ notifier:

fixture-r19: notifier
# Build the r19 test fixture
@./gradlew -PTEST_FIXTURE_NDK_VERSION=19.2.5345600 \
@cd ./features/fixtures/mazerunner && ./gradlew -PTEST_FIXTURE_NDK_VERSION=19.2.5345600 \
-PTEST_FIXTURE_NAME=fixture-r19.apk \
-p=features/fixtures/mazerunner assembleRelease -x check
assembleRelease -x check
@ruby scripts/copy-build-files.rb release r19

fixture-r21: notifier
# Build the r21 test fixture
@./gradlew -PTEST_FIXTURE_NDK_VERSION=21.4.7075529 \
@cd ./features/fixtures/mazerunner && ./gradlew -PTEST_FIXTURE_NDK_VERSION=21.4.7075529 \
-PTEST_FIXTURE_NAME=fixture-r21.apk \
-p=features/fixtures/mazerunner assembleRelease -x check
assembleRelease -x check
@ruby scripts/copy-build-files.rb release r21

fixture-minimal: notifier
# Build the minimal test fixture
@./gradlew -PMINIMAL_FIXTURE=true \
@cd ./features/fixtures/mazerunner && ./gradlew -PMINIMAL_FIXTURE=true \
-PTEST_FIXTURE_NDK_VERSION=17.2.4988734 \
-PTEST_FIXTURE_NAME=fixture-minimal.apk \
-p=features/fixtures/mazerunner assembleRelease -x check
assembleRelease -x check
@ruby scripts/copy-build-files.rb release minimal

fixture-debug: notifier
# Build the minimal test fixture
@./gradlew -PTEST_FIXTURE_NDK_VERSION=17.2.4988734 \
@cd ./features/fixtures/mazerunner && ./gradlew -PTEST_FIXTURE_NDK_VERSION=17.2.4988734 \
-PTEST_FIXTURE_NAME=fixture-debug.apk \
-p=features/fixtures/mazerunner assembleDebug -x check
assembleDebug -x check
@ruby scripts/copy-build-files.rb debug debug

example-app:
Expand Down Expand Up @@ -86,4 +86,4 @@ endif
check:
@./gradlew lint detekt ktlintCheck checkstyle
@./scripts/run-cpp-check.sh
@./scripts/run-clang-format-ci-check.sh
@./scripts/run-clang-format-ci-check.sh
2 changes: 2 additions & 0 deletions bugsnag-android-core/api/bugsnag-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ public class com/bugsnag/android/Event : com/bugsnag/android/FeatureFlagAware, c
public fun setContext (Ljava/lang/String;)V
public fun setGroupingHash (Ljava/lang/String;)V
public fun setSeverity (Lcom/bugsnag/android/Severity;)V
public fun setTraceCorrelation (Ljava/util/UUID;J)V
public fun setUnhandled (Z)V
public fun setUser (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
protected fun shouldDiscardClass ()Z
Expand Down Expand Up @@ -476,6 +477,7 @@ public class com/bugsnag/android/NativeInterface {
public static fun addMetadata (Ljava/lang/String;Ljava/util/Map;)V
public static fun clearMetadata (Ljava/lang/String;Ljava/lang/String;)V
public static fun createEvent (Ljava/lang/Throwable;Lcom/bugsnag/android/Client;Lcom/bugsnag/android/SeverityReason;)Lcom/bugsnag/android/Event;
public static fun deliverReport (Ljava/io/File;)V
public static fun deliverReport ([B[B[BLjava/lang/String;Z)V
public static fun getApp ()Ljava/util/Map;
public static fun getAppVersion ()Ljava/lang/String;
Expand Down
4 changes: 3 additions & 1 deletion bugsnag-android-core/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<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, @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:BugsnagEventMapper.kt$BugsnagEventMapper$16</ID>
<ID>MagicNumber:BugsnagEventMapper.kt$BugsnagEventMapper$32</ID>
<ID>MagicNumber:BugsnagEventMapper.kt$BugsnagEventMapper$56</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$299</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$429</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$499</ID>
Expand Down Expand Up @@ -55,7 +58,6 @@
<ID>SwallowedException:DeviceDataCollector.kt$DeviceDataCollector$exception: Exception</ID>
<ID>SwallowedException:DeviceIdFilePersistence.kt$DeviceIdFilePersistence$exc: OverlappingFileLockException</ID>
<ID>SwallowedException:EventStore.kt$EventStore$exception: RejectedExecutionException</ID>
<ID>SwallowedException:EventStore.kt$EventStore$ioe: Exception</ID>
<ID>SwallowedException:ForegroundDetector.kt$ForegroundDetector$e: Exception</ID>
<ID>SwallowedException:ImmutableConfig.kt$e: Exception</ID>
<ID>SwallowedException:JsonHelperTest.kt$JsonHelperTest$e: IllegalArgumentException</ID>
Expand Down
24 changes: 14 additions & 10 deletions bugsnag-android-core/src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
set(BUGSNAG_VERSION 1.0.1)
add_library( # Specifies the name of the library.
bugsnag-root-detection
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
jni/root_detection.c
)
bugsnag-root-detection
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
jni/root_detection.c
)

include_directories(jni)

set_target_properties(bugsnag-root-detection
PROPERTIES
COMPILE_OPTIONS
-Werror -Wall -pedantic)
set(EXTRA_LINK_FLAGS "-Wl,-z,max-page-size=16384")

set_target_properties(
bugsnag-root-detection
PROPERTIES
COMPILE_OPTIONS -Werror -Wall -pedantic
LINK_FLAGS "${EXTRA_LINK_FLAGS}"
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import java.util.TimeZone
import java.util.UUID

internal class BugsnagEventMapper(
private val logger: Logger
Expand Down Expand Up @@ -93,6 +94,16 @@ internal class BugsnagEventMapper(
// populate internalMetrics
event.internalMetrics = InternalMetricsImpl(map["usage"] as MutableMap<String, Any>?)

// populate correlation
(map["correlation"] as? Map<String, String>)?.let {
val traceId = parseTraceId(it["traceId"])
val spanId = it["spanId"]?.parseUnsignedLong()

if (traceId != null && spanId != null) {
event.traceCorrelation = TraceCorrelation(traceId, spanId)
}
}

return event
}

Expand Down Expand Up @@ -234,21 +245,47 @@ internal class BugsnagEventMapper(
}
}

// SimpleDateFormat isn't thread safe, cache one instance per thread as needed.
private val ndkDateFormatHolder = object : ThreadLocal<DateFormat>() {
override fun initialValue(): DateFormat {
return SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US).apply {
timeZone = TimeZone.getTimeZone("UTC")
private fun String.toDate(): Date {
if (isNotEmpty() && this[0] == 't') {
// date is in the format 't{epoch millis}'
val timestamp = substring(1)
timestamp.toLongOrNull()?.let {
return Date(it)
}
}
}

private fun String.toDate(): Date {
return try {
DateUtils.fromIso8601(this)
} catch (pe: IllegalArgumentException) {
ndkDateFormatHolder.get()!!.parse(this)
?: throw IllegalArgumentException("cannot parse date $this")
}
}

private fun parseTraceId(traceId: String?): UUID? {
if (traceId?.length != 32) return null
val mostSigBits = traceId.substring(0, 16).parseUnsignedLong() ?: return null
val leastSigBits = traceId.substring(16).parseUnsignedLong() ?: return null

return UUID(mostSigBits, leastSigBits)
}

private fun String.parseUnsignedLong(): Long? {
if (length != 16) return null
return try {
(substring(0, 2).toLong(16) shl 56) or
substring(2).toLong(16)
} catch (nfe: NumberFormatException) {
null
}
}

// SimpleDateFormat isn't thread safe, cache one instance per thread as needed.
private val ndkDateFormatHolder = object : ThreadLocal<DateFormat>() {
override fun initialValue(): DateFormat {
return SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US).apply {
timeZone = TimeZone.getTimeZone("UTC")
}
}
}
}
Loading

0 comments on commit 6974b07

Please sign in to comment.