Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5a8e98c
Add support for sqflite
Mar 2, 2023
66e7544
fix
marandaneto Mar 2, 2023
29c9e80
add CI workflow
marandaneto Mar 2, 2023
c7caa13
fix ci workflow name
marandaneto Mar 2, 2023
77f7b03
add craft
marandaneto Mar 2, 2023
aa8398d
add wrappers
marandaneto Mar 2, 2023
bd9aaf6
implement more queries and add example
marandaneto Mar 3, 2023
2c28b44
add transaction wrapper
marandaneto Mar 3, 2023
2e880ff
add sample example
marandaneto Mar 3, 2023
a8174c7
fix readme
marandaneto Mar 3, 2023
4c3c624
fix conflicts
marandaneto Mar 7, 2023
a949bae
add batch support
marandaneto Mar 7, 2023
0cbb95b
add pending sdk version, name and bail out if tracing not enabled
marandaneto Mar 7, 2023
d111dcb
fix integration name
marandaneto Mar 7, 2023
aec5fd1
fix CI
marandaneto Mar 8, 2023
656b3c7
fix CI
marandaneto Mar 8, 2023
497ab2a
fix gitignore
marandaneto Mar 8, 2023
4e54794
fix analyse
marandaneto Mar 8, 2023
6246577
fix deps
marandaneto Mar 8, 2023
6335b07
add flutter dep
marandaneto Mar 8, 2023
9db80da
fix java version
marandaneto Mar 8, 2023
3197196
fix java version
marandaneto Mar 8, 2023
85dd630
add changelog
marandaneto Mar 8, 2023
1fb22a6
remove files
marandaneto Mar 8, 2023
b389605
review
marandaneto Mar 9, 2023
705ea5b
tests for the changes on the dart package
marandaneto Mar 9, 2023
f777df0
more tests
marandaneto Mar 13, 2023
4ba8dd1
Merge branch 'v7.0.0' into chore/sqflite
marandaneto Mar 13, 2023
f574c43
batch tests
marandaneto Mar 13, 2023
6765e2b
add more tests
marandaneto Mar 13, 2023
56468d2
fix
marandaneto Mar 15, 2023
c302025
fix changelog
marandaneto Mar 15, 2023
78de98b
Merge branch 'main' into chore/sqflite
marandaneto Mar 16, 2023
859dd38
fix formatting
marandaneto Mar 16, 2023
0328f10
more tests
marandaneto Mar 16, 2023
25bb9bf
fix
marandaneto Mar 16, 2023
3860e0e
fix versioning
marandaneto Mar 16, 2023
06ab99b
remove comments
marandaneto Mar 16, 2023
8daa8e6
fix
marandaneto Mar 16, 2023
232f68e
Merge branch 'main' into chore/sqflite
marandaneto Mar 17, 2023
70b86e5
fix conflict
marandaneto Mar 17, 2023
6fbe91b
fix changelog
marandaneto Mar 17, 2023
5475333
add dio version test
marandaneto Mar 17, 2023
ba1a027
Merge branch 'main' into chore/sqflite
marandaneto Mar 20, 2023
e56ad39
Merge branch 'main' into chore/sqflite
marandaneto Mar 20, 2023
c6a2a62
fix
marandaneto Mar 20, 2023
a6c782a
remove comment
marandaneto Mar 20, 2023
73cc5f9
fix
marandaneto Mar 20, 2023
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 .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ targets:
logging:
dio:
file:
sqflite:
- name: github
- name: registry
sdks:
Expand All @@ -18,3 +19,4 @@ targets:
pub:sentry_logging:
pub:sentry_dio:
pub:sentry_file:
pub:sentry_sqflite:
2 changes: 2 additions & 0 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
paths-ignore:
- 'logging/**'
- 'dio/**'
- 'file/**'
- 'sqflite/**'

jobs:
cancel-previous-workflow:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
paths-ignore:
- 'logging/**'
- 'flutter/**'
- 'file/**'
- 'sqflite/**'

jobs:
cancel-previous-workflow:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e_dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- 'logging/**'
- 'dio/**'
- 'flutter/**'
- 'file/**'
- 'sqflite/**'

env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'logging/**'
- 'flutter/**'
- 'dio/**'
- 'sqflite/**'

jobs:
cancel-previous-workflow:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
paths-ignore:
- 'logging/**'
- 'dio/**'
- 'file/**'
- 'sqflite/**'

jobs:
cancel-previous-workflow:
Expand Down Expand Up @@ -62,9 +64,10 @@ jobs:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
if: ${{ matrix.target == 'android' }}
with:
java-version: '11'
distribution: 'adopt'
java-version: '8'

# Install required dependencies for Flutter on Linux on Ubuntu
- name: 'Setup Linux'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/flutter_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ on:
push:
branches:
- main
- release/**
pull_request:
paths-ignore:
- 'file/**'

jobs:
cancel-previous-workflow:
Expand All @@ -29,7 +32,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
java-version: '11'

- uses: subosito/flutter-action@1e6ee87cb840500837bcd50a667fb28815d8e310 # pin@v2
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
paths-ignore:
- 'dio/**'
- 'flutter/**'
- 'file/**'
- 'sqflite/**'

jobs:
cancel-previous-workflow:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/min_version_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- main
- release/**
pull_request:
paths-ignore:
- 'file/**'
- 'sqflite/**'

jobs:
cancel-previous-workflow:
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/sqflite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: sentry-sqflite
on:
push:
branches:
- main
- release/**
pull_request:
paths-ignore:
- 'logging/**'
- 'flutter/**'
- 'dio/**'
- 'file/**'

jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # [email protected]
with:
access_token: ${{ github.token }}

build:
name: ${{ matrix.target }} | ${{ matrix.os }} | ${{ matrix.sdk }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
defaults:
run:
shell: bash
strategy:
fail-fast: false
# max-parallel: 4
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
target: ['ios', 'android', 'macos', 'linux', 'windows']
sdk: ['stable', 'beta']
exclude:
- os: ubuntu-latest
target: ios
- os: ubuntu-latest
target: macos
- os: ubuntu-latest
target: windows
- os: windows-latest
target: ios
- os: windows-latest
target: macos
- os: windows-latest
target: linux
# macos-latest is taking hours due to limited resources
- os: macos-latest
target: android
- os: macos-latest
target: web
- os: macos-latest
target: linux
- os: macos-latest
target: windows
# Bad CPU type in executable
- os: macos-latest
sdk: beta

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
if: ${{ matrix.target == 'android' }}
with:
java-version: '11'
distribution: 'adopt'

# Install required dependencies for Flutter on Linux on Ubuntu
- name: 'Setup Linux'
run: |
sudo apt update
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb
sudo apt install -y network-manager upower
if: matrix.os == 'ubuntu-latest'

- uses: subosito/flutter-action@dbf1fa04f4d2e52c33185153d06cdb5443aa189d # pin@v2
with:
channel: ${{ matrix.sdk }}

- run: flutter upgrade

- name: Pub Get
run: |
cd sqflite
flutter pub get

- name: Test VM with coverage
if: runner.os != 'macOS'
run: |
cd sqflite
flutter test --coverage --test-randomize-ordering-seed=random

- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
with:
name: sentry_sqflite
file: ./sqflite/coverage/lcov.info
functionalities: 'search' # remove after https://github.com/codecov/codecov-action/issues/600

- uses: VeryGoodOpenSource/very_good_coverage@84e5b54ab888644554e5573dca87d7f76dec9fb3 # [email protected]
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
with:
path: './sqflite/coverage/lcov.info'
min_coverage: 80

analyze:
uses: ./.github/workflows/analyze.yml
with:
package: sqflite
sdk: flutter
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ dart/coverage/*
logging/coverage/*
dio/coverage/*
file/coverage/*
flutter/coverage/*
sqflite/coverage/*

pubspec.lock
Podfile.lock
flutter/coverage/*

.gradle
flutter/.gradle
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- sqflite Support for Flutter ([#1306](https://github.com/getsentry/sentry-dart/pull/1306))

### Fixes

- LoadImageListIntegration won't throw bad state if there is no exceptions in the event ([#1347](https://github.com/getsentry/sentry-dart/pull/1347))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Sentry SDK for Dart and Flutter
| sentry_logging | [![build](https://github.com/getsentry/sentry-dart/workflows/sentry-logging/badge.svg?branch=main)](https://github.com/getsentry/sentry-dart/actions?query=workflow%3Alogging) | [![pub package](https://img.shields.io/pub/v/sentry_logging.svg)](https://pub.dev/packages/sentry_logging) | [![likes](https://img.shields.io/pub/likes/sentry_logging?logo=dart)](https://pub.dev/packages/sentry_logging/score) | [![popularity](https://img.shields.io/pub/popularity/sentry_logging?logo=dart)](https://pub.dev/packages/sentry_logging/score) | [![pub points](https://img.shields.io/pub/points/sentry_logging?logo=dart)](https://pub.dev/packages/sentry_logging/score)
| sentry_dio | [![build](https://github.com/getsentry/sentry-dart/workflows/sentry-dio/badge.svg?branch=main)](https://github.com/getsentry/sentry-dart/actions?query=workflow%3Asentry-dio) | [![pub package](https://img.shields.io/pub/v/sentry_dio.svg)](https://pub.dev/packages/sentry_dio) | [![likes](https://img.shields.io/pub/likes/sentry_dio?logo=dart)](https://pub.dev/packages/sentry_dio/score) | [![popularity](https://img.shields.io/pub/popularity/sentry_dio?logo=dart)](https://pub.dev/packages/sentry_dio/score) | [![pub points](https://img.shields.io/pub/points/sentry_dio?logo=dart)](https://pub.dev/packages/sentry_dio/score)
| sentry_file | [![build](https://github.com/getsentry/sentry-dart/workflows/sentry-file/badge.svg?branch=main)](https://github.com/getsentry/sentry-dart/actions?query=workflow%3Asentry-file) | [![pub package](https://img.shields.io/pub/v/sentry_file.svg)](https://pub.dev/packages/sentry_file) | [![likes](https://img.shields.io/pub/likes/sentry_file?logo=dart)](https://pub.dev/packages/sentry_file/score) | [![popularity](https://img.shields.io/pub/popularity/sentry_file?logo=dart)](https://pub.dev/packages/sentry_file/score) | [![pub points](https://img.shields.io/pub/points/sentry_file?logo=dart)](https://pub.dev/packages/sentry_file/score)
| sentry_sqflite | [![build](https://github.com/getsentry/sentry-dart/workflows/sentry-sqflite/badge.svg?branch=main)](https://github.com/getsentry/sentry-dart/actions?query=workflow%3Asentry-sqflite) | [![pub package](https://img.shields.io/pub/v/sentry_sqflite.svg)](https://pub.dev/packages/sentry_sqflite) | [![likes](https://img.shields.io/pub/likes/sentry_sqflite)](https://pub.dev/packages/sentry_sqflite/score) | [![popularity](https://img.shields.io/pub/popularity/sentry_sqflite)](https://pub.dev/packages/sentry_sqflite/score) | [![pub points](https://img.shields.io/pub/points/sentry_sqflite)](https://pub.dev/packages/sentry_sqflite/score)

##### Usage

Expand Down
6 changes: 6 additions & 0 deletions dart/lib/src/protocol/sdk_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ class SdkVersion {

/// Adds a package
void addPackage(String name, String version) {
for (final item in _packages) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

irrelevant to the sqflite, but is there some Set analogy in dart which you could use here maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have but that would be breaking, I'll consider it in the next refactoring.

if (item.name == name && item.version == version) {
return;
}
}

final package = SentryPackage(name, version);
_packages.add(package);
}
Expand Down
81 changes: 53 additions & 28 deletions dart/test/protocol/sdk_version_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,46 @@ import 'package:sentry/sentry.dart';
import 'package:test/test.dart';

void main() {
final sdkVersion = SdkVersion(
name: 'name',
version: 'version',
integrations: ['test'],
packages: [SentryPackage('name', 'version')],
);

final sdkVersionJson = <String, dynamic>{
'name': 'name',
'version': 'version',
'integrations': ['test'],
'packages': [
{
'name': 'name',
'version': 'version',
}
],
};

group('json', () {
final fixture = Fixture();

test('toJson', () {
final json = sdkVersion.toJson();
final json = fixture.getSut().toJson();

expect(
DeepCollectionEquality().equals(sdkVersionJson, json),
DeepCollectionEquality().equals(fixture.sdkVersionJson, json),
true,
);
});
test('fromJson', () {
final sdkVersion = SdkVersion.fromJson(sdkVersionJson);
final sdkVersion = SdkVersion.fromJson(fixture.sdkVersionJson);
final json = sdkVersion.toJson();

expect(
DeepCollectionEquality().equals(sdkVersionJson, json),
DeepCollectionEquality().equals(fixture.sdkVersionJson, json),
true,
);
});
});

group('copyWith', () {
final fixture = Fixture();

test('copyWith keeps unchanged', () {
final data = sdkVersion;
final sut = fixture.getSut();

final copy = data.copyWith();
final copy = sut.copyWith();

expect(data.toJson(), copy.toJson());
expect(sut.toJson(), copy.toJson());
});

test('copyWith takes new values', () {
final data = sdkVersion;
final sut = fixture.getSut();

final packages = [SentryPackage('name1', 'version1')];
final integrations = ['test1'];

final copy = data.copyWith(
final copy = sut.copyWith(
name: 'name1',
version: 'version1',
integrations: integrations,
Expand All @@ -76,4 +61,44 @@ void main() {
expect('version1', copy.version);
});
});

group('addPackage', () {
final fixture = Fixture();

test('add package if not same name and version', () {
final sut = fixture.getSut();
sut.addPackage('name1', 'version1');

final last = sut.packages.last;
expect('name1', last.name);
expect('version1', last.version);
});
test('does not add package if the same name and version', () {
final sut = fixture.getSut();
sut.addPackage('name', 'version');

expect(1, sut.packages.length);
});
});
}

class Fixture {
final sdkVersionJson = <String, dynamic>{
'name': 'name',
'version': 'version',
'integrations': ['test'],
'packages': [
{
'name': 'name',
'version': 'version',
}
],
};

SdkVersion getSut() => SdkVersion(
name: 'name',
version: 'version',
integrations: ['test'],
packages: [SentryPackage('name', 'version')],
);
}
2 changes: 1 addition & 1 deletion dart/test/scope_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ void main() {
updatedEvent?.contexts[SentryOperatingSystem.type].name, 'event-os');
});

test('should apply the scope.contexts values ', () async {
test('should apply the scope.contexts values', () async {
final event = SentryEvent();
final scope = Scope(SentryOptions(dsn: fakeDsn));
await scope.setContexts(
Expand Down
Loading